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, |
Takashi Iwai | 9c7a083 | 2011-07-07 09:25:54 +0200 | [diff] [blame] | 2710 | getput_call_t func, bool check_adc_switch) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2711 | { |
| 2712 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2713 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7a083 | 2011-07-07 09:25:54 +0200 | [diff] [blame] | 2714 | int i, err; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2715 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2716 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | 9c7a083 | 2011-07-07 09:25:54 +0200 | [diff] [blame] | 2717 | if (check_adc_switch && spec->dual_adc_switch) { |
| 2718 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 2719 | kcontrol->private_value = |
| 2720 | HDA_COMPOSE_AMP_VAL(spec->adc_nids[i], |
| 2721 | 3, 0, HDA_INPUT); |
| 2722 | err = func(kcontrol, ucontrol); |
| 2723 | if (err < 0) |
| 2724 | goto error; |
| 2725 | } |
| 2726 | } else { |
| 2727 | i = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2728 | kcontrol->private_value = |
| 2729 | HDA_COMPOSE_AMP_VAL(spec->adc_nids[i], |
| 2730 | 3, 0, HDA_INPUT); |
| 2731 | err = func(kcontrol, ucontrol); |
| 2732 | } |
| 2733 | error: |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2734 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2735 | return err; |
| 2736 | } |
| 2737 | |
| 2738 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2739 | struct snd_ctl_elem_value *ucontrol) |
| 2740 | { |
| 2741 | return alc_cap_getput_caller(kcontrol, ucontrol, |
Takashi Iwai | 9c7a083 | 2011-07-07 09:25:54 +0200 | [diff] [blame] | 2742 | snd_hda_mixer_amp_volume_get, false); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2743 | } |
| 2744 | |
| 2745 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2746 | struct snd_ctl_elem_value *ucontrol) |
| 2747 | { |
| 2748 | return alc_cap_getput_caller(kcontrol, ucontrol, |
Takashi Iwai | 9c7a083 | 2011-07-07 09:25:54 +0200 | [diff] [blame] | 2749 | snd_hda_mixer_amp_volume_put, true); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2750 | } |
| 2751 | |
| 2752 | /* capture mixer elements */ |
| 2753 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2754 | |
| 2755 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2756 | struct snd_ctl_elem_value *ucontrol) |
| 2757 | { |
| 2758 | return alc_cap_getput_caller(kcontrol, ucontrol, |
Takashi Iwai | 9c7a083 | 2011-07-07 09:25:54 +0200 | [diff] [blame] | 2759 | snd_hda_mixer_amp_switch_get, false); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2760 | } |
| 2761 | |
| 2762 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2763 | struct snd_ctl_elem_value *ucontrol) |
| 2764 | { |
| 2765 | return alc_cap_getput_caller(kcontrol, ucontrol, |
Takashi Iwai | 9c7a083 | 2011-07-07 09:25:54 +0200 | [diff] [blame] | 2766 | snd_hda_mixer_amp_switch_put, true); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2767 | } |
| 2768 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2769 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2770 | { \ |
| 2771 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2772 | .name = "Capture Switch", \ |
| 2773 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2774 | .count = num, \ |
| 2775 | .info = alc_cap_sw_info, \ |
| 2776 | .get = alc_cap_sw_get, \ |
| 2777 | .put = alc_cap_sw_put, \ |
| 2778 | }, \ |
| 2779 | { \ |
| 2780 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2781 | .name = "Capture Volume", \ |
| 2782 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2783 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2784 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2785 | .count = num, \ |
| 2786 | .info = alc_cap_vol_info, \ |
| 2787 | .get = alc_cap_vol_get, \ |
| 2788 | .put = alc_cap_vol_put, \ |
| 2789 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2790 | } |
| 2791 | |
| 2792 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2793 | { \ |
| 2794 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2795 | /* .name = "Capture Source", */ \ |
| 2796 | .name = "Input Source", \ |
| 2797 | .count = num, \ |
| 2798 | .info = alc_mux_enum_info, \ |
| 2799 | .get = alc_mux_enum_get, \ |
| 2800 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | #define DEFINE_CAPMIX(num) \ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2804 | static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2805 | _DEFINE_CAPMIX(num), \ |
| 2806 | _DEFINE_CAPSRC(num), \ |
| 2807 | { } /* end */ \ |
| 2808 | } |
| 2809 | |
| 2810 | #define DEFINE_CAPMIX_NOSRC(num) \ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2811 | static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2812 | _DEFINE_CAPMIX(num), \ |
| 2813 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2814 | } |
| 2815 | |
| 2816 | /* up to three ADCs */ |
| 2817 | DEFINE_CAPMIX(1); |
| 2818 | DEFINE_CAPMIX(2); |
| 2819 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2820 | DEFINE_CAPMIX_NOSRC(1); |
| 2821 | DEFINE_CAPMIX_NOSRC(2); |
| 2822 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2823 | |
| 2824 | /* |
| 2825 | * ALC880 5-stack model |
| 2826 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2827 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2828 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2829 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2830 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2831 | */ |
| 2832 | |
| 2833 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2834 | static const struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2835 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2836 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2837 | { } /* end */ |
| 2838 | }; |
| 2839 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2840 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2841 | /* 6ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2842 | static const struct hda_verb alc880_fivestack_ch6_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2843 | /* set line-in to input, mute it */ |
| 2844 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2845 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2846 | { } /* end */ |
| 2847 | }; |
| 2848 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2849 | /* 8ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2850 | static const struct hda_verb alc880_fivestack_ch8_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2851 | /* set line-in to output, unmute it */ |
| 2852 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2853 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2854 | { } /* end */ |
| 2855 | }; |
| 2856 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2857 | static const struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2858 | { 6, alc880_fivestack_ch6_init }, |
| 2859 | { 8, alc880_fivestack_ch8_init }, |
| 2860 | }; |
| 2861 | |
| 2862 | |
| 2863 | /* |
| 2864 | * ALC880 6-stack model |
| 2865 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2866 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2867 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2868 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2869 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2870 | */ |
| 2871 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2872 | static const hda_nid_t alc880_6st_dac_nids[4] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2873 | /* front, rear, clfe, rear_surr */ |
| 2874 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2875 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2876 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2877 | static const struct hda_input_mux alc880_6stack_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2878 | .num_items = 4, |
| 2879 | .items = { |
| 2880 | { "Mic", 0x0 }, |
| 2881 | { "Front Mic", 0x1 }, |
| 2882 | { "Line", 0x2 }, |
| 2883 | { "CD", 0x4 }, |
| 2884 | }, |
| 2885 | }; |
| 2886 | |
| 2887 | /* fixed 8-channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2888 | static const struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2889 | { 8, NULL }, |
| 2890 | }; |
| 2891 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2892 | static const struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2894 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2895 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2896 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2897 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2898 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2899 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2900 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2901 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2902 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2903 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2904 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2905 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2906 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2909 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2910 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2911 | { |
| 2912 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2913 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2914 | .info = alc_ch_mode_info, |
| 2915 | .get = alc_ch_mode_get, |
| 2916 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2917 | }, |
| 2918 | { } /* end */ |
| 2919 | }; |
| 2920 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2921 | |
| 2922 | /* |
| 2923 | * ALC880 W810 model |
| 2924 | * |
| 2925 | * W810 has rear IO for: |
| 2926 | * Front (DAC 02) |
| 2927 | * Surround (DAC 03) |
| 2928 | * Center/LFE (DAC 04) |
| 2929 | * Digital out (06) |
| 2930 | * |
| 2931 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2932 | * 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] | 2933 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2934 | * There is a variable resistor to control the speaker or headphone |
| 2935 | * volume. This is a hardware-only device without a software API. |
| 2936 | * |
| 2937 | * Plugging headphones in will disable the internal speakers. This is |
| 2938 | * implemented in hardware, not via the driver using jack sense. In |
| 2939 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2940 | * disable both the speakers and headphones. |
| 2941 | * |
| 2942 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2943 | * These may not do anything useful with this driver yet, because I |
| 2944 | * haven't setup any initialization verbs for these yet... |
| 2945 | */ |
| 2946 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2947 | static const hda_nid_t alc880_w810_dac_nids[3] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2948 | /* front, rear/surround, clfe */ |
| 2949 | 0x02, 0x03, 0x04 |
| 2950 | }; |
| 2951 | |
| 2952 | /* fixed 6 channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2953 | static const struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2954 | { 6, NULL } |
| 2955 | }; |
| 2956 | |
| 2957 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2958 | static const struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2960 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2961 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2962 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2963 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2964 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2965 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2966 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2967 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2968 | { } /* end */ |
| 2969 | }; |
| 2970 | |
| 2971 | |
| 2972 | /* |
| 2973 | * Z710V model |
| 2974 | * |
| 2975 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2976 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2977 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2978 | */ |
| 2979 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2980 | static const hda_nid_t alc880_z71v_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2981 | 0x02 |
| 2982 | }; |
| 2983 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2984 | |
| 2985 | /* fixed 2 channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2986 | static const struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2987 | { 2, NULL } |
| 2988 | }; |
| 2989 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2990 | static const struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2991 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2992 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2993 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2994 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2995 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2996 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2999 | { } /* end */ |
| 3000 | }; |
| 3001 | |
| 3002 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3003 | /* |
| 3004 | * ALC880 F1734 model |
| 3005 | * |
| 3006 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 3007 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 3008 | */ |
| 3009 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3010 | static const hda_nid_t alc880_f1734_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3011 | 0x03 |
| 3012 | }; |
| 3013 | #define ALC880_F1734_HP_DAC 0x02 |
| 3014 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3015 | static const struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3016 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3017 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3018 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3019 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3020 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3021 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3024 | { } /* end */ |
| 3025 | }; |
| 3026 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3027 | static const struct hda_input_mux alc880_f1734_capture_source = { |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3028 | .num_items = 2, |
| 3029 | .items = { |
| 3030 | { "Mic", 0x1 }, |
| 3031 | { "CD", 0x4 }, |
| 3032 | }, |
| 3033 | }; |
| 3034 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3035 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | /* |
| 3037 | * ALC880 ASUS model |
| 3038 | * |
| 3039 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 3040 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 3041 | * Mic = 0x18, Line = 0x1a |
| 3042 | */ |
| 3043 | |
| 3044 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 3045 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 3046 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3047 | static const struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3048 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3049 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3050 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3051 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3052 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3053 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3054 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3055 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3056 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3057 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 3058 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3059 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 3060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3062 | { |
| 3063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3064 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3065 | .info = alc_ch_mode_info, |
| 3066 | .get = alc_ch_mode_get, |
| 3067 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3068 | }, |
| 3069 | { } /* end */ |
| 3070 | }; |
| 3071 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3072 | /* |
| 3073 | * ALC880 ASUS W1V model |
| 3074 | * |
| 3075 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 3076 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 3077 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 3078 | */ |
| 3079 | |
| 3080 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3081 | static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3082 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 3083 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3084 | { } /* end */ |
| 3085 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3086 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3087 | /* TCL S700 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3088 | static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3089 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3090 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 3091 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 3092 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 3093 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 3094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 3095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 3096 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 3097 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3098 | { } /* end */ |
| 3099 | }; |
| 3100 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3101 | /* Uniwill */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3102 | static const struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3103 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3104 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3105 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3106 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3107 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3108 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3109 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3110 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3111 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3112 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 3113 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3114 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 3115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3117 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3118 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3119 | { |
| 3120 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3121 | .name = "Channel Mode", |
| 3122 | .info = alc_ch_mode_info, |
| 3123 | .get = alc_ch_mode_get, |
| 3124 | .put = alc_ch_mode_put, |
| 3125 | }, |
| 3126 | { } /* end */ |
| 3127 | }; |
| 3128 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3129 | static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3130 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3131 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3132 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3133 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3134 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3135 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 3136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 3138 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3139 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3140 | { } /* end */ |
| 3141 | }; |
| 3142 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3143 | static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3144 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3145 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3146 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3147 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3148 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3150 | { } /* end */ |
| 3151 | }; |
| 3152 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3153 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3154 | * virtual master controls |
| 3155 | */ |
| 3156 | |
| 3157 | /* |
| 3158 | * slave controls for virtual master |
| 3159 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3160 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3161 | "Front Playback Volume", |
| 3162 | "Surround Playback Volume", |
| 3163 | "Center Playback Volume", |
| 3164 | "LFE Playback Volume", |
| 3165 | "Side Playback Volume", |
| 3166 | "Headphone Playback Volume", |
| 3167 | "Speaker Playback Volume", |
| 3168 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3169 | "Line-Out Playback Volume", |
| 3170 | NULL, |
| 3171 | }; |
| 3172 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3173 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3174 | "Front Playback Switch", |
| 3175 | "Surround Playback Switch", |
| 3176 | "Center Playback Switch", |
| 3177 | "LFE Playback Switch", |
| 3178 | "Side Playback Switch", |
| 3179 | "Headphone Playback Switch", |
| 3180 | "Speaker Playback Switch", |
| 3181 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 3182 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 3183 | "Line-Out Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3184 | NULL, |
| 3185 | }; |
| 3186 | |
| 3187 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3188 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3189 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3190 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3191 | #define NID_MAPPING (-1) |
| 3192 | |
| 3193 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 3194 | #define SUBDEV_HP_ (1 << 6) |
| 3195 | #define SUBDEV_LINE_ (2 << 6) |
| 3196 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 3197 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 3198 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 3199 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3200 | static void alc_free_kctls(struct hda_codec *codec); |
| 3201 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3202 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3203 | /* additional beep mixers; the actual parameters are overwritten at build */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3204 | static const struct snd_kcontrol_new alc_beep_mixer[] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3205 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3206 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3207 | { } /* end */ |
| 3208 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3209 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3210 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3211 | static int alc_build_controls(struct hda_codec *codec) |
| 3212 | { |
| 3213 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 3214 | struct snd_kcontrol *kctl = NULL; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3215 | const struct snd_kcontrol_new *knew; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3216 | int i, j, err; |
| 3217 | unsigned int u; |
| 3218 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3219 | |
| 3220 | for (i = 0; i < spec->num_mixers; i++) { |
| 3221 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3222 | if (err < 0) |
| 3223 | return err; |
| 3224 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3225 | if (spec->cap_mixer) { |
| 3226 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3227 | if (err < 0) |
| 3228 | return err; |
| 3229 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3230 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3231 | err = snd_hda_create_spdif_out_ctls(codec, |
Stephen Warren | 74b654c | 2011-06-01 11:14:18 -0600 | [diff] [blame] | 3232 | spec->multiout.dig_out_nid, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3233 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3234 | if (err < 0) |
| 3235 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3236 | if (!spec->no_analog) { |
| 3237 | err = snd_hda_create_spdif_share_sw(codec, |
| 3238 | &spec->multiout); |
| 3239 | if (err < 0) |
| 3240 | return err; |
| 3241 | spec->multiout.share_spdif = 1; |
| 3242 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3243 | } |
| 3244 | if (spec->dig_in_nid) { |
| 3245 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3246 | if (err < 0) |
| 3247 | return err; |
| 3248 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3249 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3250 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3251 | /* create beep controls if needed */ |
| 3252 | if (spec->beep_amp) { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3253 | const struct snd_kcontrol_new *knew; |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3254 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3255 | struct snd_kcontrol *kctl; |
| 3256 | kctl = snd_ctl_new1(knew, codec); |
| 3257 | if (!kctl) |
| 3258 | return -ENOMEM; |
| 3259 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3260 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3261 | if (err < 0) |
| 3262 | return err; |
| 3263 | } |
| 3264 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3265 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3266 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3267 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3268 | if (!spec->no_analog && |
| 3269 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3270 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3271 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3272 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3273 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3274 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3275 | if (err < 0) |
| 3276 | return err; |
| 3277 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3278 | if (!spec->no_analog && |
| 3279 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3280 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3281 | NULL, alc_slave_sws); |
| 3282 | if (err < 0) |
| 3283 | return err; |
| 3284 | } |
| 3285 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3286 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3287 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3288 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3289 | if (!kctl) |
| 3290 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3291 | for (i = 0; kctl && i < kctl->count; i++) { |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3292 | const hda_nid_t *nids = spec->capsrc_nids; |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3293 | if (!nids) |
| 3294 | nids = spec->adc_nids; |
| 3295 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3296 | if (err < 0) |
| 3297 | return err; |
| 3298 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3299 | } |
| 3300 | if (spec->cap_mixer) { |
| 3301 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3302 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3303 | if (kname && strcmp(knew->name, kname) == 0) |
| 3304 | continue; |
| 3305 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3306 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3307 | err = snd_hda_add_nid(codec, kctl, i, |
| 3308 | spec->adc_nids[i]); |
| 3309 | if (err < 0) |
| 3310 | return err; |
| 3311 | } |
| 3312 | } |
| 3313 | } |
| 3314 | |
| 3315 | /* other nid->control mapping */ |
| 3316 | for (i = 0; i < spec->num_mixers; i++) { |
| 3317 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3318 | if (knew->iface != NID_MAPPING) |
| 3319 | continue; |
| 3320 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3321 | if (kctl == NULL) |
| 3322 | continue; |
| 3323 | u = knew->subdevice; |
| 3324 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3325 | nid = u & 0x3f; |
| 3326 | if (nid == 0) |
| 3327 | continue; |
| 3328 | switch (u & 0xc0) { |
| 3329 | case SUBDEV_SPEAKER_: |
| 3330 | nid = spec->autocfg.speaker_pins[nid]; |
| 3331 | break; |
| 3332 | case SUBDEV_LINE_: |
| 3333 | nid = spec->autocfg.line_out_pins[nid]; |
| 3334 | break; |
| 3335 | case SUBDEV_HP_: |
| 3336 | nid = spec->autocfg.hp_pins[nid]; |
| 3337 | break; |
| 3338 | default: |
| 3339 | continue; |
| 3340 | } |
| 3341 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3342 | if (err < 0) |
| 3343 | return err; |
| 3344 | } |
| 3345 | u = knew->private_value; |
| 3346 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3347 | nid = u & 0xff; |
| 3348 | if (nid == 0) |
| 3349 | continue; |
| 3350 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3351 | if (err < 0) |
| 3352 | return err; |
| 3353 | } |
| 3354 | } |
| 3355 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3356 | |
| 3357 | alc_free_kctls(codec); /* no longer needed */ |
| 3358 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3359 | return 0; |
| 3360 | } |
| 3361 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3363 | /* |
| 3364 | * initialize the codec volumes, etc |
| 3365 | */ |
| 3366 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3367 | /* |
| 3368 | * generic initialization of ADC, input mixers and output mixers |
| 3369 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3370 | static const struct hda_verb alc880_volume_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3371 | /* |
| 3372 | * Unmute ADC0-2 and set the default input to mic-in |
| 3373 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3374 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3375 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3376 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3378 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3379 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3380 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3381 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3382 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3383 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3384 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3385 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3386 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3391 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3392 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3393 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3394 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3395 | /* |
| 3396 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3397 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3398 | /* set vol=0 to output mixers */ |
| 3399 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3400 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3402 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3403 | /* set up input amps for analog loopback */ |
| 3404 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3406 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3408 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3409 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3411 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3412 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3413 | |
| 3414 | { } |
| 3415 | }; |
| 3416 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3417 | /* |
| 3418 | * 3-stack pin configuration: |
| 3419 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3420 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3421 | static const struct hda_verb alc880_pin_3stack_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3422 | /* |
| 3423 | * preset connection lists of input pins |
| 3424 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3425 | */ |
| 3426 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3427 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3428 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3429 | |
| 3430 | /* |
| 3431 | * Set pin mode and muting |
| 3432 | */ |
| 3433 | /* set front pin widgets 0x14 for output */ |
| 3434 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3435 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3436 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3437 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3439 | /* Mic2 (as headphone out) for HP output */ |
| 3440 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3441 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3442 | /* Line In pin widget for input */ |
| 3443 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3444 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3445 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3446 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3447 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3448 | /* CD pin widget for input */ |
| 3449 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3450 | |
| 3451 | { } |
| 3452 | }; |
| 3453 | |
| 3454 | /* |
| 3455 | * 5-stack pin configuration: |
| 3456 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3457 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3458 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3459 | static const struct hda_verb alc880_pin_5stack_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3460 | /* |
| 3461 | * preset connection lists of input pins |
| 3462 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3463 | */ |
| 3464 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3465 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3466 | |
| 3467 | /* |
| 3468 | * Set pin mode and muting |
| 3469 | */ |
| 3470 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3471 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3472 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3473 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3474 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3475 | /* unmute pins for output (no gain on this amp) */ |
| 3476 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3477 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3478 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3479 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3480 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3481 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3482 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3483 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3484 | /* Mic2 (as headphone out) for HP output */ |
| 3485 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3486 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3487 | /* Line In pin widget for input */ |
| 3488 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3489 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3490 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3491 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3492 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3493 | /* CD pin widget for input */ |
| 3494 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3495 | |
| 3496 | { } |
| 3497 | }; |
| 3498 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3499 | /* |
| 3500 | * W810 pin configuration: |
| 3501 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3502 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3503 | static const struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3504 | /* hphone/speaker input selector: front DAC */ |
| 3505 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3506 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3509 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3510 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3511 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3512 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3513 | |
| 3514 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3515 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3516 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3517 | { } |
| 3518 | }; |
| 3519 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3520 | /* |
| 3521 | * Z71V pin configuration: |
| 3522 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3523 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3524 | static const struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3525 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3526 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3527 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3528 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3529 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3530 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3531 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3532 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3533 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3534 | |
| 3535 | { } |
| 3536 | }; |
| 3537 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3538 | /* |
| 3539 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3540 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3541 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3542 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3543 | static const struct hda_verb alc880_pin_6stack_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3544 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3545 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3546 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3547 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3548 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3549 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3550 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3552 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3553 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3554 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3555 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3556 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3557 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3558 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3559 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3560 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3561 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3562 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3563 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3564 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3565 | { } |
| 3566 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3567 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3568 | /* |
| 3569 | * Uniwill pin configuration: |
| 3570 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3571 | * line = 0x1a |
| 3572 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3573 | static const struct hda_verb alc880_uniwill_init_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3574 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3575 | |
| 3576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3577 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3578 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3579 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3580 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3581 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3582 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3583 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3588 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3590 | |
| 3591 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3592 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3593 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3594 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3595 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3597 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3598 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3599 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3600 | |
| 3601 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3602 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3603 | |
| 3604 | { } |
| 3605 | }; |
| 3606 | |
| 3607 | /* |
| 3608 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3609 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3610 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3611 | static const struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3612 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3613 | |
| 3614 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3615 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3616 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3617 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3618 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3619 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3620 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3621 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3622 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3623 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3624 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3625 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3626 | |
| 3627 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3628 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3629 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3630 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3631 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3632 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3633 | |
| 3634 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3635 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3636 | |
| 3637 | { } |
| 3638 | }; |
| 3639 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3640 | static const struct hda_verb alc880_beep_init_verbs[] = { |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3641 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3642 | { } |
| 3643 | }; |
| 3644 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3645 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3646 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3647 | { |
| 3648 | unsigned int present; |
| 3649 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3650 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3651 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3652 | bits = present ? HDA_AMP_MUTE : 0; |
| 3653 | 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] | 3654 | } |
| 3655 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3656 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3657 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3658 | struct alc_spec *spec = codec->spec; |
| 3659 | |
| 3660 | spec->autocfg.hp_pins[0] = 0x14; |
| 3661 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3662 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3663 | spec->automute = 1; |
| 3664 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3665 | } |
| 3666 | |
| 3667 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3668 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3669 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3670 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3671 | } |
| 3672 | |
| 3673 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3674 | unsigned int res) |
| 3675 | { |
| 3676 | /* Looks like the unsol event is incompatible with the standard |
| 3677 | * definition. 4bit tag is placed at 28 bit! |
| 3678 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3679 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3680 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3681 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3682 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3683 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3684 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3685 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3686 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3687 | } |
| 3688 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3689 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3690 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3691 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3692 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3693 | spec->autocfg.hp_pins[0] = 0x14; |
| 3694 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3695 | spec->automute = 1; |
| 3696 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3697 | } |
| 3698 | |
| 3699 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3700 | { |
| 3701 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3702 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3703 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3704 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3705 | present &= HDA_AMP_VOLMASK; |
| 3706 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3707 | HDA_AMP_VOLMASK, present); |
| 3708 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3709 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3710 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3711 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3712 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3713 | unsigned int res) |
| 3714 | { |
| 3715 | /* Looks like the unsol event is incompatible with the standard |
| 3716 | * definition. 4bit tag is placed at 28 bit! |
| 3717 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3718 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3719 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3720 | else |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3721 | alc_sku_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3722 | } |
| 3723 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3724 | /* |
| 3725 | * F1734 pin configuration: |
| 3726 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3727 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3728 | static const struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3729 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3730 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3731 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3732 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3733 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3734 | |
| 3735 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3736 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3737 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3739 | |
| 3740 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3741 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3742 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3743 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3744 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3745 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3746 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3747 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3748 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3749 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3750 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3751 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3752 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3753 | { } |
| 3754 | }; |
| 3755 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3756 | /* |
| 3757 | * ASUS pin configuration: |
| 3758 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3759 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3760 | static const struct hda_verb alc880_pin_asus_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3761 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3762 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3763 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3764 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3765 | |
| 3766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3768 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3770 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3771 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3772 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3773 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3774 | |
| 3775 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3776 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3777 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3778 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3779 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3780 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3781 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3782 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3783 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3784 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3785 | { } |
| 3786 | }; |
| 3787 | |
| 3788 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3789 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3790 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3791 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3793 | /* Clevo m520g init */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3794 | static const struct hda_verb alc880_pin_clevo_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3795 | /* headphone output */ |
| 3796 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3797 | /* line-out */ |
| 3798 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3799 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3800 | /* Line-in */ |
| 3801 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3802 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3803 | /* CD */ |
| 3804 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3805 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3806 | /* Mic1 (rear panel) */ |
| 3807 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3808 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3809 | /* Mic2 (front panel) */ |
| 3810 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3811 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3812 | /* headphone */ |
| 3813 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3814 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3815 | /* change to EAPD mode */ |
| 3816 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3817 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3818 | |
| 3819 | { } |
| 3820 | }; |
| 3821 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3822 | static const struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3823 | /* change to EAPD mode */ |
| 3824 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3825 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3826 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3827 | /* Headphone output */ |
| 3828 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3829 | /* Front output*/ |
| 3830 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3831 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3832 | |
| 3833 | /* Line In pin widget for input */ |
| 3834 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3835 | /* CD pin widget for input */ |
| 3836 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3837 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3838 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3839 | |
| 3840 | /* change to EAPD mode */ |
| 3841 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3842 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3843 | |
| 3844 | { } |
| 3845 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3846 | |
| 3847 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3848 | * LG m1 express dual |
| 3849 | * |
| 3850 | * Pin assignment: |
| 3851 | * Rear Line-In/Out (blue): 0x14 |
| 3852 | * Build-in Mic-In: 0x15 |
| 3853 | * Speaker-out: 0x17 |
| 3854 | * HP-Out (green): 0x1b |
| 3855 | * Mic-In/Out (red): 0x19 |
| 3856 | * SPDIF-Out: 0x1e |
| 3857 | */ |
| 3858 | |
| 3859 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3860 | static const hda_nid_t alc880_lg_dac_nids[3] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3861 | 0x05, 0x02, 0x03 |
| 3862 | }; |
| 3863 | |
| 3864 | /* seems analog CD is not working */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3865 | static const struct hda_input_mux alc880_lg_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3866 | .num_items = 3, |
| 3867 | .items = { |
| 3868 | { "Mic", 0x1 }, |
| 3869 | { "Line", 0x5 }, |
| 3870 | { "Internal Mic", 0x6 }, |
| 3871 | }, |
| 3872 | }; |
| 3873 | |
| 3874 | /* 2,4,6 channel modes */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3875 | static const struct hda_verb alc880_lg_ch2_init[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3876 | /* set line-in and mic-in to input */ |
| 3877 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3878 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3879 | { } |
| 3880 | }; |
| 3881 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3882 | static const struct hda_verb alc880_lg_ch4_init[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3883 | /* set line-in to out and mic-in to input */ |
| 3884 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3885 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3886 | { } |
| 3887 | }; |
| 3888 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3889 | static const struct hda_verb alc880_lg_ch6_init[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3890 | /* set line-in and mic-in to output */ |
| 3891 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3892 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3893 | { } |
| 3894 | }; |
| 3895 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3896 | static const struct hda_channel_mode alc880_lg_ch_modes[3] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3897 | { 2, alc880_lg_ch2_init }, |
| 3898 | { 4, alc880_lg_ch4_init }, |
| 3899 | { 6, alc880_lg_ch6_init }, |
| 3900 | }; |
| 3901 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3902 | static const struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3903 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3904 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3905 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3906 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3907 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3908 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3909 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3910 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3912 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3913 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3914 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3915 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3916 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3917 | { |
| 3918 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3919 | .name = "Channel Mode", |
| 3920 | .info = alc_ch_mode_info, |
| 3921 | .get = alc_ch_mode_get, |
| 3922 | .put = alc_ch_mode_put, |
| 3923 | }, |
| 3924 | { } /* end */ |
| 3925 | }; |
| 3926 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3927 | static const struct hda_verb alc880_lg_init_verbs[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3928 | /* set capture source to mic-in */ |
| 3929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3930 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3931 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3932 | /* mute all amp mixer inputs */ |
| 3933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3936 | /* line-in to input */ |
| 3937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3939 | /* built-in mic */ |
| 3940 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3941 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3942 | /* speaker-out */ |
| 3943 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3944 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3945 | /* mic-in to input */ |
| 3946 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3947 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3948 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3949 | /* HP-out */ |
| 3950 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3952 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3953 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3954 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3955 | { } |
| 3956 | }; |
| 3957 | |
| 3958 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3959 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3960 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3961 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3962 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3963 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3964 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3965 | spec->automute = 1; |
| 3966 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3967 | } |
| 3968 | |
| 3969 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3970 | * LG LW20 |
| 3971 | * |
| 3972 | * Pin assignment: |
| 3973 | * Speaker-out: 0x14 |
| 3974 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3975 | * Built-in Mic-In: 0x19 |
| 3976 | * Line-In: 0x1b |
| 3977 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3978 | * SPDIF-Out: 0x1e |
| 3979 | */ |
| 3980 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3981 | static const struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3982 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3983 | .items = { |
| 3984 | { "Mic", 0x0 }, |
| 3985 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3986 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3987 | }, |
| 3988 | }; |
| 3989 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3990 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3991 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3992 | static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3993 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3994 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3995 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3996 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3997 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3998 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3999 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4000 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 4001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4002 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4005 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 4006 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4007 | { |
| 4008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4009 | .name = "Channel Mode", |
| 4010 | .info = alc_ch_mode_info, |
| 4011 | .get = alc_ch_mode_get, |
| 4012 | .put = alc_ch_mode_put, |
| 4013 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4014 | { } /* end */ |
| 4015 | }; |
| 4016 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4017 | static const struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4018 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 4019 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 4020 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 4021 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4022 | /* set capture source to mic-in */ |
| 4023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4024 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4025 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4027 | /* speaker-out */ |
| 4028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4030 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4031 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4032 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4033 | /* mic-in to input */ |
| 4034 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4035 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4036 | /* built-in mic */ |
| 4037 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4038 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4039 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4040 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4041 | { } |
| 4042 | }; |
| 4043 | |
| 4044 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4045 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4046 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4047 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4048 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4049 | spec->autocfg.hp_pins[0] = 0x1b; |
| 4050 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4051 | spec->automute = 1; |
| 4052 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4053 | } |
| 4054 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4055 | static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4056 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4057 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4059 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4060 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4061 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4062 | { } /* end */ |
| 4063 | }; |
| 4064 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4065 | static const struct hda_input_mux alc880_medion_rim_capture_source = { |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4066 | .num_items = 2, |
| 4067 | .items = { |
| 4068 | { "Mic", 0x0 }, |
| 4069 | { "Internal Mic", 0x1 }, |
| 4070 | }, |
| 4071 | }; |
| 4072 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4073 | static const struct hda_verb alc880_medion_rim_init_verbs[] = { |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4074 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 4075 | |
| 4076 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4077 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4078 | |
| 4079 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4080 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4081 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4082 | /* Mic2 (as headphone out) for HP output */ |
| 4083 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4084 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4085 | /* Internal Speaker */ |
| 4086 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4087 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4088 | |
| 4089 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4090 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 4091 | |
| 4092 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4093 | { } |
| 4094 | }; |
| 4095 | |
| 4096 | /* toggle speaker-output according to the hp-jack state */ |
| 4097 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 4098 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4099 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4100 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4101 | /* toggle EAPD */ |
| 4102 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4103 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 4104 | else |
| 4105 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 4106 | } |
| 4107 | |
| 4108 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 4109 | unsigned int res) |
| 4110 | { |
| 4111 | /* Looks like the unsol event is incompatible with the standard |
| 4112 | * definition. 4bit tag is placed at 28 bit! |
| 4113 | */ |
| 4114 | if ((res >> 28) == ALC880_HP_EVENT) |
| 4115 | alc880_medion_rim_automute(codec); |
| 4116 | } |
| 4117 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4118 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4119 | { |
| 4120 | struct alc_spec *spec = codec->spec; |
| 4121 | |
| 4122 | spec->autocfg.hp_pins[0] = 0x14; |
| 4123 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4124 | spec->automute = 1; |
| 4125 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4126 | } |
| 4127 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4128 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4129 | static const struct hda_amp_list alc880_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4130 | { 0x0b, HDA_INPUT, 0 }, |
| 4131 | { 0x0b, HDA_INPUT, 1 }, |
| 4132 | { 0x0b, HDA_INPUT, 2 }, |
| 4133 | { 0x0b, HDA_INPUT, 3 }, |
| 4134 | { 0x0b, HDA_INPUT, 4 }, |
| 4135 | { } /* end */ |
| 4136 | }; |
| 4137 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4138 | static const struct hda_amp_list alc880_lg_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4139 | { 0x0b, HDA_INPUT, 1 }, |
| 4140 | { 0x0b, HDA_INPUT, 6 }, |
| 4141 | { 0x0b, HDA_INPUT, 7 }, |
| 4142 | { } /* end */ |
| 4143 | }; |
| 4144 | #endif |
| 4145 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4146 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4147 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4148 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4149 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 4150 | static void alc_init_special_input_src(struct hda_codec *codec); |
| 4151 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4152 | static int alc_init(struct hda_codec *codec) |
| 4153 | { |
| 4154 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | unsigned int i; |
| 4156 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 4157 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4158 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 4159 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4160 | for (i = 0; i < spec->num_init_verbs; i++) |
| 4161 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 4162 | alc_init_special_input_src(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4163 | |
| 4164 | if (spec->init_hook) |
| 4165 | spec->init_hook(codec); |
| 4166 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 4167 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 4168 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4169 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4170 | return 0; |
| 4171 | } |
| 4172 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4173 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4174 | { |
| 4175 | struct alc_spec *spec = codec->spec; |
| 4176 | |
| 4177 | if (spec->unsol_event) |
| 4178 | spec->unsol_event(codec, res); |
| 4179 | } |
| 4180 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4181 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4182 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 4183 | { |
| 4184 | struct alc_spec *spec = codec->spec; |
| 4185 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 4186 | } |
| 4187 | #endif |
| 4188 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4189 | /* |
| 4190 | * Analog playback callbacks |
| 4191 | */ |
| 4192 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4193 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4194 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4195 | { |
| 4196 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 4197 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 4198 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4199 | } |
| 4200 | |
| 4201 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4202 | struct hda_codec *codec, |
| 4203 | unsigned int stream_tag, |
| 4204 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4205 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4206 | { |
| 4207 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4208 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 4209 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4210 | } |
| 4211 | |
| 4212 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4213 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4214 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4215 | { |
| 4216 | struct alc_spec *spec = codec->spec; |
| 4217 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 4218 | } |
| 4219 | |
| 4220 | /* |
| 4221 | * Digital out |
| 4222 | */ |
| 4223 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4224 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4225 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4226 | { |
| 4227 | struct alc_spec *spec = codec->spec; |
| 4228 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 4229 | } |
| 4230 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4231 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4232 | struct hda_codec *codec, |
| 4233 | unsigned int stream_tag, |
| 4234 | unsigned int format, |
| 4235 | struct snd_pcm_substream *substream) |
| 4236 | { |
| 4237 | struct alc_spec *spec = codec->spec; |
| 4238 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 4239 | stream_tag, format, substream); |
| 4240 | } |
| 4241 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4242 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4243 | struct hda_codec *codec, |
| 4244 | struct snd_pcm_substream *substream) |
| 4245 | { |
| 4246 | struct alc_spec *spec = codec->spec; |
| 4247 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 4248 | } |
| 4249 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4250 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 4251 | struct hda_codec *codec, |
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 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4256 | } |
| 4257 | |
| 4258 | /* |
| 4259 | * Analog capture |
| 4260 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4261 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4262 | struct hda_codec *codec, |
| 4263 | unsigned int stream_tag, |
| 4264 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4265 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4266 | { |
| 4267 | struct alc_spec *spec = codec->spec; |
| 4268 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4269 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4270 | stream_tag, 0, format); |
| 4271 | return 0; |
| 4272 | } |
| 4273 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4274 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4275 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4276 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4277 | { |
| 4278 | struct alc_spec *spec = codec->spec; |
| 4279 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4280 | snd_hda_codec_cleanup_stream(codec, |
| 4281 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4282 | return 0; |
| 4283 | } |
| 4284 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4285 | /* analog capture with dynamic dual-adc changes */ |
| 4286 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4287 | struct hda_codec *codec, |
| 4288 | unsigned int stream_tag, |
| 4289 | unsigned int format, |
| 4290 | struct snd_pcm_substream *substream) |
| 4291 | { |
| 4292 | struct alc_spec *spec = codec->spec; |
| 4293 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4294 | spec->cur_adc_stream_tag = stream_tag; |
| 4295 | spec->cur_adc_format = format; |
| 4296 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4297 | return 0; |
| 4298 | } |
| 4299 | |
| 4300 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4301 | struct hda_codec *codec, |
| 4302 | struct snd_pcm_substream *substream) |
| 4303 | { |
| 4304 | struct alc_spec *spec = codec->spec; |
| 4305 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4306 | spec->cur_adc = 0; |
| 4307 | return 0; |
| 4308 | } |
| 4309 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4310 | static const struct hda_pcm_stream dualmic_pcm_analog_capture = { |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4311 | .substreams = 1, |
| 4312 | .channels_min = 2, |
| 4313 | .channels_max = 2, |
| 4314 | .nid = 0, /* fill later */ |
| 4315 | .ops = { |
| 4316 | .prepare = dualmic_capture_pcm_prepare, |
| 4317 | .cleanup = dualmic_capture_pcm_cleanup |
| 4318 | }, |
| 4319 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4320 | |
| 4321 | /* |
| 4322 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4323 | static const struct hda_pcm_stream alc880_pcm_analog_playback = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4324 | .substreams = 1, |
| 4325 | .channels_min = 2, |
| 4326 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4328 | .ops = { |
| 4329 | .open = alc880_playback_pcm_open, |
| 4330 | .prepare = alc880_playback_pcm_prepare, |
| 4331 | .cleanup = alc880_playback_pcm_cleanup |
| 4332 | }, |
| 4333 | }; |
| 4334 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4335 | static const struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4336 | .substreams = 1, |
| 4337 | .channels_min = 2, |
| 4338 | .channels_max = 2, |
| 4339 | /* NID is set in alc_build_pcms */ |
| 4340 | }; |
| 4341 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4342 | static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4343 | .substreams = 1, |
| 4344 | .channels_min = 2, |
| 4345 | .channels_max = 2, |
| 4346 | /* NID is set in alc_build_pcms */ |
| 4347 | }; |
| 4348 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4349 | static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4350 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4351 | .channels_min = 2, |
| 4352 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4354 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4355 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4356 | .cleanup = alc880_alt_capture_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_playback = { |
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 | .ops = { |
| 4366 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4367 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4368 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4369 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4370 | }, |
| 4371 | }; |
| 4372 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4373 | static const struct hda_pcm_stream alc880_pcm_digital_capture = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4374 | .substreams = 1, |
| 4375 | .channels_min = 2, |
| 4376 | .channels_max = 2, |
| 4377 | /* NID is set in alc_build_pcms */ |
| 4378 | }; |
| 4379 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4380 | /* 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] | 4381 | static const struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4382 | .substreams = 0, |
| 4383 | .channels_min = 0, |
| 4384 | .channels_max = 0, |
| 4385 | }; |
| 4386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4387 | static int alc_build_pcms(struct hda_codec *codec) |
| 4388 | { |
| 4389 | struct alc_spec *spec = codec->spec; |
| 4390 | struct hda_pcm *info = spec->pcm_rec; |
| 4391 | int i; |
| 4392 | |
| 4393 | codec->num_pcms = 1; |
| 4394 | codec->pcm_info = info; |
| 4395 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4396 | if (spec->no_analog) |
| 4397 | goto skip_analog; |
| 4398 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4399 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4400 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4401 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4402 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4403 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4404 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4405 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4406 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4407 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4408 | } |
| 4409 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4410 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4411 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4412 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4413 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4414 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4415 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4416 | if (spec->channel_mode) { |
| 4417 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4418 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4419 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4420 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4421 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4422 | } |
| 4423 | } |
| 4424 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4425 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4426 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4427 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4428 | snprintf(spec->stream_name_digital, |
| 4429 | sizeof(spec->stream_name_digital), |
| 4430 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4431 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4432 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4433 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4434 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4435 | if (spec->dig_out_type) |
| 4436 | info->pcm_type = spec->dig_out_type; |
| 4437 | else |
| 4438 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4439 | if (spec->multiout.dig_out_nid && |
| 4440 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4441 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4442 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4443 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4444 | if (spec->dig_in_nid && |
| 4445 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4446 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4447 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4448 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4449 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4450 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4451 | } |
| 4452 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4453 | if (spec->no_analog) |
| 4454 | return 0; |
| 4455 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4456 | /* If the use of more than one ADC is requested for the current |
| 4457 | * model, configure a second analog capture-only PCM. |
| 4458 | */ |
| 4459 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4460 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4461 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4462 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4463 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4464 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4465 | if (spec->alt_dac_nid) { |
| 4466 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4467 | *spec->stream_analog_alt_playback; |
| 4468 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4469 | spec->alt_dac_nid; |
| 4470 | } else { |
| 4471 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4472 | alc_pcm_null_stream; |
| 4473 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4474 | } |
Raymond Yau | ce85c9a | 2011-05-03 13:33:53 +0800 | [diff] [blame] | 4475 | if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4476 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4477 | *spec->stream_analog_alt_capture; |
| 4478 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4479 | spec->adc_nids[1]; |
| 4480 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4481 | spec->num_adc_nids - 1; |
| 4482 | } else { |
| 4483 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4484 | alc_pcm_null_stream; |
| 4485 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4486 | } |
| 4487 | } |
| 4488 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4489 | return 0; |
| 4490 | } |
| 4491 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4492 | static inline void alc_shutup(struct hda_codec *codec) |
| 4493 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4494 | struct alc_spec *spec = codec->spec; |
| 4495 | |
| 4496 | if (spec && spec->shutup) |
| 4497 | spec->shutup(codec); |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4498 | snd_hda_shutup_pins(codec); |
| 4499 | } |
| 4500 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4501 | static void alc_free_kctls(struct hda_codec *codec) |
| 4502 | { |
| 4503 | struct alc_spec *spec = codec->spec; |
| 4504 | |
| 4505 | if (spec->kctls.list) { |
| 4506 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4507 | int i; |
| 4508 | for (i = 0; i < spec->kctls.used; i++) |
| 4509 | kfree(kctl[i].name); |
| 4510 | } |
| 4511 | snd_array_free(&spec->kctls); |
| 4512 | } |
| 4513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4514 | static void alc_free(struct hda_codec *codec) |
| 4515 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4516 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4517 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4518 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4519 | return; |
| 4520 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4521 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4522 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4523 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4524 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4525 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4526 | } |
| 4527 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4528 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4529 | static void alc_power_eapd(struct hda_codec *codec) |
| 4530 | { |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 4531 | alc_auto_setup_eapd(codec, false); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4532 | } |
| 4533 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4534 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4535 | { |
| 4536 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4537 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4538 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4539 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4540 | return 0; |
| 4541 | } |
| 4542 | #endif |
| 4543 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4544 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4545 | static int alc_resume(struct hda_codec *codec) |
| 4546 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4547 | msleep(150); /* to avoid pop noise */ |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4548 | codec->patch_ops.init(codec); |
| 4549 | snd_hda_codec_resume_amp(codec); |
| 4550 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4551 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4552 | return 0; |
| 4553 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4554 | #endif |
| 4555 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4556 | /* |
| 4557 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4558 | static const struct hda_codec_ops alc_patch_ops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4559 | .build_controls = alc_build_controls, |
| 4560 | .build_pcms = alc_build_pcms, |
| 4561 | .init = alc_init, |
| 4562 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4563 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4564 | #ifdef SND_HDA_NEEDS_RESUME |
| 4565 | .resume = alc_resume, |
| 4566 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4567 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4568 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4569 | .check_power_status = alc_check_power_status, |
| 4570 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4571 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4572 | }; |
| 4573 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4574 | /* replace the codec chip_name with the given string */ |
| 4575 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4576 | { |
| 4577 | kfree(codec->chip_name); |
| 4578 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4579 | if (!codec->chip_name) { |
| 4580 | alc_free(codec); |
| 4581 | return -ENOMEM; |
| 4582 | } |
| 4583 | return 0; |
| 4584 | } |
| 4585 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4586 | /* |
| 4587 | * Test configuration for debugging |
| 4588 | * |
| 4589 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4590 | * enum controls. |
| 4591 | */ |
| 4592 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4593 | static const hda_nid_t alc880_test_dac_nids[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4594 | 0x02, 0x03, 0x04, 0x05 |
| 4595 | }; |
| 4596 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4597 | static const struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4598 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4599 | .items = { |
| 4600 | { "In-1", 0x0 }, |
| 4601 | { "In-2", 0x1 }, |
| 4602 | { "In-3", 0x2 }, |
| 4603 | { "In-4", 0x3 }, |
| 4604 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4605 | { "Front", 0x5 }, |
| 4606 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4607 | }, |
| 4608 | }; |
| 4609 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4610 | static const struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4611 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4612 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4613 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4614 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4615 | }; |
| 4616 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4617 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4618 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4619 | { |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4620 | static const char * const texts[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4621 | "N/A", "Line Out", "HP Out", |
| 4622 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4623 | }; |
| 4624 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4625 | uinfo->count = 1; |
| 4626 | uinfo->value.enumerated.items = 8; |
| 4627 | if (uinfo->value.enumerated.item >= 8) |
| 4628 | uinfo->value.enumerated.item = 7; |
| 4629 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4630 | return 0; |
| 4631 | } |
| 4632 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4633 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4634 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4635 | { |
| 4636 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4637 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4638 | unsigned int pin_ctl, item = 0; |
| 4639 | |
| 4640 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4641 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4642 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4643 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4644 | item = 2; |
| 4645 | else |
| 4646 | item = 1; |
| 4647 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4648 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4649 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4650 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4651 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4652 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4653 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4654 | } |
| 4655 | } |
| 4656 | ucontrol->value.enumerated.item[0] = item; |
| 4657 | return 0; |
| 4658 | } |
| 4659 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4660 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4661 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4662 | { |
| 4663 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4664 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4665 | static const unsigned int ctls[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4666 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4667 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4668 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4669 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4670 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4671 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4672 | }; |
| 4673 | unsigned int old_ctl, new_ctl; |
| 4674 | |
| 4675 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4676 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4677 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4678 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4679 | int val; |
| 4680 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4681 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4682 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4683 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4684 | HDA_AMP_MUTE : 0; |
| 4685 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4686 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4687 | return 1; |
| 4688 | } |
| 4689 | return 0; |
| 4690 | } |
| 4691 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4692 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4693 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4694 | { |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4695 | static const char * const texts[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4696 | "Front", "Surround", "CLFE", "Side" |
| 4697 | }; |
| 4698 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4699 | uinfo->count = 1; |
| 4700 | uinfo->value.enumerated.items = 4; |
| 4701 | if (uinfo->value.enumerated.item >= 4) |
| 4702 | uinfo->value.enumerated.item = 3; |
| 4703 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4704 | return 0; |
| 4705 | } |
| 4706 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4707 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4708 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4709 | { |
| 4710 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4711 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4712 | unsigned int sel; |
| 4713 | |
| 4714 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4715 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4716 | return 0; |
| 4717 | } |
| 4718 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4719 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4720 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4721 | { |
| 4722 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4723 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4724 | unsigned int sel; |
| 4725 | |
| 4726 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4727 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4728 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4729 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4730 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4731 | return 1; |
| 4732 | } |
| 4733 | return 0; |
| 4734 | } |
| 4735 | |
| 4736 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4737 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4738 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4739 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4740 | .info = alc_test_pin_ctl_info, \ |
| 4741 | .get = alc_test_pin_ctl_get, \ |
| 4742 | .put = alc_test_pin_ctl_put, \ |
| 4743 | .private_value = nid \ |
| 4744 | } |
| 4745 | |
| 4746 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4748 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4749 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4750 | .info = alc_test_pin_src_info, \ |
| 4751 | .get = alc_test_pin_src_get, \ |
| 4752 | .put = alc_test_pin_src_put, \ |
| 4753 | .private_value = nid \ |
| 4754 | } |
| 4755 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4756 | static const struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4757 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4758 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4759 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4760 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4761 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4762 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4763 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4764 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4765 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4766 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4767 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4768 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4769 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4770 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4771 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4772 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4773 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4774 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4775 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4776 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4777 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4778 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4779 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4780 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4781 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4782 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4783 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4784 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4785 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4786 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4787 | { |
| 4788 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4789 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4790 | .info = alc_ch_mode_info, |
| 4791 | .get = alc_ch_mode_get, |
| 4792 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4793 | }, |
| 4794 | { } /* end */ |
| 4795 | }; |
| 4796 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4797 | static const struct hda_verb alc880_test_init_verbs[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4798 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4799 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4801 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4802 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4803 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4804 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4805 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4806 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4807 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4808 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4810 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4811 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4812 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4815 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4816 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4817 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4818 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4819 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4820 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4821 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4822 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4823 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4824 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4825 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4826 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4828 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4829 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4830 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4832 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4833 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4834 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4835 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4836 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4837 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4838 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4839 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4840 | /* Analog input/passthru */ |
| 4841 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4843 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4844 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4845 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4846 | { } |
| 4847 | }; |
| 4848 | #endif |
| 4849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4850 | /* |
| 4851 | */ |
| 4852 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4853 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4854 | [ALC880_3ST] = "3stack", |
| 4855 | [ALC880_TCL_S700] = "tcl", |
| 4856 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4857 | [ALC880_CLEVO] = "clevo", |
| 4858 | [ALC880_5ST] = "5stack", |
| 4859 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4860 | [ALC880_W810] = "w810", |
| 4861 | [ALC880_Z71V] = "z71v", |
| 4862 | [ALC880_6ST] = "6stack", |
| 4863 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4864 | [ALC880_ASUS] = "asus", |
| 4865 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4866 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4867 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4868 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4869 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4870 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4871 | [ALC880_F1734] = "F1734", |
| 4872 | [ALC880_LG] = "lg", |
| 4873 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4874 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4875 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4876 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4877 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4878 | [ALC880_AUTO] = "auto", |
| 4879 | }; |
| 4880 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4881 | static const struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4882 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4883 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4884 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4885 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4886 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4887 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4888 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4889 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4890 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4891 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4892 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4893 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4894 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4895 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4896 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4897 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4898 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4899 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4900 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4901 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4902 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4903 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4904 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4905 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4906 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4907 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4908 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4909 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4910 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4911 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4912 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4913 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4914 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4915 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4916 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4917 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4918 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4919 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4920 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Justin P. Mattock | a2e2bc2 | 2011-02-24 22:16:02 -0800 | [diff] [blame] | 4921 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4922 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4923 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4924 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4925 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4926 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4927 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4928 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4929 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4930 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4931 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4932 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4933 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4934 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4935 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4936 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4937 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4938 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4939 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4940 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4941 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4942 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4943 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4944 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4945 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4946 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4947 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4948 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4949 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4950 | /* default Intel */ |
| 4951 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4952 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4953 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4954 | {} |
| 4955 | }; |
| 4956 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4957 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4958 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4959 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4960 | static const struct alc_config_preset alc880_presets[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4961 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4962 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4963 | .init_verbs = { alc880_volume_init_verbs, |
| 4964 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4965 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4966 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4967 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4968 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4969 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4970 | .input_mux = &alc880_capture_source, |
| 4971 | }, |
| 4972 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4973 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4974 | .init_verbs = { alc880_volume_init_verbs, |
| 4975 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4976 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4977 | .dac_nids = alc880_dac_nids, |
| 4978 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4979 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4980 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4981 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4982 | .input_mux = &alc880_capture_source, |
| 4983 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4984 | [ALC880_TCL_S700] = { |
| 4985 | .mixers = { alc880_tcl_s700_mixer }, |
| 4986 | .init_verbs = { alc880_volume_init_verbs, |
| 4987 | alc880_pin_tcl_S700_init_verbs, |
| 4988 | alc880_gpio2_init_verbs }, |
| 4989 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4990 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4991 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4992 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4993 | .hp_nid = 0x03, |
| 4994 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4995 | .channel_mode = alc880_2_jack_modes, |
| 4996 | .input_mux = &alc880_capture_source, |
| 4997 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4998 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4999 | .mixers = { alc880_three_stack_mixer, |
| 5000 | alc880_five_stack_mixer}, |
| 5001 | .init_verbs = { alc880_volume_init_verbs, |
| 5002 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5003 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5004 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5005 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 5006 | .channel_mode = alc880_fivestack_modes, |
| 5007 | .input_mux = &alc880_capture_source, |
| 5008 | }, |
| 5009 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5010 | .mixers = { alc880_three_stack_mixer, |
| 5011 | alc880_five_stack_mixer }, |
| 5012 | .init_verbs = { alc880_volume_init_verbs, |
| 5013 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5014 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5015 | .dac_nids = alc880_dac_nids, |
| 5016 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5017 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 5018 | .channel_mode = alc880_fivestack_modes, |
| 5019 | .input_mux = &alc880_capture_source, |
| 5020 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 5021 | [ALC880_6ST] = { |
| 5022 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5023 | .init_verbs = { alc880_volume_init_verbs, |
| 5024 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 5025 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 5026 | .dac_nids = alc880_6st_dac_nids, |
| 5027 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 5028 | .channel_mode = alc880_sixstack_modes, |
| 5029 | .input_mux = &alc880_6stack_capture_source, |
| 5030 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5031 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5032 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5033 | .init_verbs = { alc880_volume_init_verbs, |
| 5034 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5035 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 5036 | .dac_nids = alc880_6st_dac_nids, |
| 5037 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5038 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 5039 | .channel_mode = alc880_sixstack_modes, |
| 5040 | .input_mux = &alc880_6stack_capture_source, |
| 5041 | }, |
| 5042 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5043 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5044 | .init_verbs = { alc880_volume_init_verbs, |
| 5045 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5046 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5047 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 5048 | .dac_nids = alc880_w810_dac_nids, |
| 5049 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5050 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 5051 | .channel_mode = alc880_w810_modes, |
| 5052 | .input_mux = &alc880_capture_source, |
| 5053 | }, |
| 5054 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5055 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5056 | .init_verbs = { alc880_volume_init_verbs, |
| 5057 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5058 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 5059 | .dac_nids = alc880_z71v_dac_nids, |
| 5060 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5061 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5062 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5063 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5064 | .input_mux = &alc880_capture_source, |
| 5065 | }, |
| 5066 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5067 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5068 | .init_verbs = { alc880_volume_init_verbs, |
| 5069 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5070 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 5071 | .dac_nids = alc880_f1734_dac_nids, |
| 5072 | .hp_nid = 0x02, |
| 5073 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5074 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 5075 | .input_mux = &alc880_f1734_capture_source, |
| 5076 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5077 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5078 | .init_hook = alc_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5079 | }, |
| 5080 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5081 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5082 | .init_verbs = { alc880_volume_init_verbs, |
| 5083 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5084 | alc880_gpio1_init_verbs }, |
| 5085 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5086 | .dac_nids = alc880_asus_dac_nids, |
| 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 | }, |
| 5092 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 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, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5096 | alc880_gpio1_init_verbs }, |
| 5097 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5098 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5099 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 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, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5103 | .input_mux = &alc880_capture_source, |
| 5104 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5105 | [ALC880_ASUS_DIG2] = { |
| 5106 | .mixers = { alc880_asus_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, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5109 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 5110 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5111 | .dac_nids = alc880_asus_dac_nids, |
| 5112 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 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, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5116 | .input_mux = &alc880_capture_source, |
| 5117 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5118 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5119 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +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 | alc880_gpio1_init_verbs }, |
| 5123 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5124 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5125 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5126 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5127 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5128 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5129 | .input_mux = &alc880_capture_source, |
| 5130 | }, |
| 5131 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5132 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5133 | .init_verbs = { alc880_volume_init_verbs, |
| 5134 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5135 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5136 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5137 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5138 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5139 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5140 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5141 | .input_mux = &alc880_capture_source, |
| 5142 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5143 | [ALC880_UNIWILL] = { |
| 5144 | .mixers = { alc880_uniwill_mixer }, |
| 5145 | .init_verbs = { alc880_volume_init_verbs, |
| 5146 | alc880_uniwill_init_verbs }, |
| 5147 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5148 | .dac_nids = alc880_asus_dac_nids, |
| 5149 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5150 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5151 | .channel_mode = alc880_threestack_modes, |
| 5152 | .need_dac_fix = 1, |
| 5153 | .input_mux = &alc880_capture_source, |
| 5154 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5155 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 5156 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5157 | }, |
| 5158 | [ALC880_UNIWILL_P53] = { |
| 5159 | .mixers = { alc880_uniwill_p53_mixer }, |
| 5160 | .init_verbs = { alc880_volume_init_verbs, |
| 5161 | alc880_uniwill_p53_init_verbs }, |
| 5162 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5163 | .dac_nids = alc880_asus_dac_nids, |
| 5164 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5165 | .channel_mode = alc880_threestack_modes, |
| 5166 | .input_mux = &alc880_capture_source, |
| 5167 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5168 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5169 | .init_hook = alc_hp_automute, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5170 | }, |
| 5171 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5172 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5173 | .init_verbs = { alc880_volume_init_verbs, |
| 5174 | alc880_uniwill_p53_init_verbs, |
| 5175 | alc880_beep_init_verbs }, |
| 5176 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5177 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 5178 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5179 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5180 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5181 | .input_mux = &alc880_capture_source, |
| 5182 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5183 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5184 | .init_hook = alc_hp_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5185 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5186 | [ALC880_CLEVO] = { |
| 5187 | .mixers = { alc880_three_stack_mixer }, |
| 5188 | .init_verbs = { alc880_volume_init_verbs, |
| 5189 | alc880_pin_clevo_init_verbs }, |
| 5190 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5191 | .dac_nids = alc880_dac_nids, |
| 5192 | .hp_nid = 0x03, |
| 5193 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5194 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5195 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5196 | .input_mux = &alc880_capture_source, |
| 5197 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5198 | [ALC880_LG] = { |
| 5199 | .mixers = { alc880_lg_mixer }, |
| 5200 | .init_verbs = { alc880_volume_init_verbs, |
| 5201 | alc880_lg_init_verbs }, |
| 5202 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 5203 | .dac_nids = alc880_lg_dac_nids, |
| 5204 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5205 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 5206 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5207 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5208 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5209 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5210 | .setup = alc880_lg_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5211 | .init_hook = alc_hp_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5212 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5213 | .loopbacks = alc880_lg_loopbacks, |
| 5214 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5215 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5216 | [ALC880_LG_LW] = { |
| 5217 | .mixers = { alc880_lg_lw_mixer }, |
| 5218 | .init_verbs = { alc880_volume_init_verbs, |
| 5219 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5220 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5221 | .dac_nids = alc880_dac_nids, |
| 5222 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5223 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5224 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5225 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5226 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5227 | .setup = alc880_lg_lw_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5228 | .init_hook = alc_hp_automute, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5229 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5230 | [ALC880_MEDION_RIM] = { |
| 5231 | .mixers = { alc880_medion_rim_mixer }, |
| 5232 | .init_verbs = { alc880_volume_init_verbs, |
| 5233 | alc880_medion_rim_init_verbs, |
| 5234 | alc_gpio2_init_verbs }, |
| 5235 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5236 | .dac_nids = alc880_dac_nids, |
| 5237 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5238 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5239 | .channel_mode = alc880_2_jack_modes, |
| 5240 | .input_mux = &alc880_medion_rim_capture_source, |
| 5241 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5242 | .setup = alc880_medion_rim_setup, |
| 5243 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5244 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5245 | #ifdef CONFIG_SND_DEBUG |
| 5246 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5247 | .mixers = { alc880_test_mixer }, |
| 5248 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5249 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5250 | .dac_nids = alc880_test_dac_nids, |
| 5251 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5252 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5253 | .channel_mode = alc880_test_modes, |
| 5254 | .input_mux = &alc880_test_capture_source, |
| 5255 | }, |
| 5256 | #endif |
| 5257 | }; |
| 5258 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5259 | /* |
| 5260 | * Automatic parse of I/O pins from the BIOS configuration |
| 5261 | */ |
| 5262 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5263 | enum { |
| 5264 | ALC_CTL_WIDGET_VOL, |
| 5265 | ALC_CTL_WIDGET_MUTE, |
| 5266 | ALC_CTL_BIND_MUTE, |
| 5267 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5268 | static const struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5269 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5270 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5271 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5272 | }; |
| 5273 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5274 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) |
| 5275 | { |
| 5276 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
| 5277 | return snd_array_new(&spec->kctls); |
| 5278 | } |
| 5279 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5280 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5281 | 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] | 5282 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5283 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5284 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5285 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5286 | knew = alc_kcontrol_new(spec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5287 | if (!knew) |
| 5288 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5289 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5290 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5291 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5292 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5293 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5294 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5295 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5296 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5297 | return 0; |
| 5298 | } |
| 5299 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5300 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5301 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5302 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5303 | { |
| 5304 | char name[32]; |
| 5305 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5306 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5307 | } |
| 5308 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5309 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5310 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5311 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5312 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5313 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5314 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5315 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5316 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5317 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5318 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5319 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5320 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5321 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5322 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5323 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5324 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5325 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5326 | #define ALC880_PIN_CD_NID 0x1c |
| 5327 | |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5328 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, |
| 5329 | bool can_be_master, int *index) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5330 | { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5331 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5332 | static const char * const chname[4] = { |
| 5333 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5334 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5335 | |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5336 | *index = 0; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5337 | if (cfg->line_outs == 1 && !spec->multi_ios && |
| 5338 | !cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5339 | return "Master"; |
| 5340 | |
| 5341 | switch (cfg->line_out_type) { |
| 5342 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5343 | if (cfg->line_outs == 1) |
| 5344 | return "Speaker"; |
| 5345 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5346 | case AUTO_PIN_HP_OUT: |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5347 | /* for multi-io case, only the primary out */ |
| 5348 | if (ch && spec->multi_ios) |
| 5349 | break; |
| 5350 | *index = ch; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5351 | return "Headphone"; |
| 5352 | default: |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5353 | if (cfg->line_outs == 1 && !spec->multi_ios) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5354 | return "PCM"; |
| 5355 | break; |
| 5356 | } |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5357 | return chname[ch]; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5358 | } |
| 5359 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5360 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5361 | 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] | 5362 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5363 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5364 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5365 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5366 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5367 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5368 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5369 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5370 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5371 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5372 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5373 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5374 | return err; |
| 5375 | return 0; |
| 5376 | } |
| 5377 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5378 | 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] | 5379 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5380 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5381 | return (pincap & AC_PINCAP_IN) != 0; |
| 5382 | } |
| 5383 | |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 5384 | static int alc_auto_fill_adc_caps(struct hda_codec *codec, hda_nid_t *adc_nids, |
| 5385 | hda_nid_t *cap_nids, int max_nums) |
| 5386 | { |
| 5387 | hda_nid_t nid; |
| 5388 | int i, nums = 0; |
| 5389 | |
| 5390 | nid = codec->start_nid; |
| 5391 | for (i = 0; i < codec->num_nodes; i++, nid++) { |
| 5392 | hda_nid_t src; |
| 5393 | const hda_nid_t *list; |
| 5394 | unsigned int caps = get_wcaps(codec, nid); |
| 5395 | int type = get_wcaps_type(caps); |
| 5396 | |
| 5397 | if (type != AC_WID_AUD_IN || (caps & AC_WCAP_DIGITAL)) |
| 5398 | continue; |
| 5399 | adc_nids[nums] = nid; |
| 5400 | cap_nids[nums] = nid; |
| 5401 | src = nid; |
| 5402 | for (;;) { |
| 5403 | int n; |
| 5404 | type = get_wcaps_type(get_wcaps(codec, src)); |
| 5405 | if (type == AC_WID_PIN) |
| 5406 | break; |
| 5407 | if (type == AC_WID_AUD_SEL) { |
| 5408 | cap_nids[nums] = src; |
| 5409 | break; |
| 5410 | } |
| 5411 | n = snd_hda_get_conn_list(codec, src, &list); |
| 5412 | if (n > 1) { |
| 5413 | cap_nids[nums] = src; |
| 5414 | break; |
| 5415 | } else if (n != 1) |
| 5416 | break; |
| 5417 | src = *list; |
| 5418 | } |
| 5419 | if (++nums >= max_nums) |
| 5420 | break; |
| 5421 | } |
| 5422 | return nums; |
| 5423 | } |
| 5424 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5425 | /* create playback/capture controls for input pins */ |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 5426 | static int alc_auto_create_input_ctls(struct hda_codec *codec) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5427 | { |
| 5428 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 5429 | const struct auto_pin_cfg *cfg = &spec->autocfg; |
| 5430 | hda_nid_t mixer = spec->mixer_nid; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5431 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 5432 | int num_adcs; |
| 5433 | hda_nid_t caps[5], adcs[5]; |
| 5434 | int i, c, err, idx, type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5435 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5436 | |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 5437 | num_adcs = alc_auto_fill_adc_caps(codec, adcs, caps, ARRAY_SIZE(adcs)); |
| 5438 | if (num_adcs < 0) |
| 5439 | return 0; |
| 5440 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5441 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5442 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5443 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5444 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5445 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5446 | if (!alc_is_input_pin(codec, pin)) |
| 5447 | continue; |
| 5448 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5449 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5450 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5451 | type_idx++; |
| 5452 | else |
| 5453 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5454 | prev_label = label; |
| 5455 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5456 | if (mixer) { |
| 5457 | idx = get_connection_index(codec, mixer, pin); |
| 5458 | if (idx >= 0) { |
| 5459 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5460 | label, type_idx, |
| 5461 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5462 | if (err < 0) |
| 5463 | return err; |
| 5464 | } |
| 5465 | } |
| 5466 | |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 5467 | for (c = 0; c < num_adcs; c++) { |
| 5468 | idx = get_connection_index(codec, caps[c], pin); |
| 5469 | if (idx >= 0) { |
| 5470 | snd_hda_add_imux_item(imux, label, idx, NULL); |
| 5471 | break; |
| 5472 | } |
| 5473 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5474 | } |
| 5475 | return 0; |
| 5476 | } |
| 5477 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 5478 | static int alc_auto_fill_dac_nids(struct hda_codec *codec); |
| 5479 | static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 5480 | const struct auto_pin_cfg *cfg); |
| 5481 | static int alc_auto_create_hp_out(struct hda_codec *codec); |
| 5482 | static int alc_auto_create_speaker_out(struct hda_codec *codec); |
| 5483 | static void alc_auto_init_multi_out(struct hda_codec *codec); |
| 5484 | static void alc_auto_init_extra_out(struct hda_codec *codec); |
| 5485 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5486 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5487 | unsigned int pin_type) |
| 5488 | { |
| 5489 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5490 | pin_type); |
| 5491 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5492 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5493 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5494 | } |
| 5495 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5496 | static int get_pin_type(int line_out_type) |
| 5497 | { |
| 5498 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5499 | return PIN_HP; |
| 5500 | else |
| 5501 | return PIN_OUT; |
| 5502 | } |
| 5503 | |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 5504 | static void alc_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5505 | { |
| 5506 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5507 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5508 | int i; |
| 5509 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5510 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5511 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5512 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5513 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5514 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5515 | snd_hda_codec_write(codec, nid, 0, |
| 5516 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5517 | AMP_OUT_MUTE); |
| 5518 | } |
| 5519 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5520 | |
| 5521 | /* mute all loopback inputs */ |
| 5522 | if (spec->mixer_nid) { |
| 5523 | int nums = snd_hda_get_conn_list(codec, spec->mixer_nid, NULL); |
| 5524 | for (i = 0; i < nums; i++) |
| 5525 | snd_hda_codec_write(codec, spec->mixer_nid, 0, |
| 5526 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 5527 | AMP_IN_MUTE(i)); |
| 5528 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5529 | } |
| 5530 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5531 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5532 | { |
| 5533 | struct alc_spec *spec = codec->spec; |
| 5534 | int c; |
| 5535 | |
| 5536 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5537 | unsigned int mux_idx; |
| 5538 | const struct hda_input_mux *imux; |
| 5539 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5540 | imux = &spec->input_mux[mux_idx]; |
| 5541 | if (!imux->num_items && mux_idx > 0) |
| 5542 | imux = &spec->input_mux[0]; |
| 5543 | if (imux) |
| 5544 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5545 | AC_VERB_SET_CONNECT_SEL, |
| 5546 | imux->items[0].index); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5547 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5548 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 5549 | AMP_IN_MUTE(0)); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5550 | } |
| 5551 | } |
| 5552 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 5553 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec, |
| 5554 | int (*fill_dac)(struct hda_codec *)); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5555 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5556 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5557 | /* return 1 if successful, 0 if the proper config is not found, |
| 5558 | * or a negative error code |
| 5559 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5560 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5561 | { |
| 5562 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5563 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5564 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5565 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5566 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5567 | alc880_ignore); |
| 5568 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5569 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5570 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5571 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5572 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 5573 | err = alc_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5574 | if (err < 0) |
| 5575 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 5576 | err = alc_auto_add_multi_channel_mode(codec, alc_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5577 | if (err < 0) |
| 5578 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 5579 | err = alc_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5580 | if (err < 0) |
| 5581 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 5582 | err = alc_auto_create_hp_out(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5583 | if (err < 0) |
| 5584 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 5585 | err = alc_auto_create_speaker_out(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5586 | if (err < 0) |
| 5587 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 5588 | err = alc_auto_create_input_ctls(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5589 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5590 | return err; |
| 5591 | |
| 5592 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5593 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5594 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5595 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5596 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5597 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5598 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5599 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5600 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5601 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5602 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5603 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5604 | return 1; |
| 5605 | } |
| 5606 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5607 | /* additional initialization for auto-configuration model */ |
| 5608 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5609 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5610 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 5611 | alc_auto_init_multi_out(codec); |
| 5612 | alc_auto_init_extra_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 5613 | alc_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5614 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5615 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5616 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5617 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5618 | } |
| 5619 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5620 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5621 | * one of two digital mic pins, e.g. on ALC272 |
| 5622 | */ |
| 5623 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5624 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5625 | struct alc_spec *spec = codec->spec; |
| 5626 | int i; |
| 5627 | |
| 5628 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5629 | hda_nid_t cap = spec->capsrc_nids ? |
| 5630 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5631 | int iidx, eidx; |
| 5632 | |
| 5633 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5634 | if (iidx < 0) |
| 5635 | continue; |
| 5636 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5637 | if (eidx < 0) |
| 5638 | continue; |
| 5639 | spec->int_mic.mux_idx = iidx; |
| 5640 | spec->ext_mic.mux_idx = eidx; |
| 5641 | if (spec->capsrc_nids) |
| 5642 | spec->capsrc_nids += i; |
| 5643 | spec->adc_nids += i; |
| 5644 | spec->num_adc_nids = 1; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5645 | /* optional dock-mic */ |
| 5646 | eidx = get_connection_index(codec, cap, spec->dock_mic.pin); |
| 5647 | if (eidx < 0) |
| 5648 | spec->dock_mic.pin = 0; |
| 5649 | else |
| 5650 | spec->dock_mic.mux_idx = eidx; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5651 | return; |
| 5652 | } |
| 5653 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5654 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5655 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5656 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5657 | } |
| 5658 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5659 | /* select or unmute the given capsrc route */ |
| 5660 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5661 | int idx) |
| 5662 | { |
| 5663 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5664 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5665 | HDA_AMP_MUTE, 0); |
| 5666 | } else { |
| 5667 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5668 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5669 | } |
| 5670 | } |
| 5671 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5672 | /* set the default connection to that pin */ |
| 5673 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5674 | { |
| 5675 | struct alc_spec *spec = codec->spec; |
| 5676 | int i; |
| 5677 | |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5678 | if (!pin) |
| 5679 | return 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5680 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5681 | hda_nid_t cap = spec->capsrc_nids ? |
| 5682 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5683 | int idx; |
| 5684 | |
| 5685 | idx = get_connection_index(codec, cap, pin); |
| 5686 | if (idx < 0) |
| 5687 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5688 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5689 | return i; /* return the found index */ |
| 5690 | } |
| 5691 | return -1; /* not found */ |
| 5692 | } |
| 5693 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5694 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5695 | static void fixup_single_adc(struct hda_codec *codec) |
| 5696 | { |
| 5697 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5698 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5699 | int i; |
| 5700 | |
| 5701 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5702 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5703 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5704 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5705 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5706 | /* use only this ADC */ |
| 5707 | if (spec->capsrc_nids) |
| 5708 | spec->capsrc_nids += i; |
| 5709 | spec->adc_nids += i; |
| 5710 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5711 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5712 | } |
| 5713 | } |
| 5714 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5715 | /* initialize dual adcs */ |
| 5716 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5717 | { |
| 5718 | struct alc_spec *spec = codec->spec; |
| 5719 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5720 | init_capsrc_for_pin(codec, spec->dock_mic.pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5721 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5722 | } |
| 5723 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5724 | /* initialize some special cases for input sources */ |
| 5725 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5726 | { |
| 5727 | struct alc_spec *spec = codec->spec; |
| 5728 | if (spec->dual_adc_switch) |
| 5729 | fixup_dual_adc_switch(codec); |
| 5730 | else if (spec->single_input_src) |
| 5731 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5732 | } |
| 5733 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5734 | static void set_capture_mixer(struct hda_codec *codec) |
| 5735 | { |
| 5736 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5737 | static const struct snd_kcontrol_new *caps[2][3] = { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5738 | { alc_capture_mixer_nosrc1, |
| 5739 | alc_capture_mixer_nosrc2, |
| 5740 | alc_capture_mixer_nosrc3 }, |
| 5741 | { alc_capture_mixer1, |
| 5742 | alc_capture_mixer2, |
| 5743 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5744 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5745 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5746 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5747 | int num_adcs = spec->num_adc_nids; |
| 5748 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5749 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5750 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5751 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5752 | else if (spec->input_mux) { |
| 5753 | if (spec->input_mux->num_items > 1) |
| 5754 | mux = 1; |
| 5755 | else if (spec->input_mux->num_items == 1) |
| 5756 | fixup_single_adc(codec); |
| 5757 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5758 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5759 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5760 | } |
| 5761 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5762 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5763 | 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] | 5764 | int num_nids) |
| 5765 | { |
| 5766 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5767 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5768 | int n; |
| 5769 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5770 | |
| 5771 | for (n = 0; n < num_nids; n++) { |
| 5772 | hda_nid_t adc, cap; |
| 5773 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5774 | int nconns, i, j; |
| 5775 | |
| 5776 | adc = nids[n]; |
| 5777 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5778 | continue; |
| 5779 | cap = adc; |
| 5780 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5781 | ARRAY_SIZE(conn)); |
| 5782 | if (nconns == 1) { |
| 5783 | cap = conn[0]; |
| 5784 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5785 | ARRAY_SIZE(conn)); |
| 5786 | } |
| 5787 | if (nconns <= 0) |
| 5788 | continue; |
| 5789 | if (!fallback_adc) { |
| 5790 | fallback_adc = adc; |
| 5791 | fallback_cap = cap; |
| 5792 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5793 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5794 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5795 | for (j = 0; j < nconns; j++) { |
| 5796 | if (conn[j] == nid) |
| 5797 | break; |
| 5798 | } |
| 5799 | if (j >= nconns) |
| 5800 | break; |
| 5801 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5802 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5803 | int num_adcs = spec->num_adc_nids; |
| 5804 | spec->private_adc_nids[num_adcs] = adc; |
| 5805 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5806 | spec->num_adc_nids++; |
| 5807 | spec->adc_nids = spec->private_adc_nids; |
| 5808 | if (adc != cap) |
| 5809 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5810 | } |
| 5811 | } |
| 5812 | if (!spec->num_adc_nids) { |
| 5813 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5814 | " using fallback 0x%x\n", |
| 5815 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5816 | spec->private_adc_nids[0] = fallback_adc; |
| 5817 | spec->adc_nids = spec->private_adc_nids; |
| 5818 | if (fallback_adc != fallback_cap) { |
| 5819 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5820 | spec->capsrc_nids = spec->private_adc_nids; |
| 5821 | } |
| 5822 | } |
| 5823 | } |
| 5824 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5825 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5826 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5827 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5828 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5829 | static const struct snd_pci_quirk beep_white_list[] = { |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5830 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5831 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Daniel Cordero | a7e985e | 2011-04-29 08:18:06 +0200 | [diff] [blame] | 5832 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), |
Madis Janson | 39dfe13 | 2011-05-19 18:32:41 +0200 | [diff] [blame] | 5833 | SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5834 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5835 | {} |
| 5836 | }; |
| 5837 | |
| 5838 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5839 | { |
| 5840 | struct alc_spec *spec = codec->spec; |
| 5841 | const struct snd_pci_quirk *q; |
| 5842 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5843 | if (q) |
| 5844 | return q->value; |
| 5845 | return spec->cdefine.enable_pcbeep; |
| 5846 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5847 | #else |
| 5848 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5849 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5850 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5851 | |
| 5852 | /* |
| 5853 | * OK, here we have finally the patch for ALC880 |
| 5854 | */ |
| 5855 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5856 | static int patch_alc880(struct hda_codec *codec) |
| 5857 | { |
| 5858 | struct alc_spec *spec; |
| 5859 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5860 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5861 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5862 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5863 | if (spec == NULL) |
| 5864 | return -ENOMEM; |
| 5865 | |
| 5866 | codec->spec = spec; |
| 5867 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5868 | spec->mixer_nid = 0x0b; |
| 5869 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5870 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5871 | alc880_models, |
| 5872 | alc880_cfg_tbl); |
| 5873 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5874 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5875 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5876 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5877 | } |
| 5878 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5879 | if (board_config == ALC880_AUTO) { |
| 5880 | /* automatic parse from the BIOS config */ |
| 5881 | err = alc880_parse_auto_config(codec); |
| 5882 | if (err < 0) { |
| 5883 | alc_free(codec); |
| 5884 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5885 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5886 | printk(KERN_INFO |
| 5887 | "hda_codec: Cannot set up configuration " |
| 5888 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5889 | board_config = ALC880_3ST; |
| 5890 | } |
| 5891 | } |
| 5892 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5893 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5894 | if (err < 0) { |
| 5895 | alc_free(codec); |
| 5896 | return err; |
| 5897 | } |
| 5898 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5899 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5900 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5901 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5902 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5903 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5904 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5905 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5906 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5907 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5908 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5909 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5910 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5911 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5912 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5913 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5914 | if (wcap != AC_WID_AUD_IN) { |
| 5915 | spec->adc_nids = alc880_adc_nids_alt; |
| 5916 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5917 | } else { |
| 5918 | spec->adc_nids = alc880_adc_nids; |
| 5919 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5920 | } |
| 5921 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5922 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5923 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5924 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5925 | spec->vmaster_nid = 0x0c; |
| 5926 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5927 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5928 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5929 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5930 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5931 | if (!spec->loopback.amplist) |
| 5932 | spec->loopback.amplist = alc880_loopbacks; |
| 5933 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5934 | |
| 5935 | return 0; |
| 5936 | } |
| 5937 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5938 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5939 | /* |
| 5940 | * ALC260 support |
| 5941 | */ |
| 5942 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5943 | static const hda_nid_t alc260_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5944 | /* front */ |
| 5945 | 0x02, |
| 5946 | }; |
| 5947 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5948 | static const hda_nid_t alc260_adc_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5949 | /* ADC0 */ |
| 5950 | 0x04, |
| 5951 | }; |
| 5952 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5953 | static const hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5954 | /* ADC1 */ |
| 5955 | 0x05, |
| 5956 | }; |
| 5957 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5958 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5959 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5960 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5961 | static const hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5962 | /* ADC0, ADC1 */ |
| 5963 | 0x04, 0x05 |
| 5964 | }; |
| 5965 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5966 | #define ALC260_DIGOUT_NID 0x03 |
| 5967 | #define ALC260_DIGIN_NID 0x06 |
| 5968 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5969 | static const struct hda_input_mux alc260_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5970 | .num_items = 4, |
| 5971 | .items = { |
| 5972 | { "Mic", 0x0 }, |
| 5973 | { "Front Mic", 0x1 }, |
| 5974 | { "Line", 0x2 }, |
| 5975 | { "CD", 0x4 }, |
| 5976 | }, |
| 5977 | }; |
| 5978 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5979 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5980 | * headphone jack and the internal CD lines since these are the only pins at |
| 5981 | * which audio can appear. For flexibility, also allow the option of |
| 5982 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5983 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5984 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5985 | static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5986 | { |
| 5987 | .num_items = 3, |
| 5988 | .items = { |
| 5989 | { "Mic/Line", 0x0 }, |
| 5990 | { "CD", 0x4 }, |
| 5991 | { "Headphone", 0x2 }, |
| 5992 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5993 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5994 | { |
| 5995 | .num_items = 4, |
| 5996 | .items = { |
| 5997 | { "Mic/Line", 0x0 }, |
| 5998 | { "CD", 0x4 }, |
| 5999 | { "Headphone", 0x2 }, |
| 6000 | { "Mixer", 0x5 }, |
| 6001 | }, |
| 6002 | }, |
| 6003 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6004 | }; |
| 6005 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6006 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 6007 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6008 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6009 | static const struct hda_input_mux alc260_acer_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6010 | { |
| 6011 | .num_items = 4, |
| 6012 | .items = { |
| 6013 | { "Mic", 0x0 }, |
| 6014 | { "Line", 0x2 }, |
| 6015 | { "CD", 0x4 }, |
| 6016 | { "Headphone", 0x5 }, |
| 6017 | }, |
| 6018 | }, |
| 6019 | { |
| 6020 | .num_items = 5, |
| 6021 | .items = { |
| 6022 | { "Mic", 0x0 }, |
| 6023 | { "Line", 0x2 }, |
| 6024 | { "CD", 0x4 }, |
| 6025 | { "Headphone", 0x6 }, |
| 6026 | { "Mixer", 0x5 }, |
| 6027 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6028 | }, |
| 6029 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6030 | |
| 6031 | /* Maxdata Favorit 100XS */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6032 | static const struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6033 | { |
| 6034 | .num_items = 2, |
| 6035 | .items = { |
| 6036 | { "Line/Mic", 0x0 }, |
| 6037 | { "CD", 0x4 }, |
| 6038 | }, |
| 6039 | }, |
| 6040 | { |
| 6041 | .num_items = 3, |
| 6042 | .items = { |
| 6043 | { "Line/Mic", 0x0 }, |
| 6044 | { "CD", 0x4 }, |
| 6045 | { "Mixer", 0x5 }, |
| 6046 | }, |
| 6047 | }, |
| 6048 | }; |
| 6049 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6050 | /* |
| 6051 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 6052 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 6053 | * element which allows changing the channel mode, so the verb list is |
| 6054 | * never used. |
| 6055 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6056 | static const struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6057 | { 2, NULL }, |
| 6058 | }; |
| 6059 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6060 | |
| 6061 | /* Mixer combinations |
| 6062 | * |
| 6063 | * basic: base_output + input + pc_beep + capture |
| 6064 | * HP: base_output + input + capture_alt |
| 6065 | * HP_3013: hp_3013 + input + capture |
| 6066 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6067 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6068 | */ |
| 6069 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6070 | static const struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6072 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6073 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6074 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6075 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6076 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6077 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6078 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6079 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6080 | static const struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6081 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6082 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6083 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6084 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6085 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6086 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6087 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6088 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6089 | { } /* end */ |
| 6090 | }; |
| 6091 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6092 | /* update HP, line and mono out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6093 | static void alc260_hp_master_update(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6094 | { |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6095 | update_speakers(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6096 | } |
| 6097 | |
| 6098 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 6099 | struct snd_ctl_elem_value *ucontrol) |
| 6100 | { |
| 6101 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6102 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6103 | *ucontrol->value.integer.value = !spec->master_mute; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6104 | return 0; |
| 6105 | } |
| 6106 | |
| 6107 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6108 | struct snd_ctl_elem_value *ucontrol) |
| 6109 | { |
| 6110 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6111 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6112 | int val = !*ucontrol->value.integer.value; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6113 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6114 | if (val == spec->master_mute) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6115 | return 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6116 | spec->master_mute = val; |
| 6117 | alc260_hp_master_update(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6118 | return 1; |
| 6119 | } |
| 6120 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6121 | static const struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6122 | { |
| 6123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6124 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6125 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6126 | .info = snd_ctl_boolean_mono_info, |
| 6127 | .get = alc260_hp_master_sw_get, |
| 6128 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6129 | }, |
| 6130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6131 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6133 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6134 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6135 | HDA_OUTPUT), |
| 6136 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6137 | { } /* end */ |
| 6138 | }; |
| 6139 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6140 | static const struct hda_verb alc260_hp_unsol_verbs[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6141 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6142 | {}, |
| 6143 | }; |
| 6144 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6145 | static void alc260_hp_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6146 | { |
| 6147 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6148 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6149 | spec->autocfg.hp_pins[0] = 0x0f; |
| 6150 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6151 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6152 | spec->automute = 1; |
| 6153 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6154 | } |
| 6155 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6156 | static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6157 | { |
| 6158 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6159 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6160 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6161 | .info = snd_ctl_boolean_mono_info, |
| 6162 | .get = alc260_hp_master_sw_get, |
| 6163 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6164 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6166 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6167 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6168 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6169 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6170 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6171 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6172 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6173 | { } /* end */ |
| 6174 | }; |
| 6175 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6176 | static void alc260_hp_3013_setup(struct hda_codec *codec) |
| 6177 | { |
| 6178 | struct alc_spec *spec = codec->spec; |
| 6179 | |
| 6180 | spec->autocfg.hp_pins[0] = 0x15; |
| 6181 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6182 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6183 | spec->automute = 1; |
| 6184 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 6185 | } |
| 6186 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6187 | static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6188 | .ops = &snd_hda_bind_vol, |
| 6189 | .values = { |
| 6190 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6191 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6192 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6193 | 0 |
| 6194 | }, |
| 6195 | }; |
| 6196 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6197 | static const struct hda_bind_ctls alc260_dc7600_bind_switch = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6198 | .ops = &snd_hda_bind_sw, |
| 6199 | .values = { |
| 6200 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6201 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6202 | 0 |
| 6203 | }, |
| 6204 | }; |
| 6205 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6206 | static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6207 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6208 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6209 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6210 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6211 | { } /* end */ |
| 6212 | }; |
| 6213 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6214 | static const struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6215 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6216 | {}, |
| 6217 | }; |
| 6218 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6219 | static void alc260_hp_3012_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6220 | { |
| 6221 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6222 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6223 | spec->autocfg.hp_pins[0] = 0x10; |
| 6224 | spec->autocfg.speaker_pins[0] = 0x0f; |
| 6225 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6226 | spec->autocfg.speaker_pins[2] = 0x15; |
| 6227 | spec->automute = 1; |
| 6228 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6229 | } |
| 6230 | |
| 6231 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6232 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6233 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6234 | static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6235 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6236 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6237 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6239 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6240 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6241 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6242 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6243 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6244 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6245 | { } /* end */ |
| 6246 | }; |
| 6247 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6248 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6249 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6250 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6251 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6252 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6253 | * revisions available in early 2006. Therefore for now allow the |
| 6254 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6255 | * that the lack of mic bias for this NID is intentional we could change the |
| 6256 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6257 | * |
| 6258 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6259 | * don't appear to make the mic bias available from the "line" jack, even |
| 6260 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6261 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6262 | * and the output jack. If this turns out to be the case for all such |
| 6263 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6264 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6265 | * |
| 6266 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6267 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6268 | * controls for such models. On models without a "mono speaker" the control |
| 6269 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6270 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6271 | static const struct snd_kcontrol_new alc260_acer_mixer[] = { |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6272 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6273 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6274 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6275 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6276 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6277 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6278 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6279 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6280 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6281 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6282 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6283 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6284 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6285 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6286 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6287 | { } /* end */ |
| 6288 | }; |
| 6289 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6290 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6291 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6292 | static const struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6293 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6294 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6295 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6296 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6297 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6298 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6299 | { } /* end */ |
| 6300 | }; |
| 6301 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6302 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6303 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6304 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6305 | static const struct snd_kcontrol_new alc260_will_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6306 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6307 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6308 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6309 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6310 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6311 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6312 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6313 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6314 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6315 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6316 | { } /* end */ |
| 6317 | }; |
| 6318 | |
| 6319 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6320 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6321 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6322 | static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6323 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6324 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6325 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6326 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6327 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6328 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6329 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6330 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6331 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6332 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6333 | { } /* end */ |
| 6334 | }; |
| 6335 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6336 | /* |
| 6337 | * initialization verbs |
| 6338 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6339 | static const struct hda_verb alc260_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6340 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6341 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6342 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6343 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6344 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6345 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6346 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6347 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6348 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6349 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6350 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6351 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6352 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6353 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6354 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6355 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6356 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6357 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6358 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6359 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6360 | /* set connection select to line in (default select for this ADC) */ |
| 6361 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6362 | /* mute capture amp left and right */ |
| 6363 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6364 | /* set connection select to line in (default select for this ADC) */ |
| 6365 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6366 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6367 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6368 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6369 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6370 | /* set vol=0 HP mixer amp left and right */ |
| 6371 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6372 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6373 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6374 | /* set vol=0 Mono mixer amp left and right */ |
| 6375 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6376 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6377 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6378 | /* unmute LINE-2 out pin */ |
| 6379 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6380 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6381 | * Line In 2 = 0x03 |
| 6382 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6383 | /* mute analog inputs */ |
| 6384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6387 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6388 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6389 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6390 | /* mute Front out path */ |
| 6391 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6392 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6393 | /* mute Headphone out path */ |
| 6394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6395 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6396 | /* mute Mono out path */ |
| 6397 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6398 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6399 | { } |
| 6400 | }; |
| 6401 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6402 | #if 0 /* should be identical with alc260_init_verbs? */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6403 | static const struct hda_verb alc260_hp_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6404 | /* Headphone and output */ |
| 6405 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6406 | /* mono output */ |
| 6407 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6408 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6409 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6410 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6411 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6412 | /* Line In pin widget for input */ |
| 6413 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6414 | /* Line-2 pin widget for output */ |
| 6415 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6416 | /* CD pin widget for input */ |
| 6417 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6418 | /* unmute amp left and right */ |
| 6419 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6420 | /* set connection select to line in (default select for this ADC) */ |
| 6421 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6422 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6423 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6424 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6425 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6426 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6427 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6428 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6429 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6430 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6431 | * Line In 2 = 0x03 |
| 6432 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6433 | /* mute analog inputs */ |
| 6434 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6435 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6437 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6438 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6439 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6440 | /* Unmute Front out path */ |
| 6441 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6442 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6443 | /* Unmute Headphone out path */ |
| 6444 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6445 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6446 | /* Unmute Mono out path */ |
| 6447 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6448 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6449 | { } |
| 6450 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6451 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6452 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6453 | static const struct hda_verb alc260_hp_3013_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6454 | /* Line out and output */ |
| 6455 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6456 | /* mono output */ |
| 6457 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6458 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6459 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6460 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6461 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6462 | /* Line In pin widget for input */ |
| 6463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6464 | /* Headphone pin widget for output */ |
| 6465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6466 | /* CD pin widget for input */ |
| 6467 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6468 | /* unmute amp left and right */ |
| 6469 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6470 | /* set connection select to line in (default select for this ADC) */ |
| 6471 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6472 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6473 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6474 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6475 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6476 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6477 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6478 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6479 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6480 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6481 | * Line In 2 = 0x03 |
| 6482 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6483 | /* mute analog inputs */ |
| 6484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6489 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6490 | /* Unmute Front out path */ |
| 6491 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6493 | /* Unmute Headphone out path */ |
| 6494 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6495 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6496 | /* Unmute Mono out path */ |
| 6497 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6498 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6499 | { } |
| 6500 | }; |
| 6501 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6502 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6503 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6504 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6505 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6506 | static const struct hda_verb alc260_fujitsu_init_verbs[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6507 | /* Disable all GPIOs */ |
| 6508 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6509 | /* Internal speaker is connected to headphone pin */ |
| 6510 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6511 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6512 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6513 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6514 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6515 | /* Ensure all other unused pins are disabled and muted. */ |
| 6516 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6517 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6518 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6519 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6520 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6521 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6522 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6523 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6524 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6525 | /* Disable digital (SPDIF) pins */ |
| 6526 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6527 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6528 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6529 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6530 | * when acting as an output. |
| 6531 | */ |
| 6532 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6533 | |
| 6534 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6535 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6536 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6537 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6538 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6539 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6540 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6541 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6542 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6543 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6544 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6545 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6546 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6547 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6548 | * If the pin mode is changed by the user the pin mode control will |
| 6549 | * take care of enabling the pin's input/output buffers as needed. |
| 6550 | * Therefore there's no need to enable the input buffer at this |
| 6551 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6552 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6553 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6554 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6555 | * mixer ctrl) |
| 6556 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6557 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6558 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6559 | /* Mute capture amp left and right */ |
| 6560 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6561 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6562 | * in (on mic1 pin) |
| 6563 | */ |
| 6564 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6565 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6566 | /* Do the same for the second ADC: mute capture input amp and |
| 6567 | * set ADC connection to line in (on mic1 pin) |
| 6568 | */ |
| 6569 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6570 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6571 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6572 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6577 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6578 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6579 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6580 | {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] | 6581 | |
| 6582 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6583 | }; |
| 6584 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6585 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6586 | * similar laptops (adapted from Fujitsu init verbs). |
| 6587 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6588 | static const struct hda_verb alc260_acer_init_verbs[] = { |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6589 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6590 | * the headphone jack. Turn this on and rely on the standard mute |
| 6591 | * methods whenever the user wants to turn these outputs off. |
| 6592 | */ |
| 6593 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6594 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6595 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6596 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6597 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6598 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6599 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6600 | /* Line In jack is connected to Line1 pin */ |
| 6601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6602 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6603 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6604 | /* Ensure all other unused pins are disabled and muted. */ |
| 6605 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6606 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6607 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6608 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6609 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6610 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6611 | /* Disable digital (SPDIF) pins */ |
| 6612 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6613 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6614 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6615 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6616 | * bus when acting as outputs. |
| 6617 | */ |
| 6618 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6619 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6620 | |
| 6621 | /* Start with output sum widgets muted and their output gains at min */ |
| 6622 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6623 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6624 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6625 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6626 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6627 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6628 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6629 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6630 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6631 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6632 | /* Unmute Line-out pin widget amp left and right |
| 6633 | * (no equiv mixer ctrl) |
| 6634 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6635 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6636 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6637 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6638 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6639 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6640 | * will take care of enabling the pin's input/output buffers as needed. |
| 6641 | * Therefore there's no need to enable the input buffer at this |
| 6642 | * stage. |
| 6643 | */ |
| 6644 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6645 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6646 | |
| 6647 | /* Mute capture amp left and right */ |
| 6648 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6649 | /* Set ADC connection select to match default mixer setting - mic |
| 6650 | * (on mic1 pin) |
| 6651 | */ |
| 6652 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6653 | |
| 6654 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6655 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6656 | */ |
| 6657 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6658 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6659 | |
| 6660 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6661 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6662 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6663 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6664 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6665 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6666 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6667 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6668 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6669 | |
| 6670 | { } |
| 6671 | }; |
| 6672 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6673 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6674 | * (adapted from Acer init verbs). |
| 6675 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6676 | static const struct hda_verb alc260_favorit100_init_verbs[] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6677 | /* GPIO 0 enables the output jack. |
| 6678 | * Turn this on and rely on the standard mute |
| 6679 | * methods whenever the user wants to turn these outputs off. |
| 6680 | */ |
| 6681 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6682 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6683 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6684 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6685 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6686 | /* Ensure all other unused pins are disabled and muted. */ |
| 6687 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6688 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6689 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6690 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6691 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6692 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6693 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6694 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6695 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6697 | /* Disable digital (SPDIF) pins */ |
| 6698 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6699 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6700 | |
| 6701 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6702 | * bus when acting as outputs. |
| 6703 | */ |
| 6704 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6705 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6706 | |
| 6707 | /* Start with output sum widgets muted and their output gains at min */ |
| 6708 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6709 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6710 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6711 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6712 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6713 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6714 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6715 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6716 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6717 | |
| 6718 | /* Unmute Line-out pin widget amp left and right |
| 6719 | * (no equiv mixer ctrl) |
| 6720 | */ |
| 6721 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6722 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6723 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6724 | * will take care of enabling the pin's input/output buffers as needed. |
| 6725 | * Therefore there's no need to enable the input buffer at this |
| 6726 | * stage. |
| 6727 | */ |
| 6728 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6729 | |
| 6730 | /* Mute capture amp left and right */ |
| 6731 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6732 | /* Set ADC connection select to match default mixer setting - mic |
| 6733 | * (on mic1 pin) |
| 6734 | */ |
| 6735 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6736 | |
| 6737 | /* Do similar with the second ADC: mute capture input amp and |
| 6738 | * set ADC connection to mic to match ALSA's default state. |
| 6739 | */ |
| 6740 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6741 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6742 | |
| 6743 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6744 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6745 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6746 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6747 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6748 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6749 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6750 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6751 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6752 | |
| 6753 | { } |
| 6754 | }; |
| 6755 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6756 | static const struct hda_verb alc260_will_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6757 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6758 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6759 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6760 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6761 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6762 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6763 | {} |
| 6764 | }; |
| 6765 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6766 | static const struct hda_verb alc260_replacer_672v_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6767 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6768 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6769 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6770 | |
| 6771 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6772 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6773 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6774 | |
| 6775 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6776 | {} |
| 6777 | }; |
| 6778 | |
| 6779 | /* toggle speaker-output according to the hp-jack state */ |
| 6780 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6781 | { |
| 6782 | unsigned int present; |
| 6783 | |
| 6784 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6785 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6786 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6787 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6788 | AC_VERB_SET_GPIO_DATA, 1); |
| 6789 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6790 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6791 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6792 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6793 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6794 | AC_VERB_SET_GPIO_DATA, 0); |
| 6795 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6796 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6797 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6798 | } |
| 6799 | } |
| 6800 | |
| 6801 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6802 | unsigned int res) |
| 6803 | { |
| 6804 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6805 | alc260_replacer_672v_automute(codec); |
| 6806 | } |
| 6807 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6808 | static const struct hda_verb alc260_hp_dc7600_verbs[] = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6809 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6810 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6811 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6812 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6813 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6815 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6816 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6817 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6818 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6819 | {} |
| 6820 | }; |
| 6821 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6822 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6823 | * configuration. |
| 6824 | */ |
| 6825 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6826 | static const hda_nid_t alc260_test_dac_nids[1] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6827 | 0x02, |
| 6828 | }; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6829 | static const hda_nid_t alc260_test_adc_nids[2] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6830 | 0x04, 0x05, |
| 6831 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6832 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6833 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6834 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6835 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6836 | static const struct hda_input_mux alc260_test_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6837 | { |
| 6838 | .num_items = 7, |
| 6839 | .items = { |
| 6840 | { "MIC1 pin", 0x0 }, |
| 6841 | { "MIC2 pin", 0x1 }, |
| 6842 | { "LINE1 pin", 0x2 }, |
| 6843 | { "LINE2 pin", 0x3 }, |
| 6844 | { "CD pin", 0x4 }, |
| 6845 | { "LINE-OUT pin", 0x5 }, |
| 6846 | { "HP-OUT pin", 0x6 }, |
| 6847 | }, |
| 6848 | }, |
| 6849 | { |
| 6850 | .num_items = 8, |
| 6851 | .items = { |
| 6852 | { "MIC1 pin", 0x0 }, |
| 6853 | { "MIC2 pin", 0x1 }, |
| 6854 | { "LINE1 pin", 0x2 }, |
| 6855 | { "LINE2 pin", 0x3 }, |
| 6856 | { "CD pin", 0x4 }, |
| 6857 | { "Mixer", 0x5 }, |
| 6858 | { "LINE-OUT pin", 0x6 }, |
| 6859 | { "HP-OUT pin", 0x7 }, |
| 6860 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6861 | }, |
| 6862 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6863 | static const struct snd_kcontrol_new alc260_test_mixer[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6864 | /* Output driver widgets */ |
| 6865 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6866 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6867 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6868 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6869 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6870 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6871 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6872 | /* Modes for retasking pin widgets |
| 6873 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6874 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6875 | * mention this restriction. At this stage it's not clear whether |
| 6876 | * this behaviour is intentional or is a hardware bug in chip |
| 6877 | * revisions available at least up until early 2006. Therefore for |
| 6878 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6879 | * choices, but if it turns out that the lack of mic bias for these |
| 6880 | * NIDs is intentional we could change their modes from |
| 6881 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6882 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6883 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6884 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6885 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6886 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6887 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6888 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6889 | |
| 6890 | /* Loopback mixer controls */ |
| 6891 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6892 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6893 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6894 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6895 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6896 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6897 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6898 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6899 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6900 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6901 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6902 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6903 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6904 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6905 | |
| 6906 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6907 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6908 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6909 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6910 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6911 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6912 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6913 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6914 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6915 | */ |
| 6916 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6917 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6918 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6919 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6920 | * this output to turn on an external amplifier. |
| 6921 | */ |
| 6922 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6923 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6924 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6925 | { } /* end */ |
| 6926 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6927 | static const struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6928 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6929 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6930 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6931 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6932 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6933 | /* Enable retasking pins as output, initially without power amp */ |
| 6934 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6935 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6936 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6938 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6939 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6940 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6941 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6942 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6943 | * payload also sets the generation to 0, output to be in "consumer" |
| 6944 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6945 | * control. |
| 6946 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6947 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6948 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6949 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6950 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6951 | * OUT1 sum bus when acting as an output. |
| 6952 | */ |
| 6953 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6954 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6955 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6956 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6957 | |
| 6958 | /* Start with output sum widgets muted and their output gains at min */ |
| 6959 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6960 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6961 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6962 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6963 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6964 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6965 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6966 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6967 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6968 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6969 | /* Unmute retasking pin widget output buffers since the default |
| 6970 | * state appears to be output. As the pin mode is changed by the |
| 6971 | * user the pin mode control will take care of enabling the pin's |
| 6972 | * input/output buffers as needed. |
| 6973 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6974 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6975 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6978 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6979 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6980 | /* Also unmute the mono-out pin widget */ |
| 6981 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6982 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6983 | /* Mute capture amp left and right */ |
| 6984 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6985 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6986 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6987 | */ |
| 6988 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6989 | |
| 6990 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6991 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6992 | */ |
| 6993 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6994 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6995 | |
| 6996 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6997 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6998 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6999 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 7000 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 7001 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 7002 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 7003 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 7004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 7005 | |
| 7006 | { } |
| 7007 | }; |
| 7008 | #endif |
| 7009 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7010 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 7011 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7012 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7013 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 7014 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 7015 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7016 | /* |
| 7017 | * for BIOS auto-configuration |
| 7018 | */ |
| 7019 | |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7020 | /* convert from pin to volume-mixer widget */ |
| 7021 | static hda_nid_t alc260_pin_to_vol_mix(hda_nid_t nid) |
| 7022 | { |
| 7023 | if (nid >= 0x0f && nid <= 0x11) |
| 7024 | return nid - 0x7; |
| 7025 | else if (nid >= 0x12 && nid <= 0x15) |
| 7026 | return 0x08; |
| 7027 | else |
| 7028 | return 0; |
| 7029 | } |
| 7030 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7031 | 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] | 7032 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7033 | { |
| 7034 | hda_nid_t nid_vol; |
| 7035 | unsigned long vol_val, sw_val; |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7036 | int chs, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7037 | |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7038 | nid_vol = alc260_pin_to_vol_mix(nid); |
| 7039 | if (!nid_vol) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7040 | return 0; /* N/A */ |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7041 | if (nid == 0x11) |
| 7042 | chs = 2; |
| 7043 | else |
| 7044 | chs = 3; |
| 7045 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, chs, 0, HDA_OUTPUT); |
| 7046 | sw_val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7047 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7048 | if (!(*vol_bits & (1 << nid_vol))) { |
| 7049 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7050 | 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] | 7051 | if (err < 0) |
| 7052 | return err; |
| 7053 | *vol_bits |= (1 << nid_vol); |
| 7054 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7055 | 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] | 7056 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7057 | return err; |
| 7058 | return 1; |
| 7059 | } |
| 7060 | |
| 7061 | /* add playback controls from the parsed DAC table */ |
| 7062 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7063 | const struct auto_pin_cfg *cfg) |
| 7064 | { |
| 7065 | hda_nid_t nid; |
| 7066 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7067 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7068 | |
| 7069 | spec->multiout.num_dacs = 1; |
| 7070 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 7071 | spec->private_dac_nids[0] = 0x02; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7072 | |
| 7073 | nid = cfg->line_out_pins[0]; |
| 7074 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 7075 | const char *pfx; |
Takashi Iwai | 2e925dd | 2011-06-24 11:27:22 +0200 | [diff] [blame] | 7076 | int index; |
| 7077 | pfx = alc_get_line_out_pfx(spec, 0, true, &index); |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 7078 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7079 | if (err < 0) |
| 7080 | return err; |
| 7081 | } |
| 7082 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7083 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7084 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7085 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7086 | if (err < 0) |
| 7087 | return err; |
| 7088 | } |
| 7089 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7090 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7091 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7092 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 7093 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7094 | if (err < 0) |
| 7095 | return err; |
| 7096 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7097 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7098 | } |
| 7099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7100 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7101 | hda_nid_t nid, int pin_type, |
| 7102 | int sel_idx) |
| 7103 | { |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7104 | hda_nid_t mix; |
| 7105 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7106 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7107 | /* need the manual connection? */ |
| 7108 | if (nid >= 0x12) { |
| 7109 | int idx = nid - 0x12; |
| 7110 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7111 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7112 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7113 | |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7114 | mix = alc260_pin_to_vol_mix(nid); |
| 7115 | if (!mix) |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7116 | return; |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7117 | 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] | 7118 | AMP_OUT_ZERO); |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7119 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7120 | AMP_IN_UNMUTE(0)); |
| 7121 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7122 | AMP_IN_UNMUTE(1)); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7123 | } |
| 7124 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7125 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7126 | { |
| 7127 | struct alc_spec *spec = codec->spec; |
| 7128 | hda_nid_t nid; |
| 7129 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7130 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7131 | if (nid) { |
| 7132 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7133 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7134 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7135 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7136 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7137 | if (nid) |
| 7138 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7139 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7140 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7141 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7142 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7143 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7144 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7145 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7146 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7147 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7148 | { |
| 7149 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7150 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7151 | static const hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7152 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7153 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7154 | alc260_ignore); |
| 7155 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7156 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7157 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7158 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7159 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7160 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7161 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 7162 | err = alc_auto_create_input_ctls(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7163 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7164 | return err; |
| 7165 | |
| 7166 | spec->multiout.max_channels = 2; |
| 7167 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7168 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7169 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7170 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7171 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7172 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7173 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7174 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7175 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7176 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7178 | return 1; |
| 7179 | } |
| 7180 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7181 | /* additional initialization for auto-configuration model */ |
| 7182 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7183 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7184 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7185 | alc260_auto_init_multi_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 7186 | alc_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7187 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7188 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7189 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7190 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | } |
| 7192 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7193 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7194 | static const struct hda_amp_list alc260_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7195 | { 0x07, HDA_INPUT, 0 }, |
| 7196 | { 0x07, HDA_INPUT, 1 }, |
| 7197 | { 0x07, HDA_INPUT, 2 }, |
| 7198 | { 0x07, HDA_INPUT, 3 }, |
| 7199 | { 0x07, HDA_INPUT, 4 }, |
| 7200 | { } /* end */ |
| 7201 | }; |
| 7202 | #endif |
| 7203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7204 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7205 | * Pin config fixes |
| 7206 | */ |
| 7207 | enum { |
| 7208 | PINFIX_HP_DC5750, |
| 7209 | }; |
| 7210 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7211 | static const struct alc_fixup alc260_fixups[] = { |
| 7212 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7213 | .type = ALC_FIXUP_PINS, |
| 7214 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7215 | { 0x11, 0x90130110 }, /* speaker */ |
| 7216 | { } |
| 7217 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7218 | }, |
| 7219 | }; |
| 7220 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7221 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7222 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7223 | {} |
| 7224 | }; |
| 7225 | |
| 7226 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7227 | * ALC260 configurations |
| 7228 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7229 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7230 | [ALC260_BASIC] = "basic", |
| 7231 | [ALC260_HP] = "hp", |
| 7232 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7233 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7234 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7235 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7236 | [ALC260_WILL] = "will", |
| 7237 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7238 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7239 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7240 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7241 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7242 | [ALC260_AUTO] = "auto", |
| 7243 | }; |
| 7244 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7245 | static const struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7246 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7247 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7248 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7249 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7250 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7251 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7252 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7253 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7254 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7255 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7256 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7257 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7258 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7259 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7260 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7261 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7262 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7263 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7264 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7265 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7266 | {} |
| 7267 | }; |
| 7268 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7269 | static const struct alc_config_preset alc260_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7270 | [ALC260_BASIC] = { |
| 7271 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7272 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7273 | .init_verbs = { alc260_init_verbs }, |
| 7274 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7275 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7276 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7277 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7278 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7279 | .channel_mode = alc260_modes, |
| 7280 | .input_mux = &alc260_capture_source, |
| 7281 | }, |
| 7282 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7283 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7284 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7285 | .init_verbs = { alc260_init_verbs, |
| 7286 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7287 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7288 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7289 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7290 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7291 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7292 | .channel_mode = alc260_modes, |
| 7293 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7294 | .unsol_event = alc_sku_unsol_event, |
| 7295 | .setup = alc260_hp_setup, |
| 7296 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7297 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7298 | [ALC260_HP_DC7600] = { |
| 7299 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7300 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7301 | .init_verbs = { alc260_init_verbs, |
| 7302 | alc260_hp_dc7600_verbs }, |
| 7303 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7304 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7305 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7306 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7307 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7308 | .channel_mode = alc260_modes, |
| 7309 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7310 | .unsol_event = alc_sku_unsol_event, |
| 7311 | .setup = alc260_hp_3012_setup, |
| 7312 | .init_hook = alc_inithook, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7313 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7314 | [ALC260_HP_3013] = { |
| 7315 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7316 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7317 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7318 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7319 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7320 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7321 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7322 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7323 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7324 | .channel_mode = alc260_modes, |
| 7325 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7326 | .unsol_event = alc_sku_unsol_event, |
| 7327 | .setup = alc260_hp_3013_setup, |
| 7328 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7329 | }, |
| 7330 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7331 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7332 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7333 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7334 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7335 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7336 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7337 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7338 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7339 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7340 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7341 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7342 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7343 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7344 | .init_verbs = { alc260_acer_init_verbs }, |
| 7345 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7346 | .dac_nids = alc260_dac_nids, |
| 7347 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7348 | .adc_nids = alc260_dual_adc_nids, |
| 7349 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7350 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7351 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7352 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7353 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7354 | [ALC260_FAVORIT100] = { |
| 7355 | .mixers = { alc260_favorit100_mixer }, |
| 7356 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7357 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7358 | .dac_nids = alc260_dac_nids, |
| 7359 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7360 | .adc_nids = alc260_dual_adc_nids, |
| 7361 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7362 | .channel_mode = alc260_modes, |
| 7363 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7364 | .input_mux = alc260_favorit100_capture_sources, |
| 7365 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7366 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7367 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7368 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7369 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7370 | .dac_nids = alc260_dac_nids, |
| 7371 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7372 | .adc_nids = alc260_adc_nids, |
| 7373 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7374 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7375 | .channel_mode = alc260_modes, |
| 7376 | .input_mux = &alc260_capture_source, |
| 7377 | }, |
| 7378 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7379 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7380 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7381 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7382 | .dac_nids = alc260_dac_nids, |
| 7383 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7384 | .adc_nids = alc260_adc_nids, |
| 7385 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7386 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7387 | .channel_mode = alc260_modes, |
| 7388 | .input_mux = &alc260_capture_source, |
| 7389 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7390 | .init_hook = alc260_replacer_672v_automute, |
| 7391 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7392 | #ifdef CONFIG_SND_DEBUG |
| 7393 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7394 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7395 | .init_verbs = { alc260_test_init_verbs }, |
| 7396 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7397 | .dac_nids = alc260_test_dac_nids, |
| 7398 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7399 | .adc_nids = alc260_test_adc_nids, |
| 7400 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7401 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7402 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7403 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7404 | }, |
| 7405 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7406 | }; |
| 7407 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7408 | static int patch_alc260(struct hda_codec *codec) |
| 7409 | { |
| 7410 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7411 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7412 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7413 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7414 | if (spec == NULL) |
| 7415 | return -ENOMEM; |
| 7416 | |
| 7417 | codec->spec = spec; |
| 7418 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7419 | spec->mixer_nid = 0x07; |
| 7420 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7421 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7422 | alc260_models, |
| 7423 | alc260_cfg_tbl); |
| 7424 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7425 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7426 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7427 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7428 | } |
| 7429 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7430 | if (board_config == ALC260_AUTO) { |
| 7431 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7432 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7433 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7434 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7435 | if (board_config == ALC260_AUTO) { |
| 7436 | /* automatic parse from the BIOS config */ |
| 7437 | err = alc260_parse_auto_config(codec); |
| 7438 | if (err < 0) { |
| 7439 | alc_free(codec); |
| 7440 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7441 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7442 | printk(KERN_INFO |
| 7443 | "hda_codec: Cannot set up configuration " |
| 7444 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7445 | board_config = ALC260_BASIC; |
| 7446 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7447 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7448 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7449 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7450 | if (err < 0) { |
| 7451 | alc_free(codec); |
| 7452 | return err; |
| 7453 | } |
| 7454 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7455 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7456 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7457 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7458 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7459 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7460 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7461 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7462 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7463 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7464 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7465 | if (!spec->adc_nids && spec->input_mux) { |
| 7466 | /* check whether NID 0x04 is valid */ |
| 7467 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7468 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7469 | /* get type */ |
| 7470 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7471 | spec->adc_nids = alc260_adc_nids_alt; |
| 7472 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7473 | } else { |
| 7474 | spec->adc_nids = alc260_adc_nids; |
| 7475 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7476 | } |
| 7477 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7478 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7479 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7480 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7481 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7482 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7483 | spec->vmaster_nid = 0x08; |
| 7484 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7485 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7486 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7487 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 7488 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7489 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7490 | if (!spec->loopback.amplist) |
| 7491 | spec->loopback.amplist = alc260_loopbacks; |
| 7492 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7493 | |
| 7494 | return 0; |
| 7495 | } |
| 7496 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7497 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7498 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7499 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7500 | * |
| 7501 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7502 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7503 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7504 | * 6-channel independent captures. |
| 7505 | * |
| 7506 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7507 | * driver yet). |
| 7508 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7509 | #define ALC882_DIGOUT_NID 0x06 |
| 7510 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7511 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7512 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7513 | #define ALC1200_DIGOUT_NID 0x10 |
| 7514 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7515 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7516 | static const struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7517 | { 8, NULL } |
| 7518 | }; |
| 7519 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7520 | /* DACs */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7521 | static const hda_nid_t alc882_dac_nids[4] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7522 | /* front, rear, clfe, rear_surr */ |
| 7523 | 0x02, 0x03, 0x04, 0x05 |
| 7524 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7525 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7526 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7527 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7528 | #define alc882_adc_nids alc880_adc_nids |
| 7529 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7530 | #define alc883_adc_nids alc882_adc_nids_alt |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7531 | static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7532 | static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7533 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7534 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7535 | static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7536 | static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7537 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7538 | static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7539 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7540 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7541 | /* input MUX */ |
| 7542 | /* FIXME: should be a matrix-type input source selection */ |
| 7543 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7544 | static const struct hda_input_mux alc882_capture_source = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7545 | .num_items = 4, |
| 7546 | .items = { |
| 7547 | { "Mic", 0x0 }, |
| 7548 | { "Front Mic", 0x1 }, |
| 7549 | { "Line", 0x2 }, |
| 7550 | { "CD", 0x4 }, |
| 7551 | }, |
| 7552 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7553 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7554 | #define alc883_capture_source alc882_capture_source |
| 7555 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7556 | static const struct hda_input_mux alc889_capture_source = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7557 | .num_items = 3, |
| 7558 | .items = { |
| 7559 | { "Front Mic", 0x0 }, |
| 7560 | { "Mic", 0x3 }, |
| 7561 | { "Line", 0x2 }, |
| 7562 | }, |
| 7563 | }; |
| 7564 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7565 | static const struct hda_input_mux mb5_capture_source = { |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7566 | .num_items = 3, |
| 7567 | .items = { |
| 7568 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7569 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7570 | { "CD", 0x4 }, |
| 7571 | }, |
| 7572 | }; |
| 7573 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7574 | static const struct hda_input_mux macmini3_capture_source = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7575 | .num_items = 2, |
| 7576 | .items = { |
| 7577 | { "Line", 0x2 }, |
| 7578 | { "CD", 0x4 }, |
| 7579 | }, |
| 7580 | }; |
| 7581 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7582 | static const struct hda_input_mux alc883_3stack_6ch_intel = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7583 | .num_items = 4, |
| 7584 | .items = { |
| 7585 | { "Mic", 0x1 }, |
| 7586 | { "Front Mic", 0x0 }, |
| 7587 | { "Line", 0x2 }, |
| 7588 | { "CD", 0x4 }, |
| 7589 | }, |
| 7590 | }; |
| 7591 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7592 | static const struct hda_input_mux alc883_lenovo_101e_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7593 | .num_items = 2, |
| 7594 | .items = { |
| 7595 | { "Mic", 0x1 }, |
| 7596 | { "Line", 0x2 }, |
| 7597 | }, |
| 7598 | }; |
| 7599 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7600 | static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7601 | .num_items = 4, |
| 7602 | .items = { |
| 7603 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7604 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7605 | { "Line", 0x2 }, |
| 7606 | { "CD", 0x4 }, |
| 7607 | }, |
| 7608 | }; |
| 7609 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7610 | static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7611 | .num_items = 2, |
| 7612 | .items = { |
| 7613 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7614 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7615 | }, |
| 7616 | }; |
| 7617 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7618 | static const struct hda_input_mux alc883_lenovo_sky_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7619 | .num_items = 3, |
| 7620 | .items = { |
| 7621 | { "Mic", 0x0 }, |
| 7622 | { "Front Mic", 0x1 }, |
| 7623 | { "Line", 0x4 }, |
| 7624 | }, |
| 7625 | }; |
| 7626 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7627 | static const struct hda_input_mux alc883_asus_eee1601_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7628 | .num_items = 2, |
| 7629 | .items = { |
| 7630 | { "Mic", 0x0 }, |
| 7631 | { "Line", 0x2 }, |
| 7632 | }, |
| 7633 | }; |
| 7634 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7635 | static const struct hda_input_mux alc889A_mb31_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7636 | .num_items = 2, |
| 7637 | .items = { |
| 7638 | { "Mic", 0x0 }, |
| 7639 | /* Front Mic (0x01) unused */ |
| 7640 | { "Line", 0x2 }, |
| 7641 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7642 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7643 | }, |
| 7644 | }; |
| 7645 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7646 | static const struct hda_input_mux alc889A_imac91_capture_source = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7647 | .num_items = 2, |
| 7648 | .items = { |
| 7649 | { "Mic", 0x01 }, |
| 7650 | { "Line", 0x2 }, /* Not sure! */ |
| 7651 | }, |
| 7652 | }; |
| 7653 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7654 | /* |
| 7655 | * 2ch mode |
| 7656 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7657 | static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7658 | { 2, NULL } |
| 7659 | }; |
| 7660 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7661 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7662 | * 2ch mode |
| 7663 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7664 | static const struct hda_verb alc882_3ST_ch2_init[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7665 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7666 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7667 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7668 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7669 | { } /* end */ |
| 7670 | }; |
| 7671 | |
| 7672 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7673 | * 4ch mode |
| 7674 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7675 | static const struct hda_verb alc882_3ST_ch4_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7676 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7677 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7678 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7679 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7680 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7681 | { } /* end */ |
| 7682 | }; |
| 7683 | |
| 7684 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7685 | * 6ch mode |
| 7686 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7687 | static const struct hda_verb alc882_3ST_ch6_init[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7688 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7689 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7690 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7691 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7692 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7693 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7694 | { } /* end */ |
| 7695 | }; |
| 7696 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7697 | static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7698 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7699 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7700 | { 6, alc882_3ST_ch6_init }, |
| 7701 | }; |
| 7702 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7703 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7704 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7705 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7706 | * 2ch mode |
| 7707 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7708 | static const struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7709 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7710 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7711 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7712 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7713 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7714 | { } /* end */ |
| 7715 | }; |
| 7716 | |
| 7717 | /* |
| 7718 | * 4ch mode |
| 7719 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7720 | static const struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7721 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7722 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7723 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7724 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7725 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7726 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7727 | { } /* end */ |
| 7728 | }; |
| 7729 | |
| 7730 | /* |
| 7731 | * 6ch mode |
| 7732 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7733 | static const struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7734 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7735 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7736 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7737 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7738 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7739 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7740 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7741 | { } /* end */ |
| 7742 | }; |
| 7743 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7744 | 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] | 7745 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7746 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7747 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7748 | }; |
| 7749 | |
| 7750 | |
| 7751 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7752 | * 6ch mode |
| 7753 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7754 | static const struct hda_verb alc882_sixstack_ch6_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7755 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7756 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7757 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7758 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7759 | { } /* end */ |
| 7760 | }; |
| 7761 | |
| 7762 | /* |
| 7763 | * 8ch mode |
| 7764 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7765 | static const struct hda_verb alc882_sixstack_ch8_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7766 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7767 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7768 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7769 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7770 | { } /* end */ |
| 7771 | }; |
| 7772 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7773 | static const struct hda_channel_mode alc882_sixstack_modes[2] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7774 | { 6, alc882_sixstack_ch6_init }, |
| 7775 | { 8, alc882_sixstack_ch8_init }, |
| 7776 | }; |
| 7777 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7778 | |
| 7779 | /* Macbook Air 2,1 */ |
| 7780 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7781 | static const struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7782 | { 2, NULL }, |
| 7783 | }; |
| 7784 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7785 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7786 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7787 | */ |
| 7788 | |
| 7789 | /* |
| 7790 | * 2ch mode |
| 7791 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7792 | static const struct hda_verb alc885_mbp_ch2_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7793 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7794 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7795 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7796 | { } /* end */ |
| 7797 | }; |
| 7798 | |
| 7799 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7800 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7801 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7802 | static const struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7803 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7804 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7805 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7806 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7807 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7808 | { } /* end */ |
| 7809 | }; |
| 7810 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7811 | static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7812 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7813 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7814 | }; |
| 7815 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7816 | /* |
| 7817 | * 2ch |
| 7818 | * Speakers/Woofer/HP = Front |
| 7819 | * LineIn = Input |
| 7820 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7821 | static const struct hda_verb alc885_mb5_ch2_init[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7822 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7824 | { } /* end */ |
| 7825 | }; |
| 7826 | |
| 7827 | /* |
| 7828 | * 6ch mode |
| 7829 | * Speakers/HP = Front |
| 7830 | * Woofer = LFE |
| 7831 | * LineIn = Surround |
| 7832 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7833 | static const struct hda_verb alc885_mb5_ch6_init[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7835 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7836 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7837 | { } /* end */ |
| 7838 | }; |
| 7839 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7840 | static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7841 | { 2, alc885_mb5_ch2_init }, |
| 7842 | { 6, alc885_mb5_ch6_init }, |
| 7843 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7844 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7845 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7846 | |
| 7847 | /* |
| 7848 | * 2ch mode |
| 7849 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7850 | static const struct hda_verb alc883_4ST_ch2_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7851 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7852 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7853 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7854 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7855 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7856 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7857 | { } /* end */ |
| 7858 | }; |
| 7859 | |
| 7860 | /* |
| 7861 | * 4ch mode |
| 7862 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7863 | static const struct hda_verb alc883_4ST_ch4_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7864 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7865 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7866 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7867 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7868 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7869 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7870 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7871 | { } /* end */ |
| 7872 | }; |
| 7873 | |
| 7874 | /* |
| 7875 | * 6ch mode |
| 7876 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7877 | static const struct hda_verb alc883_4ST_ch6_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7878 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7879 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7880 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7881 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7882 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7883 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7884 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7885 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7886 | { } /* end */ |
| 7887 | }; |
| 7888 | |
| 7889 | /* |
| 7890 | * 8ch mode |
| 7891 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7892 | static const struct hda_verb alc883_4ST_ch8_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7893 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7894 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7895 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7896 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7897 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7898 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7899 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7900 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7901 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7902 | { } /* end */ |
| 7903 | }; |
| 7904 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7905 | static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7906 | { 2, alc883_4ST_ch2_init }, |
| 7907 | { 4, alc883_4ST_ch4_init }, |
| 7908 | { 6, alc883_4ST_ch6_init }, |
| 7909 | { 8, alc883_4ST_ch8_init }, |
| 7910 | }; |
| 7911 | |
| 7912 | |
| 7913 | /* |
| 7914 | * 2ch mode |
| 7915 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7916 | static const struct hda_verb alc883_3ST_ch2_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7917 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7918 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7919 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7920 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7921 | { } /* end */ |
| 7922 | }; |
| 7923 | |
| 7924 | /* |
| 7925 | * 4ch mode |
| 7926 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7927 | static const struct hda_verb alc883_3ST_ch4_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7928 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7929 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7930 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7931 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7932 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7933 | { } /* end */ |
| 7934 | }; |
| 7935 | |
| 7936 | /* |
| 7937 | * 6ch mode |
| 7938 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7939 | static const struct hda_verb alc883_3ST_ch6_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7940 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7941 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7942 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7943 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7944 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7945 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7946 | { } /* end */ |
| 7947 | }; |
| 7948 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7949 | static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7950 | { 2, alc883_3ST_ch2_intel_init }, |
| 7951 | { 4, alc883_3ST_ch4_intel_init }, |
| 7952 | { 6, alc883_3ST_ch6_intel_init }, |
| 7953 | }; |
| 7954 | |
| 7955 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7956 | * 2ch mode |
| 7957 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7958 | static const struct hda_verb alc889_ch2_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7959 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7960 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7961 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7962 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7963 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7964 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7965 | { } /* end */ |
| 7966 | }; |
| 7967 | |
| 7968 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7969 | * 6ch mode |
| 7970 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7971 | static const struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7972 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7973 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7974 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7975 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7976 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7977 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7978 | { } /* end */ |
| 7979 | }; |
| 7980 | |
| 7981 | /* |
| 7982 | * 8ch mode |
| 7983 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7984 | static const struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7985 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7986 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7987 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7988 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7989 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7990 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7991 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7992 | { } /* end */ |
| 7993 | }; |
| 7994 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7995 | static const struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7996 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7997 | { 6, alc889_ch6_intel_init }, |
| 7998 | { 8, alc889_ch8_intel_init }, |
| 7999 | }; |
| 8000 | |
| 8001 | /* |
| 8002 | * 6ch mode |
| 8003 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8004 | static const struct hda_verb alc883_sixstack_ch6_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8005 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8006 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8007 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8008 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8009 | { } /* end */ |
| 8010 | }; |
| 8011 | |
| 8012 | /* |
| 8013 | * 8ch mode |
| 8014 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8015 | static const struct hda_verb alc883_sixstack_ch8_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8016 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8017 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8018 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8019 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8020 | { } /* end */ |
| 8021 | }; |
| 8022 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8023 | static const struct hda_channel_mode alc883_sixstack_modes[2] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8024 | { 6, alc883_sixstack_ch6_init }, |
| 8025 | { 8, alc883_sixstack_ch8_init }, |
| 8026 | }; |
| 8027 | |
| 8028 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8029 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 8030 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 8031 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8032 | static const struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8034 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8035 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8036 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8037 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8038 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8039 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8040 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8041 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8042 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8043 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8044 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8045 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8046 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8047 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8048 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8049 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8051 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8052 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8053 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8054 | { } /* end */ |
| 8055 | }; |
| 8056 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8057 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8058 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8059 | static const struct snd_kcontrol_new alc885_mba21_mixer[] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8060 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8061 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8062 | { } |
| 8063 | }; |
| 8064 | |
| 8065 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8066 | static const struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8067 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8068 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8069 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8070 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8071 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8072 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8073 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8075 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8076 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8077 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8078 | { } /* end */ |
| 8079 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8080 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8081 | static const struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8082 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8083 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8084 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8085 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8086 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8087 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8088 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8089 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8090 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8091 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8093 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8094 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8095 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8096 | { } /* end */ |
| 8097 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8098 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8099 | static const struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8100 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8101 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8102 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8103 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8104 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8105 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8106 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8107 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8108 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8109 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8110 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8111 | { } /* end */ |
| 8112 | }; |
| 8113 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8114 | static const struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8115 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8116 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8117 | { } /* end */ |
| 8118 | }; |
| 8119 | |
| 8120 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8121 | static const struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8122 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8123 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8124 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8125 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8126 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8127 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8129 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8131 | { } /* end */ |
| 8132 | }; |
| 8133 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8134 | static const struct snd_kcontrol_new alc882_targa_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8135 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8136 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8137 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8138 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8139 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8140 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8141 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8142 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8144 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8145 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8146 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8147 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8148 | { } /* end */ |
| 8149 | }; |
| 8150 | |
| 8151 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8152 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8153 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8154 | static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8155 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8156 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8157 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8158 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8159 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8160 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8161 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8162 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8163 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8164 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8165 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8167 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8168 | { } /* end */ |
| 8169 | }; |
| 8170 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8171 | static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8173 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8174 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8175 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8176 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8177 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8178 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8180 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8181 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8182 | { } /* end */ |
| 8183 | }; |
| 8184 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8185 | static const struct snd_kcontrol_new alc882_chmode_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8186 | { |
| 8187 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8188 | .name = "Channel Mode", |
| 8189 | .info = alc_ch_mode_info, |
| 8190 | .get = alc_ch_mode_get, |
| 8191 | .put = alc_ch_mode_put, |
| 8192 | }, |
| 8193 | { } /* end */ |
| 8194 | }; |
| 8195 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8196 | static const struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8197 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8200 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8201 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8202 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8203 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8204 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8205 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8206 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8207 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8208 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8209 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8210 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8211 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8212 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8213 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8214 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8215 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8216 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8217 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8218 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8219 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8220 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8221 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8222 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8223 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8224 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8225 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8226 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8227 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8228 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8229 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8230 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8231 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8232 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8233 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8234 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8235 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8236 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8237 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8238 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8239 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8240 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8241 | |
| 8242 | /* FIXME: use matrix-type input source selection */ |
| 8243 | /* 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] | 8244 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8245 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8246 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8248 | /* ADC2: mute amp left and right */ |
| 8249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8250 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8251 | /* ADC3: mute amp left and right */ |
| 8252 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8253 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8254 | |
| 8255 | { } |
| 8256 | }; |
| 8257 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8258 | static const struct hda_verb alc882_adc1_init_verbs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8259 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8260 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8261 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8262 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8263 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8264 | /* ADC1: mute amp left and right */ |
| 8265 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8266 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8267 | { } |
| 8268 | }; |
| 8269 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8270 | static const struct hda_verb alc882_eapd_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8271 | /* change to EAPD mode */ |
| 8272 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8273 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8274 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8275 | }; |
| 8276 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8277 | static const struct hda_verb alc889_eapd_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8278 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8279 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8280 | { } |
| 8281 | }; |
| 8282 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8283 | static const struct hda_verb alc_hp15_unsol_verbs[] = { |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8284 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8285 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8286 | {} |
| 8287 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8288 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8289 | static const struct hda_verb alc885_init_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8290 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8291 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8293 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8294 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8296 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8299 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8300 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8301 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8302 | |
| 8303 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8305 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8306 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8307 | /* Front Pin: output 0 (0x0c) */ |
| 8308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8309 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8310 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8311 | /* Rear Pin: output 1 (0x0d) */ |
| 8312 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8313 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8314 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8315 | /* CLFE Pin: output 2 (0x0e) */ |
| 8316 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8317 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8318 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8319 | /* Side Pin: output 3 (0x0f) */ |
| 8320 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8321 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8322 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8323 | /* Mic (rear) pin: input vref at 80% */ |
| 8324 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8325 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8326 | /* Front Mic pin: input vref at 80% */ |
| 8327 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8328 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8329 | /* Line In pin: input */ |
| 8330 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8331 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8332 | |
| 8333 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8334 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8335 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8336 | /* Input mixer2 */ |
| 8337 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8338 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8339 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8340 | /* ADC2: mute amp left and right */ |
| 8341 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8342 | /* ADC3: mute amp left and right */ |
| 8343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8344 | |
| 8345 | { } |
| 8346 | }; |
| 8347 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8348 | static const struct hda_verb alc885_init_input_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8349 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8352 | { } |
| 8353 | }; |
| 8354 | |
| 8355 | |
| 8356 | /* Unmute Selector 24h and set the default input to front mic */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8357 | static const struct hda_verb alc889_init_input_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8358 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8359 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8360 | { } |
| 8361 | }; |
| 8362 | |
| 8363 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8364 | #define alc883_init_verbs alc882_base_init_verbs |
| 8365 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8366 | /* Mac Pro test */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8367 | static const struct snd_kcontrol_new alc882_macpro_mixer[] = { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8368 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8369 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8370 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8371 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8372 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8373 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8374 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8375 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8376 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8377 | { } /* end */ |
| 8378 | }; |
| 8379 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8380 | static const struct hda_verb alc882_macpro_init_verbs[] = { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8381 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8383 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8384 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8385 | /* Front Pin: output 0 (0x0c) */ |
| 8386 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8389 | /* Front Mic pin: input vref at 80% */ |
| 8390 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8391 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8392 | /* Speaker: output */ |
| 8393 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8394 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8395 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8396 | /* Headphone output (output 0 - 0x0c) */ |
| 8397 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8398 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8399 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8400 | |
| 8401 | /* FIXME: use matrix-type input source selection */ |
| 8402 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8403 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8405 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8406 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8407 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8408 | /* Input mixer2 */ |
| 8409 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8410 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8411 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8412 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8413 | /* Input mixer3 */ |
| 8414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8415 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8417 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8418 | /* ADC1: mute amp left and right */ |
| 8419 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8420 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8421 | /* ADC2: mute amp left and right */ |
| 8422 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8423 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8424 | /* ADC3: mute amp left and right */ |
| 8425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8426 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8427 | |
| 8428 | { } |
| 8429 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8430 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8431 | /* Macbook 5,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8432 | static const struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8433 | /* DACs */ |
| 8434 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8435 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8436 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8437 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8438 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8441 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8442 | /* Surround mixer */ |
| 8443 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8444 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8445 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8446 | /* LFE mixer */ |
| 8447 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8450 | /* HP mixer */ |
| 8451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8452 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8453 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8454 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8456 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8457 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8458 | /* LFE Pin (0x0e) */ |
| 8459 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8460 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8461 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8462 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8465 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8466 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8467 | /* Front Mic pin: input vref at 80% */ |
| 8468 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8469 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8470 | /* Line In pin */ |
| 8471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8472 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8473 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8474 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8475 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8476 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8477 | { } |
| 8478 | }; |
| 8479 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8480 | /* Macmini 3,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8481 | static const struct hda_verb alc885_macmini3_init_verbs[] = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8482 | /* DACs */ |
| 8483 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8484 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8485 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8486 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8487 | /* Front mixer */ |
| 8488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8489 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8491 | /* Surround mixer */ |
| 8492 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8493 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8494 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8495 | /* LFE mixer */ |
| 8496 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8497 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8498 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8499 | /* HP mixer */ |
| 8500 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8501 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8502 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8503 | /* Front Pin (0x0c) */ |
| 8504 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8505 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8506 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8507 | /* LFE Pin (0x0e) */ |
| 8508 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8509 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8510 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8511 | /* HP Pin (0x0f) */ |
| 8512 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8513 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8514 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8515 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8516 | /* Line In pin */ |
| 8517 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8519 | |
| 8520 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8521 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8522 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8523 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8524 | { } |
| 8525 | }; |
| 8526 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8527 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8528 | static const struct hda_verb alc885_mba21_init_verbs[] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8529 | /*Internal and HP Speaker Mixer*/ |
| 8530 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8532 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8533 | /*Internal Speaker Pin (0x0c)*/ |
| 8534 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8535 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8536 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8537 | /* HP Pin: output 0 (0x0e) */ |
| 8538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8539 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8540 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8541 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8542 | /* Line in (is hp when jack connected)*/ |
| 8543 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8544 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8545 | |
| 8546 | { } |
| 8547 | }; |
| 8548 | |
| 8549 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8550 | /* Macbook Pro rev3 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8551 | static const struct hda_verb alc885_mbp3_init_verbs[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8552 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8556 | /* Rear mixer */ |
| 8557 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8558 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8559 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8560 | /* HP mixer */ |
| 8561 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8562 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8563 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8564 | /* Front Pin: output 0 (0x0c) */ |
| 8565 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8566 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8567 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8568 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8569 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8570 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8571 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8572 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8573 | /* Mic (rear) pin: input vref at 80% */ |
| 8574 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8575 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8576 | /* Front Mic pin: input vref at 80% */ |
| 8577 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8578 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8579 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8580 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8581 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8582 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8583 | |
| 8584 | /* FIXME: use matrix-type input source selection */ |
| 8585 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8586 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8587 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8588 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8589 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8590 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8591 | /* Input mixer2 */ |
| 8592 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8593 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8594 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8595 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8596 | /* Input mixer3 */ |
| 8597 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8598 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8599 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8601 | /* ADC1: mute amp left and right */ |
| 8602 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8603 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8604 | /* ADC2: mute amp left and right */ |
| 8605 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8606 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8607 | /* ADC3: mute amp left and right */ |
| 8608 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8609 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8610 | |
| 8611 | { } |
| 8612 | }; |
| 8613 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8614 | /* iMac 9,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8615 | static const struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8616 | /* Internal Speaker Pin (0x0c) */ |
| 8617 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8618 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8619 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8620 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8621 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8622 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8623 | /* HP Pin: Rear */ |
| 8624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8625 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8626 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8627 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8628 | /* Line in Rear */ |
| 8629 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8630 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8631 | /* Front Mic pin: input vref at 80% */ |
| 8632 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8634 | /* Rear mixer */ |
| 8635 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8636 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8637 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8638 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8639 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8640 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8641 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8642 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8646 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8647 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8648 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8651 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8652 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8655 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8656 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8657 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8658 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8659 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8660 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8661 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8662 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8663 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8664 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8665 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8666 | { } |
| 8667 | }; |
| 8668 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8669 | /* iMac 24 mixer. */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8670 | static const struct snd_kcontrol_new alc885_imac24_mixer[] = { |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8671 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8672 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8673 | { } /* end */ |
| 8674 | }; |
| 8675 | |
| 8676 | /* iMac 24 init verbs. */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8677 | static const struct hda_verb alc885_imac24_init_verbs[] = { |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8678 | /* Internal speakers: output 0 (0x0c) */ |
| 8679 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8680 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8681 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8682 | /* Internal speakers: output 0 (0x0c) */ |
| 8683 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8684 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8685 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8686 | /* Headphone: output 0 (0x0c) */ |
| 8687 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8688 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8689 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8690 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8691 | /* Front Mic: input vref at 80% */ |
| 8692 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8693 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8694 | { } |
| 8695 | }; |
| 8696 | |
| 8697 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8698 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8699 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8700 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8701 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8702 | spec->autocfg.hp_pins[0] = 0x14; |
| 8703 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8704 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8705 | spec->automute = 1; |
| 8706 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8707 | } |
| 8708 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8709 | #define alc885_mb5_setup alc885_imac24_setup |
| 8710 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8711 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8712 | /* Macbook Air 2,1 */ |
| 8713 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8714 | { |
| 8715 | struct alc_spec *spec = codec->spec; |
| 8716 | |
| 8717 | spec->autocfg.hp_pins[0] = 0x14; |
| 8718 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8719 | spec->automute = 1; |
| 8720 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8721 | } |
| 8722 | |
| 8723 | |
| 8724 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8725 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8726 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8727 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8728 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8729 | spec->autocfg.hp_pins[0] = 0x15; |
| 8730 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8731 | spec->automute = 1; |
| 8732 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8733 | } |
| 8734 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8735 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8736 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8737 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8738 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8739 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8740 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8741 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8742 | spec->automute = 1; |
| 8743 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8744 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8745 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8746 | static const struct hda_verb alc882_targa_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8748 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8749 | |
| 8750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8751 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8752 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8753 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8754 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8755 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8756 | |
| 8757 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8758 | { } /* end */ |
| 8759 | }; |
| 8760 | |
| 8761 | /* toggle speaker-output according to the hp-jack state */ |
| 8762 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8763 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8764 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8765 | alc_hp_automute(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8766 | 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] | 8767 | spec->jack_present ? 1 : 3); |
| 8768 | } |
| 8769 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8770 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8771 | { |
| 8772 | struct alc_spec *spec = codec->spec; |
| 8773 | |
| 8774 | spec->autocfg.hp_pins[0] = 0x14; |
| 8775 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8776 | spec->automute = 1; |
| 8777 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8778 | } |
| 8779 | |
| 8780 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8781 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8782 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8783 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8784 | } |
| 8785 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8786 | static const struct hda_verb alc882_asus_a7j_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8789 | |
| 8790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8791 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8792 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8793 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8794 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8795 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8796 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8797 | |
| 8798 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8799 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8800 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8801 | { } /* end */ |
| 8802 | }; |
| 8803 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8804 | static const struct hda_verb alc882_asus_a7m_verbs[] = { |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8806 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8807 | |
| 8808 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8809 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8810 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8811 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8812 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8813 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8814 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8815 | |
| 8816 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8817 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8818 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8819 | { } /* end */ |
| 8820 | }; |
| 8821 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8822 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8823 | { |
| 8824 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8825 | |
| 8826 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8827 | AC_VERB_GET_GPIO_DATA, 0); |
| 8828 | |
| 8829 | if (!muted) |
| 8830 | gpiostate |= (1 << pin); |
| 8831 | else |
| 8832 | gpiostate &= ~(1 << pin); |
| 8833 | |
| 8834 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8835 | AC_VERB_GET_GPIO_MASK, 0); |
| 8836 | gpiomask |= (1 << pin); |
| 8837 | |
| 8838 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8839 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8840 | gpiodir |= (1 << pin); |
| 8841 | |
| 8842 | |
| 8843 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8844 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8845 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8846 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8847 | |
| 8848 | msleep(1); |
| 8849 | |
| 8850 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8851 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8852 | } |
| 8853 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8854 | /* set up GPIO at initialization */ |
| 8855 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8856 | { |
| 8857 | alc882_gpio_mute(codec, 0, 0); |
| 8858 | alc882_gpio_mute(codec, 1, 0); |
| 8859 | } |
| 8860 | |
| 8861 | /* set up GPIO and update auto-muting at initialization */ |
| 8862 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8863 | { |
| 8864 | alc885_macpro_init_hook(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8865 | alc_hp_automute(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8866 | } |
| 8867 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8868 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8869 | static const struct hda_verb alc889A_mb31_ch2_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8870 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8871 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8872 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8873 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8874 | { } /* end */ |
| 8875 | }; |
| 8876 | |
| 8877 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8878 | static const struct hda_verb alc889A_mb31_ch4_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8879 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8880 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8881 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8882 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8883 | { } /* end */ |
| 8884 | }; |
| 8885 | |
| 8886 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8887 | static const struct hda_verb alc889A_mb31_ch5_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8888 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8889 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8890 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8891 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8892 | { } /* end */ |
| 8893 | }; |
| 8894 | |
| 8895 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8896 | static const struct hda_verb alc889A_mb31_ch6_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8897 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8898 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8899 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8900 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8901 | { } /* end */ |
| 8902 | }; |
| 8903 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8904 | static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8905 | { 2, alc889A_mb31_ch2_init }, |
| 8906 | { 4, alc889A_mb31_ch4_init }, |
| 8907 | { 5, alc889A_mb31_ch5_init }, |
| 8908 | { 6, alc889A_mb31_ch6_init }, |
| 8909 | }; |
| 8910 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8911 | static const struct hda_verb alc883_medion_eapd_verbs[] = { |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8912 | /* eanable EAPD on medion laptop */ |
| 8913 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8914 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8915 | { } |
| 8916 | }; |
| 8917 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8918 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8919 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8920 | static const struct snd_kcontrol_new alc883_mitac_mixer[] = { |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8921 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8922 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8923 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8924 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8925 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8926 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8927 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8929 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8931 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8932 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8933 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8934 | { } /* end */ |
| 8935 | }; |
| 8936 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8937 | static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8938 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8939 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8940 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8941 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8943 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8944 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8945 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8946 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8947 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8948 | { } /* end */ |
| 8949 | }; |
| 8950 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8951 | static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8952 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8953 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8954 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8955 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8957 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8959 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8960 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8961 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8962 | { } /* end */ |
| 8963 | }; |
| 8964 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8965 | static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8966 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8967 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8971 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8972 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8974 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8976 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8977 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8978 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8979 | { } /* end */ |
| 8980 | }; |
| 8981 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8982 | static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8989 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8990 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8991 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8993 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8994 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8995 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8996 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8997 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8999 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9000 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9001 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9002 | { } /* end */ |
| 9003 | }; |
| 9004 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9005 | static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9007 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9008 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9009 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9010 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9011 | HDA_OUTPUT), |
| 9012 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9013 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9014 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9015 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9016 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9017 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9018 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9019 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9021 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9022 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9023 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9024 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9025 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9026 | { } /* end */ |
| 9027 | }; |
| 9028 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9029 | static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9030 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9031 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9032 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9033 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9034 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9035 | HDA_OUTPUT), |
| 9036 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9037 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9038 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9039 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9040 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9041 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9043 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9045 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9047 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9048 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9049 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9050 | { } /* end */ |
| 9051 | }; |
| 9052 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9053 | static const struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9054 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9055 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9056 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9057 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9058 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9059 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9060 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9061 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9062 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9063 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9064 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9065 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9066 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9067 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9068 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9070 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9071 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9072 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9073 | { } /* end */ |
| 9074 | }; |
| 9075 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9076 | static const struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9077 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9078 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9080 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9081 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9082 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9083 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9084 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9085 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9086 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9087 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9088 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9089 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9090 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9091 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9092 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9094 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9095 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9096 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9097 | static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9098 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9099 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9100 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9101 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9102 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9103 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, 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), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [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), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9110 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9111 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9112 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9113 | static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9114 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9115 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9116 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9117 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9118 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9119 | { } /* end */ |
| 9120 | }; |
| 9121 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9122 | static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9124 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9125 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9126 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9127 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9129 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9131 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9132 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9133 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9134 | static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9135 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9136 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9137 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9138 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9139 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9140 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9141 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9142 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9143 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9144 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9145 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9146 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9147 | static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9148 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9149 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9150 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9151 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9152 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9153 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9154 | { } /* end */ |
| 9155 | }; |
| 9156 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9157 | static const struct hda_verb alc883_medion_wim2160_verbs[] = { |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9158 | /* Unmute front mixer */ |
| 9159 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9160 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9161 | |
| 9162 | /* Set speaker pin to front mixer */ |
| 9163 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9164 | |
| 9165 | /* Init headphone pin */ |
| 9166 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9167 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9168 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9169 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9170 | |
| 9171 | { } /* end */ |
| 9172 | }; |
| 9173 | |
| 9174 | /* toggle speaker-output according to the hp-jack state */ |
| 9175 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9176 | { |
| 9177 | struct alc_spec *spec = codec->spec; |
| 9178 | |
| 9179 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9180 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9181 | spec->automute = 1; |
| 9182 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9183 | } |
| 9184 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9185 | static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9186 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9187 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9188 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9189 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9190 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9191 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9192 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9194 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9195 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9196 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9197 | static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9198 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9199 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9200 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9201 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9203 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9205 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9207 | { } /* end */ |
| 9208 | }; |
| 9209 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9210 | static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9211 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9212 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9213 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9214 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9215 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9216 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9217 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9218 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9219 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9220 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9221 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9222 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9223 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9225 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9226 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9227 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9228 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9229 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9230 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9231 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9232 | { } /* end */ |
| 9233 | }; |
| 9234 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9235 | static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9236 | /* Output mixers */ |
| 9237 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9238 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9239 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9240 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9241 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9242 | HDA_OUTPUT), |
| 9243 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9244 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9245 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9246 | /* Output switches */ |
| 9247 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9248 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9249 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9250 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9251 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9252 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9253 | /* Input mixers */ |
| 9254 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9256 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9257 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9258 | { } /* end */ |
| 9259 | }; |
| 9260 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9261 | static const struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9263 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9264 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9265 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9266 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9267 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9268 | { } /* end */ |
| 9269 | }; |
| 9270 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9271 | static const struct hda_bind_ctls alc883_bind_cap_vol = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9272 | .ops = &snd_hda_bind_vol, |
| 9273 | .values = { |
| 9274 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9275 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9276 | 0 |
| 9277 | }, |
| 9278 | }; |
| 9279 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9280 | static const struct hda_bind_ctls alc883_bind_cap_switch = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9281 | .ops = &snd_hda_bind_sw, |
| 9282 | .values = { |
| 9283 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9284 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9285 | 0 |
| 9286 | }, |
| 9287 | }; |
| 9288 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9289 | static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9291 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9292 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9293 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9294 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9296 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9298 | { } /* end */ |
| 9299 | }; |
| 9300 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9301 | static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9302 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9303 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9304 | { |
| 9305 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9306 | /* .name = "Capture Source", */ |
| 9307 | .name = "Input Source", |
| 9308 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9309 | .info = alc_mux_enum_info, |
| 9310 | .get = alc_mux_enum_get, |
| 9311 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9312 | }, |
| 9313 | { } /* end */ |
| 9314 | }; |
| 9315 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9316 | static const struct snd_kcontrol_new alc883_chmode_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9317 | { |
| 9318 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9319 | .name = "Channel Mode", |
| 9320 | .info = alc_ch_mode_info, |
| 9321 | .get = alc_ch_mode_get, |
| 9322 | .put = alc_ch_mode_put, |
| 9323 | }, |
| 9324 | { } /* end */ |
| 9325 | }; |
| 9326 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9327 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9328 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9329 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9330 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9331 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9332 | spec->autocfg.hp_pins[0] = 0x15; |
| 9333 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9334 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9335 | spec->automute = 1; |
| 9336 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9337 | } |
| 9338 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9339 | static const struct hda_verb alc883_mitac_verbs[] = { |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9340 | /* HP */ |
| 9341 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9343 | /* Subwoofer */ |
| 9344 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9345 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9346 | |
| 9347 | /* enable unsolicited event */ |
| 9348 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9349 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9350 | |
| 9351 | { } /* end */ |
| 9352 | }; |
| 9353 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9354 | static const struct hda_verb alc883_clevo_m540r_verbs[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9355 | /* HP */ |
| 9356 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9357 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9358 | /* Int speaker */ |
| 9359 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9360 | |
| 9361 | /* enable unsolicited event */ |
| 9362 | /* |
| 9363 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9364 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9365 | */ |
| 9366 | |
| 9367 | { } /* end */ |
| 9368 | }; |
| 9369 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9370 | static const struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9371 | /* HP */ |
| 9372 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9373 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9374 | /* Int speaker */ |
| 9375 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9377 | |
| 9378 | /* enable unsolicited event */ |
| 9379 | {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] | 9380 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9381 | |
| 9382 | { } /* end */ |
| 9383 | }; |
| 9384 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9385 | static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9386 | /* HP */ |
| 9387 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9388 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9389 | /* Subwoofer */ |
| 9390 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9392 | |
| 9393 | /* enable unsolicited event */ |
| 9394 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9395 | |
| 9396 | { } /* end */ |
| 9397 | }; |
| 9398 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9399 | static const struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9400 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9401 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9402 | |
| 9403 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9404 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9405 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9406 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9407 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9408 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9409 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9410 | /* Connect Mic jack to CLFE */ |
| 9411 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9412 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9413 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9414 | /* Connect Line-in jack to Surround */ |
| 9415 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9416 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9417 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9418 | /* Connect HP out jack to Front */ |
| 9419 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9420 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9421 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9422 | |
| 9423 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9424 | |
| 9425 | { } /* end */ |
| 9426 | }; |
| 9427 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9428 | static const struct hda_verb alc883_lenovo_101e_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9429 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9430 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9431 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9432 | { } /* end */ |
| 9433 | }; |
| 9434 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9435 | static const struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9436 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9437 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9438 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9439 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9440 | { } /* end */ |
| 9441 | }; |
| 9442 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9443 | static const struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9444 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9446 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9447 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9448 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9449 | { } /* end */ |
| 9450 | }; |
| 9451 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9452 | static const struct hda_verb alc883_haier_w66_verbs[] = { |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9453 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9454 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9455 | |
| 9456 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9457 | |
| 9458 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9459 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9460 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9461 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9462 | { } /* end */ |
| 9463 | }; |
| 9464 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9465 | static const struct hda_verb alc888_lenovo_sky_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9466 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9467 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9470 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9471 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9472 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9473 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9474 | { } /* end */ |
| 9475 | }; |
| 9476 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9477 | static const struct hda_verb alc888_6st_dell_verbs[] = { |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9478 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9479 | { } |
| 9480 | }; |
| 9481 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9482 | static const struct hda_verb alc883_vaiott_verbs[] = { |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9483 | /* HP */ |
| 9484 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9485 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9486 | |
| 9487 | /* enable unsolicited event */ |
| 9488 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9489 | |
| 9490 | { } /* end */ |
| 9491 | }; |
| 9492 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9493 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9494 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9495 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9496 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9497 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9498 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9499 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9500 | spec->autocfg.speaker_pins[2] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9501 | spec->automute = 1; |
| 9502 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9503 | } |
| 9504 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9505 | static const struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9506 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9507 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9508 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9509 | {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] | 9510 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9511 | }; |
| 9512 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9513 | /* |
| 9514 | * 2ch mode |
| 9515 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9516 | static const struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9517 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9518 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9519 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9520 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9521 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9522 | }; |
| 9523 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9524 | /* |
| 9525 | * 4ch mode |
| 9526 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9527 | static const struct hda_verb alc888_3st_hp_4ch_init[] = { |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9528 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9529 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9530 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9531 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9532 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9533 | { } /* end */ |
| 9534 | }; |
| 9535 | |
| 9536 | /* |
| 9537 | * 6ch mode |
| 9538 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9539 | static const struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9540 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9541 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9542 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9543 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9544 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9545 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9546 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9547 | }; |
| 9548 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9549 | static const struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9550 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9551 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9552 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9553 | }; |
| 9554 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9555 | static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9556 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9557 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9558 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9559 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9560 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9561 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9562 | spec->automute = 1; |
| 9563 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9564 | } |
| 9565 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9566 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9567 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9568 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9569 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9570 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9571 | spec->autocfg.hp_pins[0] = 0x14; |
| 9572 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9573 | spec->automute = 1; |
| 9574 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9575 | } |
| 9576 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9577 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9578 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9579 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9580 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9581 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9582 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9583 | struct alc_spec *spec = codec->spec; |
| 9584 | |
| 9585 | spec->autocfg.hp_pins[0] = 0x15; |
| 9586 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9587 | spec->automute = 1; |
| 9588 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9589 | } |
| 9590 | |
| 9591 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9592 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9593 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9594 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9595 | } |
| 9596 | |
| 9597 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9598 | unsigned int res) |
| 9599 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9600 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9601 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9602 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9603 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9604 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9605 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9606 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9607 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9608 | } |
| 9609 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9610 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9611 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9612 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9613 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9614 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9615 | spec->autocfg.hp_pins[0] = 0x14; |
| 9616 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9617 | spec->automute = 1; |
| 9618 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9619 | } |
| 9620 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9621 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9622 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9623 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9624 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9625 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9626 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9627 | spec->automute = 1; |
| 9628 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9629 | } |
| 9630 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9631 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9632 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9633 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9634 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9635 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9636 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9637 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9638 | spec->automute = 1; |
| 9639 | spec->detect_line = 1; |
| 9640 | spec->automute_lines = 1; |
| 9641 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9642 | } |
| 9643 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9644 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9645 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9646 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9647 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9648 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9649 | spec->autocfg.hp_pins[0] = 0x14; |
| 9650 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9651 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9652 | spec->automute = 1; |
| 9653 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9654 | } |
| 9655 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9656 | static const struct hda_verb alc883_acer_eapd_verbs[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9657 | /* HP Pin: output 0 (0x0c) */ |
| 9658 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9659 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9660 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9661 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9662 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9663 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9664 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9665 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9666 | /* eanable EAPD on medion laptop */ |
| 9667 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9668 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9669 | /* enable unsolicited event */ |
| 9670 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9671 | { } |
| 9672 | }; |
| 9673 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9674 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9675 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9676 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9677 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9678 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9679 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9680 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9681 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9682 | spec->autocfg.speaker_pins[3] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9683 | spec->automute = 1; |
| 9684 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9685 | } |
| 9686 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9687 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9688 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9689 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9690 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9691 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9692 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9693 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9694 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9695 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9696 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9697 | spec->automute = 1; |
| 9698 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9699 | } |
| 9700 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9701 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9702 | { |
| 9703 | struct alc_spec *spec = codec->spec; |
| 9704 | |
| 9705 | spec->autocfg.hp_pins[0] = 0x15; |
| 9706 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9707 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9708 | spec->automute = 1; |
| 9709 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9710 | } |
| 9711 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9712 | static const struct hda_verb alc888_asus_m90v_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9714 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9715 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9716 | /* enable unsolicited event */ |
| 9717 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9718 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9719 | { } /* end */ |
| 9720 | }; |
| 9721 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9722 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9723 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9724 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9725 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9726 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9727 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9728 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9729 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9730 | spec->ext_mic.pin = 0x18; |
| 9731 | spec->int_mic.pin = 0x19; |
| 9732 | spec->ext_mic.mux_idx = 0; |
| 9733 | spec->int_mic.mux_idx = 1; |
| 9734 | spec->auto_mic = 1; |
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 | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9737 | } |
| 9738 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9739 | static const struct hda_verb alc888_asus_eee1601_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9740 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9741 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9742 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9743 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9744 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9745 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9746 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9747 | /* enable unsolicited event */ |
| 9748 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9749 | { } /* end */ |
| 9750 | }; |
| 9751 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9752 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9753 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9754 | struct alc_spec *spec = codec->spec; |
| 9755 | |
| 9756 | spec->autocfg.hp_pins[0] = 0x14; |
| 9757 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9758 | alc_hp_automute(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9759 | } |
| 9760 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9761 | static const struct hda_verb alc889A_mb31_verbs[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9762 | /* Init rear pin (used as headphone output) */ |
| 9763 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9764 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9765 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9766 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9767 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9768 | /* Init line 2 pin (used as headphone out by default) */ |
| 9769 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9770 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9771 | { } /* end */ |
| 9772 | }; |
| 9773 | |
| 9774 | /* Mute speakers according to the headphone jack state */ |
| 9775 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9776 | { |
| 9777 | unsigned int present; |
| 9778 | |
| 9779 | /* Mute only in 2ch or 4ch mode */ |
| 9780 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9781 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9782 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9783 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9784 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9785 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9786 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9787 | } |
| 9788 | } |
| 9789 | |
| 9790 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9791 | { |
| 9792 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9793 | alc889A_mb31_automute(codec); |
| 9794 | } |
| 9795 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9796 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9797 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9798 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9799 | #endif |
| 9800 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9801 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9802 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9803 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9804 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9805 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9806 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9807 | static const hda_nid_t alc883_slave_dig_outs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9808 | ALC1200_DIGOUT_NID, 0, |
| 9809 | }; |
| 9810 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9811 | static const hda_nid_t alc1200_slave_dig_outs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9812 | ALC883_DIGOUT_NID, 0, |
| 9813 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9814 | |
| 9815 | /* |
| 9816 | * configuration and preset |
| 9817 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9818 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9819 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9820 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9821 | [ALC882_ARIMA] = "arima", |
| 9822 | [ALC882_W2JC] = "w2jc", |
| 9823 | [ALC882_TARGA] = "targa", |
| 9824 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9825 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9826 | [ALC885_MACPRO] = "macpro", |
| 9827 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9828 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9829 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9830 | [ALC885_MBP3] = "mbp3", |
| 9831 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9832 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9833 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9834 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9835 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9836 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9837 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9838 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9839 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9840 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9841 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9842 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9843 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9844 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9845 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9846 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9847 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9848 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9849 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9850 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9851 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9852 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9853 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9854 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9855 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9856 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9857 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9858 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9859 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9860 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9861 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9862 | [ALC889A_INTEL] = "intel-alc889a", |
| 9863 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9864 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9865 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9866 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9867 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9868 | }; |
| 9869 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9870 | static const struct snd_pci_quirk alc882_cfg_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9871 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9872 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9874 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9875 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9876 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9877 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9878 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9879 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9880 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9881 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9882 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9883 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9884 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9885 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9886 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9887 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9888 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9889 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9890 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9891 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9892 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9894 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9895 | /* default Acer -- disabled as it causes more problems. |
| 9896 | * model=auto should work fine now |
| 9897 | */ |
| 9898 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9899 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9901 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 9902 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9903 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9904 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9905 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9906 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9907 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9908 | |
| 9909 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9910 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9911 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9912 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9913 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9914 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9915 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9916 | 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] | 9917 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9918 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9919 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9920 | |
| 9921 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9922 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9923 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9924 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9926 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9927 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9928 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | ebb4724 | 2011-05-02 10:37:29 +0200 | [diff] [blame] | 9929 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9930 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9931 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9932 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9933 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9934 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9935 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9936 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9937 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9938 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9939 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9940 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9941 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9942 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9943 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9944 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9945 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9946 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9947 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9948 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9950 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9951 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9952 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9953 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9954 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9955 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9956 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9957 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9958 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9959 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9960 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9961 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9962 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9963 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9964 | 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] | 9965 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9966 | 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] | 9967 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9968 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9969 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9970 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9971 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9972 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9973 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9974 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9975 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9976 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9977 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9979 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9980 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9981 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9982 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9983 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9984 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9985 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9986 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9987 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9988 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9989 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9990 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9991 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9992 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9993 | {} |
| 9994 | }; |
| 9995 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9996 | /* codec SSID table for Intel Mac */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9997 | static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9998 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9999 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 10000 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 10001 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 10002 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 10003 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 10004 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 10005 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 10006 | 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] | 10007 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 10008 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10009 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10010 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10011 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10012 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10013 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10014 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10015 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10016 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10017 | */ |
| 10018 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10019 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10020 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10021 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10022 | }; |
| 10023 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10024 | static const struct alc_config_preset alc882_presets[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10025 | [ALC882_3ST_DIG] = { |
| 10026 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10027 | .init_verbs = { alc882_base_init_verbs, |
| 10028 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10029 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10030 | .dac_nids = alc882_dac_nids, |
| 10031 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10032 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10033 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10034 | .channel_mode = alc882_ch_modes, |
| 10035 | .need_dac_fix = 1, |
| 10036 | .input_mux = &alc882_capture_source, |
| 10037 | }, |
| 10038 | [ALC882_6ST_DIG] = { |
| 10039 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10040 | .init_verbs = { alc882_base_init_verbs, |
| 10041 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10042 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10043 | .dac_nids = alc882_dac_nids, |
| 10044 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10045 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10046 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10047 | .channel_mode = alc882_sixstack_modes, |
| 10048 | .input_mux = &alc882_capture_source, |
| 10049 | }, |
| 10050 | [ALC882_ARIMA] = { |
| 10051 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10052 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10053 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10054 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10055 | .dac_nids = alc882_dac_nids, |
| 10056 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10057 | .channel_mode = alc882_sixstack_modes, |
| 10058 | .input_mux = &alc882_capture_source, |
| 10059 | }, |
| 10060 | [ALC882_W2JC] = { |
| 10061 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10062 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10063 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10064 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10065 | .dac_nids = alc882_dac_nids, |
| 10066 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10067 | .channel_mode = alc880_threestack_modes, |
| 10068 | .need_dac_fix = 1, |
| 10069 | .input_mux = &alc882_capture_source, |
| 10070 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10071 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10072 | [ALC885_MBA21] = { |
| 10073 | .mixers = { alc885_mba21_mixer }, |
| 10074 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10075 | .num_dacs = 2, |
| 10076 | .dac_nids = alc882_dac_nids, |
| 10077 | .channel_mode = alc885_mba21_ch_modes, |
| 10078 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10079 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10080 | .unsol_event = alc_sku_unsol_event, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10081 | .setup = alc885_mba21_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10082 | .init_hook = alc_hp_automute, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10083 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10084 | [ALC885_MBP3] = { |
| 10085 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10086 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10087 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10088 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10089 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10090 | .hp_nid = 0x04, |
| 10091 | .channel_mode = alc885_mbp_4ch_modes, |
| 10092 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10093 | .input_mux = &alc882_capture_source, |
| 10094 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10095 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10096 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10097 | .setup = alc885_mbp3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10098 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10099 | }, |
| 10100 | [ALC885_MB5] = { |
| 10101 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10102 | .init_verbs = { alc885_mb5_init_verbs, |
| 10103 | alc880_gpio1_init_verbs }, |
| 10104 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10105 | .dac_nids = alc882_dac_nids, |
| 10106 | .channel_mode = alc885_mb5_6ch_modes, |
| 10107 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10108 | .input_mux = &mb5_capture_source, |
| 10109 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10110 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10111 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10112 | .setup = alc885_mb5_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10113 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10114 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10115 | [ALC885_MACMINI3] = { |
| 10116 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10117 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10118 | alc880_gpio1_init_verbs }, |
| 10119 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10120 | .dac_nids = alc882_dac_nids, |
| 10121 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10122 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10123 | .input_mux = &macmini3_capture_source, |
| 10124 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10125 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10126 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10127 | .setup = alc885_macmini3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10128 | .init_hook = alc_hp_automute, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10129 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10130 | [ALC885_MACPRO] = { |
| 10131 | .mixers = { alc882_macpro_mixer }, |
| 10132 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10133 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10134 | .dac_nids = alc882_dac_nids, |
| 10135 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10136 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10137 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10138 | .channel_mode = alc882_ch_modes, |
| 10139 | .input_mux = &alc882_capture_source, |
| 10140 | .init_hook = alc885_macpro_init_hook, |
| 10141 | }, |
| 10142 | [ALC885_IMAC24] = { |
| 10143 | .mixers = { alc885_imac24_mixer }, |
| 10144 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10145 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10146 | .dac_nids = alc882_dac_nids, |
| 10147 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10148 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10149 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10150 | .channel_mode = alc882_ch_modes, |
| 10151 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10152 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10153 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10154 | .init_hook = alc885_imac24_init_hook, |
| 10155 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10156 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10157 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10158 | .init_verbs = { alc885_imac91_init_verbs, |
| 10159 | alc880_gpio1_init_verbs }, |
| 10160 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10161 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10162 | .channel_mode = alc885_mba21_ch_modes, |
| 10163 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10164 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10165 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10166 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10167 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10168 | .setup = alc885_imac91_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10169 | .init_hook = alc_hp_automute, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10170 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10171 | [ALC882_TARGA] = { |
| 10172 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10173 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10174 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10175 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10176 | .dac_nids = alc882_dac_nids, |
| 10177 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10178 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10179 | .adc_nids = alc882_adc_nids, |
| 10180 | .capsrc_nids = alc882_capsrc_nids, |
| 10181 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10182 | .channel_mode = alc882_3ST_6ch_modes, |
| 10183 | .need_dac_fix = 1, |
| 10184 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10185 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10186 | .setup = alc882_targa_setup, |
| 10187 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10188 | }, |
| 10189 | [ALC882_ASUS_A7J] = { |
| 10190 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10191 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10192 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10193 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10194 | .dac_nids = alc882_dac_nids, |
| 10195 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10196 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10197 | .adc_nids = alc882_adc_nids, |
| 10198 | .capsrc_nids = alc882_capsrc_nids, |
| 10199 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10200 | .channel_mode = alc882_3ST_6ch_modes, |
| 10201 | .need_dac_fix = 1, |
| 10202 | .input_mux = &alc882_capture_source, |
| 10203 | }, |
| 10204 | [ALC882_ASUS_A7M] = { |
| 10205 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10206 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10207 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10208 | alc882_asus_a7m_verbs }, |
| 10209 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10210 | .dac_nids = alc882_dac_nids, |
| 10211 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10212 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10213 | .channel_mode = alc880_threestack_modes, |
| 10214 | .need_dac_fix = 1, |
| 10215 | .input_mux = &alc882_capture_source, |
| 10216 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10217 | [ALC883_3ST_2ch_DIG] = { |
| 10218 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10219 | .init_verbs = { alc883_init_verbs }, |
| 10220 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10221 | .dac_nids = alc883_dac_nids, |
| 10222 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10223 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10224 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10225 | .channel_mode = alc883_3ST_2ch_modes, |
| 10226 | .input_mux = &alc883_capture_source, |
| 10227 | }, |
| 10228 | [ALC883_3ST_6ch_DIG] = { |
| 10229 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10230 | .init_verbs = { alc883_init_verbs }, |
| 10231 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10232 | .dac_nids = alc883_dac_nids, |
| 10233 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10234 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10235 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10236 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10237 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10238 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10239 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10240 | [ALC883_3ST_6ch] = { |
| 10241 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10242 | .init_verbs = { alc883_init_verbs }, |
| 10243 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10244 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10245 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10246 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10247 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10248 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10249 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10250 | [ALC883_3ST_6ch_INTEL] = { |
| 10251 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10252 | .init_verbs = { alc883_init_verbs }, |
| 10253 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10254 | .dac_nids = alc883_dac_nids, |
| 10255 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10256 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10257 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10258 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10259 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10260 | .need_dac_fix = 1, |
| 10261 | .input_mux = &alc883_3stack_6ch_intel, |
| 10262 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10263 | [ALC889A_INTEL] = { |
| 10264 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10265 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10266 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10267 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10268 | .dac_nids = alc883_dac_nids, |
| 10269 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10270 | .adc_nids = alc889_adc_nids, |
| 10271 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10272 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10273 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10274 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10275 | .channel_mode = alc889_8ch_intel_modes, |
| 10276 | .capsrc_nids = alc889_capsrc_nids, |
| 10277 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10278 | .setup = alc889_automute_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10279 | .init_hook = alc_hp_automute, |
| 10280 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10281 | .need_dac_fix = 1, |
| 10282 | }, |
| 10283 | [ALC889_INTEL] = { |
| 10284 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10285 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10286 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10287 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10288 | .dac_nids = alc883_dac_nids, |
| 10289 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10290 | .adc_nids = alc889_adc_nids, |
| 10291 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10292 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10293 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10294 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10295 | .channel_mode = alc889_8ch_intel_modes, |
| 10296 | .capsrc_nids = alc889_capsrc_nids, |
| 10297 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10298 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10299 | .init_hook = alc889_intel_init_hook, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10300 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10301 | .need_dac_fix = 1, |
| 10302 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10303 | [ALC883_6ST_DIG] = { |
| 10304 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10305 | .init_verbs = { alc883_init_verbs }, |
| 10306 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10307 | .dac_nids = alc883_dac_nids, |
| 10308 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10309 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10310 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10311 | .channel_mode = alc883_sixstack_modes, |
| 10312 | .input_mux = &alc883_capture_source, |
| 10313 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10314 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10315 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10316 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10317 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10318 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10319 | .dac_nids = alc883_dac_nids, |
| 10320 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10321 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10322 | .channel_mode = alc883_3ST_6ch_modes, |
| 10323 | .need_dac_fix = 1, |
| 10324 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10325 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10326 | .setup = alc882_targa_setup, |
| 10327 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10328 | }, |
| 10329 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10330 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10331 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10332 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10333 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10334 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10335 | .adc_nids = alc883_adc_nids_alt, |
| 10336 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10337 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10338 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10339 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10340 | .channel_mode = alc883_3ST_2ch_modes, |
| 10341 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10342 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10343 | .setup = alc882_targa_setup, |
| 10344 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10345 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10346 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10347 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10348 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10349 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10350 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10351 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10352 | .dac_nids = alc883_dac_nids, |
| 10353 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10354 | .adc_nids = alc883_adc_nids_rev, |
| 10355 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10356 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10357 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10358 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10359 | .channel_mode = alc883_4ST_8ch_modes, |
| 10360 | .need_dac_fix = 1, |
| 10361 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10362 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10363 | .setup = alc882_targa_setup, |
| 10364 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10365 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10366 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10367 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10368 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10369 | * and the headphone jack. Turn this on and rely on the |
| 10370 | * standard mute methods whenever the user wants to turn |
| 10371 | * these outputs off. |
| 10372 | */ |
| 10373 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10375 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10376 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10377 | .channel_mode = alc883_3ST_2ch_modes, |
| 10378 | .input_mux = &alc883_capture_source, |
| 10379 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10380 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10381 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10382 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10383 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10384 | .dac_nids = alc883_dac_nids, |
| 10385 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10386 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10387 | .channel_mode = alc883_3ST_2ch_modes, |
| 10388 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10389 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10390 | .setup = alc883_acer_aspire_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10391 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10392 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10393 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10394 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10395 | alc883_chmode_mixer }, |
| 10396 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10397 | alc888_acer_aspire_4930g_verbs }, |
| 10398 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10399 | .dac_nids = alc883_dac_nids, |
| 10400 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10401 | .adc_nids = alc883_adc_nids_rev, |
| 10402 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10403 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10404 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10405 | .channel_mode = alc883_3ST_6ch_modes, |
| 10406 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10407 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10408 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10409 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10410 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10411 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10412 | .setup = alc888_acer_aspire_4930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10413 | .init_hook = alc_hp_automute, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10414 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10415 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10416 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10417 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10418 | alc888_acer_aspire_6530g_verbs }, |
| 10419 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10420 | .dac_nids = alc883_dac_nids, |
| 10421 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10422 | .adc_nids = alc883_adc_nids_rev, |
| 10423 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10424 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10425 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10426 | .channel_mode = alc883_3ST_2ch_modes, |
| 10427 | .num_mux_defs = |
| 10428 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10429 | .input_mux = alc888_acer_aspire_6530_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10430 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10431 | .setup = alc888_acer_aspire_6530g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10432 | .init_hook = alc_hp_automute, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10433 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10434 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10435 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10436 | alc883_chmode_mixer }, |
| 10437 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10438 | alc889_acer_aspire_8930g_verbs, |
| 10439 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10440 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10441 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10442 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10443 | .adc_nids = alc889_adc_nids, |
| 10444 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10445 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10446 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10447 | .channel_mode = alc883_3ST_6ch_modes, |
| 10448 | .need_dac_fix = 1, |
| 10449 | .const_channel_count = 6, |
| 10450 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10451 | ARRAY_SIZE(alc889_capture_sources), |
| 10452 | .input_mux = alc889_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10453 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10454 | .setup = alc889_acer_aspire_8930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10455 | .init_hook = alc_hp_automute, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10456 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10457 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10458 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10459 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10460 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10461 | .mixers = { alc883_3ST_6ch_mixer, |
| 10462 | alc883_chmode_mixer }, |
| 10463 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10464 | alc888_acer_aspire_7730G_verbs }, |
| 10465 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10466 | .dac_nids = alc883_dac_nids, |
| 10467 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10468 | .adc_nids = alc883_adc_nids_rev, |
| 10469 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10470 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10471 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10472 | .channel_mode = alc883_3ST_6ch_modes, |
| 10473 | .need_dac_fix = 1, |
| 10474 | .const_channel_count = 6, |
| 10475 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10476 | .unsol_event = alc_sku_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10477 | .setup = alc888_acer_aspire_7730g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10478 | .init_hook = alc_hp_automute, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10479 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10480 | [ALC883_MEDION] = { |
| 10481 | .mixers = { alc883_fivestack_mixer, |
| 10482 | alc883_chmode_mixer }, |
| 10483 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10484 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10485 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10486 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10487 | .adc_nids = alc883_adc_nids_alt, |
| 10488 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10489 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10490 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10491 | .channel_mode = alc883_sixstack_modes, |
| 10492 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10493 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10494 | [ALC883_MEDION_WIM2160] = { |
| 10495 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10496 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10497 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10498 | .dac_nids = alc883_dac_nids, |
| 10499 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10500 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10501 | .adc_nids = alc883_adc_nids, |
| 10502 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10503 | .channel_mode = alc883_3ST_2ch_modes, |
| 10504 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10505 | .unsol_event = alc_sku_unsol_event, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10506 | .setup = alc883_medion_wim2160_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10507 | .init_hook = alc_hp_automute, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10508 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10509 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10510 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10511 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10512 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10513 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10514 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10515 | .channel_mode = alc883_3ST_2ch_modes, |
| 10516 | .input_mux = &alc883_capture_source, |
| 10517 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10518 | [ALC883_CLEVO_M540R] = { |
| 10519 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10520 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10521 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10522 | .dac_nids = alc883_dac_nids, |
| 10523 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10524 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10525 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10526 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10527 | .need_dac_fix = 1, |
| 10528 | .input_mux = &alc883_capture_source, |
| 10529 | /* This machine has the hardware HP auto-muting, thus |
| 10530 | * we need no software mute via unsol event |
| 10531 | */ |
| 10532 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10533 | [ALC883_CLEVO_M720] = { |
| 10534 | .mixers = { alc883_clevo_m720_mixer }, |
| 10535 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10536 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10537 | .dac_nids = alc883_dac_nids, |
| 10538 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10539 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10540 | .channel_mode = alc883_3ST_2ch_modes, |
| 10541 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10542 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10543 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10544 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10545 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10546 | [ALC883_LENOVO_101E_2ch] = { |
| 10547 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10548 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10549 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10550 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10551 | .adc_nids = alc883_adc_nids_alt, |
| 10552 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10553 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10554 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10555 | .channel_mode = alc883_3ST_2ch_modes, |
| 10556 | .input_mux = &alc883_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10557 | .setup = alc883_lenovo_101e_setup, |
| 10558 | .unsol_event = alc_sku_unsol_event, |
| 10559 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10560 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10561 | [ALC883_LENOVO_NB0763] = { |
| 10562 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10563 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10564 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10565 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10566 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10567 | .channel_mode = alc883_3ST_2ch_modes, |
| 10568 | .need_dac_fix = 1, |
| 10569 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10570 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10571 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10572 | .init_hook = alc_hp_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10573 | }, |
| 10574 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10575 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10576 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10577 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10578 | .dac_nids = alc883_dac_nids, |
| 10579 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10580 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10581 | .channel_mode = alc883_3ST_6ch_modes, |
| 10582 | .need_dac_fix = 1, |
| 10583 | .input_mux = &alc883_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10584 | .unsol_event = alc_sku_unsol_event, |
| 10585 | .setup = alc888_lenovo_ms7195_setup, |
| 10586 | .init_hook = alc_inithook, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10587 | }, |
| 10588 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10589 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10590 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10591 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10592 | .dac_nids = alc883_dac_nids, |
| 10593 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10594 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10595 | .channel_mode = alc883_3ST_2ch_modes, |
| 10596 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10597 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10598 | .setup = alc883_haier_w66_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10599 | .init_hook = alc_hp_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10600 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10601 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10602 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10603 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10604 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10605 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10606 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10607 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10608 | .need_dac_fix = 1, |
| 10609 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10610 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10611 | .setup = alc888_3st_hp_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10612 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10613 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10614 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10615 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10616 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10617 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10618 | .dac_nids = alc883_dac_nids, |
| 10619 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10620 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10621 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10622 | .channel_mode = alc883_sixstack_modes, |
| 10623 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10624 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10625 | .setup = alc888_6st_dell_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10626 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10627 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10628 | [ALC883_MITAC] = { |
| 10629 | .mixers = { alc883_mitac_mixer }, |
| 10630 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10631 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10632 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10633 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10634 | .channel_mode = alc883_3ST_2ch_modes, |
| 10635 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10636 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10637 | .setup = alc883_mitac_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10638 | .init_hook = alc_hp_automute, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10639 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10640 | [ALC883_FUJITSU_PI2515] = { |
| 10641 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10642 | .init_verbs = { alc883_init_verbs, |
| 10643 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10644 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10645 | .dac_nids = alc883_dac_nids, |
| 10646 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10647 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10648 | .channel_mode = alc883_3ST_2ch_modes, |
| 10649 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10650 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10651 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10652 | .init_hook = alc_hp_automute, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10653 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10654 | [ALC888_FUJITSU_XA3530] = { |
| 10655 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10656 | .init_verbs = { alc883_init_verbs, |
| 10657 | alc888_fujitsu_xa3530_verbs }, |
| 10658 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10659 | .dac_nids = alc883_dac_nids, |
| 10660 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10661 | .adc_nids = alc883_adc_nids_rev, |
| 10662 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10663 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10664 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10665 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10666 | .num_mux_defs = |
| 10667 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10668 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10669 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10670 | .setup = alc888_fujitsu_xa3530_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10671 | .init_hook = alc_hp_automute, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10672 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10673 | [ALC888_LENOVO_SKY] = { |
| 10674 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10675 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10676 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10677 | .dac_nids = alc883_dac_nids, |
| 10678 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10679 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10680 | .channel_mode = alc883_sixstack_modes, |
| 10681 | .need_dac_fix = 1, |
| 10682 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10683 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10684 | .setup = alc888_lenovo_sky_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10685 | .init_hook = alc_hp_automute, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10686 | }, |
| 10687 | [ALC888_ASUS_M90V] = { |
| 10688 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10689 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10690 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10691 | .dac_nids = alc883_dac_nids, |
| 10692 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10693 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10694 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10695 | .channel_mode = alc883_3ST_6ch_modes, |
| 10696 | .need_dac_fix = 1, |
| 10697 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10698 | .unsol_event = alc_sku_unsol_event, |
| 10699 | .setup = alc883_mode2_setup, |
| 10700 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10701 | }, |
| 10702 | [ALC888_ASUS_EEE1601] = { |
| 10703 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10704 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10705 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10706 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10707 | .dac_nids = alc883_dac_nids, |
| 10708 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10709 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10710 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10711 | .channel_mode = alc883_3ST_2ch_modes, |
| 10712 | .need_dac_fix = 1, |
| 10713 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10714 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10715 | .init_hook = alc883_eee1601_inithook, |
| 10716 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10717 | [ALC1200_ASUS_P5Q] = { |
| 10718 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10719 | .init_verbs = { alc883_init_verbs }, |
| 10720 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10721 | .dac_nids = alc883_dac_nids, |
| 10722 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10723 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10724 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10725 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10726 | .channel_mode = alc883_sixstack_modes, |
| 10727 | .input_mux = &alc883_capture_source, |
| 10728 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10729 | [ALC889A_MB31] = { |
| 10730 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10731 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10732 | alc880_gpio1_init_verbs }, |
| 10733 | .adc_nids = alc883_adc_nids, |
| 10734 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10735 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10736 | .dac_nids = alc883_dac_nids, |
| 10737 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10738 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10739 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10740 | .input_mux = &alc889A_mb31_capture_source, |
| 10741 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10742 | .unsol_event = alc889A_mb31_unsol_event, |
| 10743 | .init_hook = alc889A_mb31_automute, |
| 10744 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10745 | [ALC883_SONY_VAIO_TT] = { |
| 10746 | .mixers = { alc883_vaiott_mixer }, |
| 10747 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10748 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10749 | .dac_nids = alc883_dac_nids, |
| 10750 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10751 | .channel_mode = alc883_3ST_2ch_modes, |
| 10752 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10753 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10754 | .setup = alc883_vaiott_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10755 | .init_hook = alc_hp_automute, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10756 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10757 | }; |
| 10758 | |
| 10759 | |
| 10760 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10761 | * Pin config fixes |
| 10762 | */ |
| 10763 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10764 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10765 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10766 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10767 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10768 | }; |
| 10769 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10770 | static const struct alc_fixup alc882_fixups[] = { |
| 10771 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10772 | .type = ALC_FIXUP_PINS, |
| 10773 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10774 | { 0x15, 0x01080104 }, /* side */ |
| 10775 | { 0x16, 0x01011012 }, /* rear */ |
| 10776 | { 0x17, 0x01016011 }, /* clfe */ |
| 10777 | { } |
| 10778 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10779 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10780 | [PINFIX_LENOVO_Y530] = { |
| 10781 | .type = ALC_FIXUP_PINS, |
| 10782 | .v.pins = (const struct alc_pincfg[]) { |
| 10783 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10784 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10785 | { } |
| 10786 | } |
| 10787 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10788 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10789 | .type = ALC_FIXUP_VERBS, |
| 10790 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10791 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10792 | {} |
| 10793 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10794 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10795 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10796 | .type = ALC_FIXUP_SKU, |
| 10797 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10798 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10799 | }; |
| 10800 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10801 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10802 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10803 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10804 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10805 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10806 | {} |
| 10807 | }; |
| 10808 | |
| 10809 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10810 | * BIOS auto configuration |
| 10811 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10812 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10813 | { |
| 10814 | struct alc_spec *spec = codec->spec; |
| 10815 | int c; |
| 10816 | |
| 10817 | for (c = 0; c < spec->num_adc_nids; c++) { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10818 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10819 | unsigned int mux_idx; |
| 10820 | const struct hda_input_mux *imux; |
| 10821 | int conns, mute, idx, item; |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 10822 | unsigned int wid_type; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10823 | |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 10824 | /* mute ADC */ |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 10825 | if (query_amp_caps(codec, spec->adc_nids[c], HDA_INPUT) & |
| 10826 | AC_AMPCAP_MUTE) |
| 10827 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 10828 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10829 | AMP_IN_MUTE(0)); |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 10830 | else if (query_amp_caps(codec, nid, HDA_OUTPUT) & |
| 10831 | AC_AMPCAP_MUTE) |
| 10832 | snd_hda_codec_write(codec, nid, 0, |
| 10833 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10834 | AMP_OUT_MUTE); |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 10835 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 10836 | conns = snd_hda_get_conn_list(codec, nid, NULL); |
| 10837 | if (conns <= 0) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10838 | continue; |
| 10839 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10840 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10841 | if (!imux->num_items && mux_idx > 0) |
| 10842 | imux = &spec->input_mux[0]; |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 10843 | wid_type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10844 | for (idx = 0; idx < conns; idx++) { |
| 10845 | /* if the current connection is the selected one, |
| 10846 | * unmute it as default - otherwise mute it |
| 10847 | */ |
| 10848 | mute = AMP_IN_MUTE(idx); |
| 10849 | for (item = 0; item < imux->num_items; item++) { |
| 10850 | if (imux->items[item].index == idx) { |
| 10851 | if (spec->cur_mux[c] == item) |
| 10852 | mute = AMP_IN_UNMUTE(idx); |
| 10853 | break; |
| 10854 | } |
| 10855 | } |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 10856 | /* initialize the mute status if mute-amp is present */ |
| 10857 | if (query_amp_caps(codec, nid, HDA_INPUT) & AC_AMPCAP_MUTE) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10858 | snd_hda_codec_write(codec, nid, 0, |
| 10859 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10860 | mute); |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 10861 | if (wid_type == AC_WID_AUD_SEL && |
| 10862 | mute != AMP_IN_MUTE(idx)) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10863 | snd_hda_codec_write(codec, nid, 0, |
| 10864 | AC_VERB_SET_CONNECT_SEL, |
| 10865 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10866 | } |
| 10867 | } |
| 10868 | } |
| 10869 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10870 | /* add mic boosts if needed */ |
| 10871 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10872 | { |
| 10873 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10874 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10875 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10876 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10877 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10878 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10879 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10880 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10881 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10882 | break; |
| 10883 | nid = cfg->inputs[i].pin; |
| 10884 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10885 | const char *label; |
| 10886 | char boost_label[32]; |
| 10887 | |
| 10888 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10889 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10890 | type_idx++; |
| 10891 | else |
| 10892 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10893 | prev_label = label; |
| 10894 | |
| 10895 | snprintf(boost_label, sizeof(boost_label), |
| 10896 | "%s Boost Volume", label); |
| 10897 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10898 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10899 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10900 | if (err < 0) |
| 10901 | return err; |
| 10902 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10903 | } |
| 10904 | return 0; |
| 10905 | } |
| 10906 | |
| 10907 | /* almost identical with ALC880 parser... */ |
| 10908 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10909 | { |
| 10910 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10911 | static const hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10912 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10913 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10914 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10915 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10916 | if (err < 0) |
| 10917 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10918 | if (!spec->autocfg.line_outs) |
| 10919 | return 0; /* can't find valid BIOS pin config */ |
| 10920 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 10921 | err = alc_auto_fill_dac_nids(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10922 | if (err < 0) |
| 10923 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 10924 | err = alc_auto_add_multi_channel_mode(codec, alc_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 10925 | if (err < 0) |
| 10926 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 10927 | err = alc_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10928 | if (err < 0) |
| 10929 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 10930 | err = alc_auto_create_hp_out(codec); |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10931 | if (err < 0) |
| 10932 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 10933 | err = alc_auto_create_speaker_out(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10934 | if (err < 0) |
| 10935 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 10936 | err = alc_auto_create_input_ctls(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10937 | if (err < 0) |
| 10938 | return err; |
| 10939 | |
| 10940 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10941 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10942 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10943 | |
| 10944 | if (spec->kctls.list) |
| 10945 | add_mixer(spec, spec->kctls.list); |
| 10946 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10947 | spec->num_mux_defs = 1; |
| 10948 | spec->input_mux = &spec->private_imux[0]; |
| 10949 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10950 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10951 | |
| 10952 | err = alc_auto_add_mic_boost(codec); |
| 10953 | if (err < 0) |
| 10954 | return err; |
| 10955 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10956 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10957 | } |
| 10958 | |
| 10959 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10960 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10961 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10962 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 10963 | alc_auto_init_multi_out(codec); |
| 10964 | alc_auto_init_extra_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 10965 | alc_auto_init_analog_input(codec); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10966 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10967 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10968 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10969 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10970 | } |
| 10971 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10972 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10973 | { |
| 10974 | struct alc_spec *spec; |
| 10975 | int err, board_config; |
| 10976 | |
| 10977 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10978 | if (spec == NULL) |
| 10979 | return -ENOMEM; |
| 10980 | |
| 10981 | codec->spec = spec; |
| 10982 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 10983 | spec->mixer_nid = 0x0b; |
| 10984 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10985 | switch (codec->vendor_id) { |
| 10986 | case 0x10ec0882: |
| 10987 | case 0x10ec0885: |
| 10988 | break; |
| 10989 | default: |
| 10990 | /* ALC883 and variants */ |
| 10991 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10992 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10993 | } |
| 10994 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10995 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10996 | alc882_models, |
| 10997 | alc882_cfg_tbl); |
| 10998 | |
| 10999 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11000 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11001 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11002 | |
| 11003 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11004 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11005 | codec->chip_name); |
| 11006 | board_config = ALC882_AUTO; |
| 11007 | } |
| 11008 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11009 | if (board_config == ALC882_AUTO) { |
| 11010 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11011 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11012 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11013 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11014 | alc_auto_parse_customize_define(codec); |
| 11015 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11016 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11017 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11018 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11019 | if (err < 0) { |
| 11020 | alc_free(codec); |
| 11021 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11022 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11023 | printk(KERN_INFO |
| 11024 | "hda_codec: Cannot set up configuration " |
| 11025 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11026 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11027 | } |
| 11028 | } |
| 11029 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11030 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11031 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11032 | if (err < 0) { |
| 11033 | alc_free(codec); |
| 11034 | return err; |
| 11035 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11036 | } |
| 11037 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11038 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11039 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11040 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11041 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11042 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11043 | /* FIXME: setup DAC5 */ |
| 11044 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11045 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11046 | |
| 11047 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11048 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11049 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11050 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11051 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11052 | spec->num_adc_nids = 0; |
| 11053 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11054 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11055 | hda_nid_t cap; |
| 11056 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11057 | unsigned int wcap = get_wcaps(codec, nid); |
| 11058 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11059 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11060 | if (wcap != AC_WID_AUD_IN) |
| 11061 | continue; |
| 11062 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11063 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11064 | if (err < 0) |
| 11065 | continue; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11066 | err = snd_hda_get_conn_list(codec, cap, NULL); |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11067 | if (err < 0) |
| 11068 | continue; |
| 11069 | for (j = 0; j < imux->num_items; j++) |
| 11070 | if (imux->items[j].index >= err) |
| 11071 | break; |
| 11072 | if (j < imux->num_items) |
| 11073 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11074 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11075 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11076 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11077 | spec->adc_nids = spec->private_adc_nids; |
| 11078 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11079 | } |
| 11080 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11081 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11082 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11083 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11084 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11085 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11086 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11087 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11088 | spec->vmaster_nid = 0x0c; |
| 11089 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11090 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11091 | if (board_config == ALC882_AUTO) |
| 11092 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11093 | |
| 11094 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11095 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11096 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11097 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11098 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11099 | |
| 11100 | return 0; |
| 11101 | } |
| 11102 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11103 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11104 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11105 | * ALC262 support |
| 11106 | */ |
| 11107 | |
| 11108 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11109 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11110 | |
| 11111 | #define alc262_dac_nids alc260_dac_nids |
| 11112 | #define alc262_adc_nids alc882_adc_nids |
| 11113 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11114 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11115 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11116 | |
| 11117 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11118 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11119 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11120 | static const hda_nid_t alc262_dmic_adc_nids[1] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11121 | /* ADC0 */ |
| 11122 | 0x09 |
| 11123 | }; |
| 11124 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11125 | static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11126 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11127 | static const struct snd_kcontrol_new alc262_base_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11128 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11129 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11130 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11131 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11132 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11133 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11135 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11136 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11137 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11138 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11139 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11140 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11141 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11142 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11143 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11144 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11145 | }; |
| 11146 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11147 | /* update HP, line and mono-out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11148 | #define alc262_hp_master_update alc260_hp_master_update |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11149 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11150 | static void alc262_hp_bpc_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11151 | { |
| 11152 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11153 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11154 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11155 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11156 | spec->automute = 1; |
| 11157 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11158 | } |
| 11159 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11160 | static void alc262_hp_wildwest_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11161 | { |
| 11162 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11163 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11164 | spec->autocfg.hp_pins[0] = 0x15; |
| 11165 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11166 | spec->automute = 1; |
| 11167 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11168 | } |
| 11169 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11170 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11171 | #define alc262_hp_master_sw_put alc260_hp_master_sw_put |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11172 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11173 | #define ALC262_HP_MASTER_SWITCH \ |
| 11174 | { \ |
| 11175 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11176 | .name = "Master Playback Switch", \ |
| 11177 | .info = snd_ctl_boolean_mono_info, \ |
| 11178 | .get = alc262_hp_master_sw_get, \ |
| 11179 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11180 | }, \ |
| 11181 | { \ |
| 11182 | .iface = NID_MAPPING, \ |
| 11183 | .name = "Master Playback Switch", \ |
| 11184 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11185 | } |
| 11186 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11187 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11188 | static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11189 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11191 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11192 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11193 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11194 | HDA_OUTPUT), |
| 11195 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11196 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11198 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11199 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11200 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11201 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11202 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11203 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11204 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11205 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11206 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11207 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11208 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11209 | { } /* end */ |
| 11210 | }; |
| 11211 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11212 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11213 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11214 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11215 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11216 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11217 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11218 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11219 | HDA_OUTPUT), |
| 11220 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11221 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11222 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11223 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11224 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11225 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11226 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11228 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11229 | { } /* end */ |
| 11230 | }; |
| 11231 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11232 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11233 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11234 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11235 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11236 | { } /* end */ |
| 11237 | }; |
| 11238 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11239 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11240 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11241 | { |
| 11242 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11243 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11244 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11245 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11246 | spec->automute = 1; |
| 11247 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11248 | } |
| 11249 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11250 | static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11251 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11252 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11253 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11256 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11257 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11258 | { } /* end */ |
| 11259 | }; |
| 11260 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11261 | static const struct hda_verb alc262_hp_t5735_verbs[] = { |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11262 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11263 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11264 | |
| 11265 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11266 | { } |
| 11267 | }; |
| 11268 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11269 | static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11270 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11271 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11272 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11273 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11274 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11275 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11276 | { } /* end */ |
| 11277 | }; |
| 11278 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11279 | static const struct hda_verb alc262_hp_rp5700_verbs[] = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11280 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11281 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11282 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11283 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11284 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11285 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11286 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11288 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11290 | {} |
| 11291 | }; |
| 11292 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11293 | static const struct hda_input_mux alc262_hp_rp5700_capture_source = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11294 | .num_items = 1, |
| 11295 | .items = { |
| 11296 | { "Line", 0x1 }, |
| 11297 | }, |
| 11298 | }; |
| 11299 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11300 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11301 | #define alc262_hippo_master_update alc262_hp_master_update |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11302 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11303 | #define alc262_hippo_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11304 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11305 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11306 | { \ |
| 11307 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11308 | .name = "Master Playback Switch", \ |
| 11309 | .info = snd_ctl_boolean_mono_info, \ |
| 11310 | .get = alc262_hippo_master_sw_get, \ |
| 11311 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11312 | }, \ |
| 11313 | { \ |
| 11314 | .iface = NID_MAPPING, \ |
| 11315 | .name = "Master Playback Switch", \ |
| 11316 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11317 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11318 | } |
| 11319 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11320 | static const struct snd_kcontrol_new alc262_hippo_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11321 | ALC262_HIPPO_MASTER_SWITCH, |
| 11322 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11325 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11326 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11328 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11329 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11330 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11331 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11332 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11333 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11334 | { } /* end */ |
| 11335 | }; |
| 11336 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11337 | static const struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11338 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11339 | ALC262_HIPPO_MASTER_SWITCH, |
| 11340 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11341 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11342 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11343 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11344 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11345 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11346 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11347 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11348 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11349 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11350 | { } /* end */ |
| 11351 | }; |
| 11352 | |
| 11353 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11354 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11355 | { |
| 11356 | struct alc_spec *spec = codec->spec; |
| 11357 | |
| 11358 | spec->autocfg.hp_pins[0] = 0x15; |
| 11359 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11360 | spec->automute = 1; |
| 11361 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11362 | } |
| 11363 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11364 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11365 | { |
| 11366 | struct alc_spec *spec = codec->spec; |
| 11367 | |
| 11368 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11369 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11370 | spec->automute = 1; |
| 11371 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11372 | } |
| 11373 | |
| 11374 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11375 | static const struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11376 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11377 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11380 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11381 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11382 | { } /* end */ |
| 11383 | }; |
| 11384 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11385 | static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11386 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11387 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11388 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11389 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11391 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11392 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11393 | { } /* end */ |
| 11394 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11395 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11396 | static const struct snd_kcontrol_new alc262_tyan_mixer[] = { |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11397 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11398 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11399 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11400 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11401 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11402 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11405 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11406 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11407 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11408 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11409 | { } /* end */ |
| 11410 | }; |
| 11411 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11412 | static const struct hda_verb alc262_tyan_verbs[] = { |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11413 | /* Headphone automute */ |
| 11414 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11416 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11417 | |
| 11418 | /* P11 AUX_IN, white 4-pin connector */ |
| 11419 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11420 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11421 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11422 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11423 | |
| 11424 | {} |
| 11425 | }; |
| 11426 | |
| 11427 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11428 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11429 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11430 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11431 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11432 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11433 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11434 | spec->automute = 1; |
| 11435 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11436 | } |
| 11437 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11438 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11439 | #define alc262_capture_mixer alc882_capture_mixer |
| 11440 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11441 | |
| 11442 | /* |
| 11443 | * generic initialization of ADC, input mixers and output mixers |
| 11444 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11445 | static const struct hda_verb alc262_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11446 | /* |
| 11447 | * Unmute ADC0-2 and set the default input to mic-in |
| 11448 | */ |
| 11449 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11451 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11452 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11453 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11454 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11455 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11456 | /* 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] | 11457 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11458 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11459 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11460 | */ |
| 11461 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11462 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11463 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11464 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11465 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11466 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11467 | |
| 11468 | /* |
| 11469 | * Set up output mixers (0x0c - 0x0e) |
| 11470 | */ |
| 11471 | /* set vol=0 to output mixers */ |
| 11472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11473 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11474 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11475 | /* set up input amps for analog loopback */ |
| 11476 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11477 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11478 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11479 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11480 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11481 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11482 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11483 | |
| 11484 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11485 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11486 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11487 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11488 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11489 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11490 | |
| 11491 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11493 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11494 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11495 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11496 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11498 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11500 | /* FIXME: use matrix-type input source selection */ |
| 11501 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11502 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11503 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11504 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11505 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11506 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11507 | /* Input mixer2 */ |
| 11508 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11509 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11510 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11511 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11512 | /* Input mixer3 */ |
| 11513 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11514 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11515 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11516 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11517 | |
| 11518 | { } |
| 11519 | }; |
| 11520 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11521 | static const struct hda_verb alc262_eapd_verbs[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11522 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11523 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11524 | { } |
| 11525 | }; |
| 11526 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11527 | static const struct hda_verb alc262_hippo1_unsol_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11528 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11529 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11530 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11531 | |
| 11532 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11533 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11534 | {} |
| 11535 | }; |
| 11536 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11537 | static const struct hda_verb alc262_sony_unsol_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11540 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11541 | |
| 11542 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11543 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11544 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11545 | }; |
| 11546 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11547 | static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11548 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11549 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11550 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11551 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11553 | { } /* end */ |
| 11554 | }; |
| 11555 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11556 | static const struct hda_verb alc262_toshiba_s06_verbs[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11557 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11558 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11559 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11560 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11561 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11562 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11563 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11564 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11565 | {} |
| 11566 | }; |
| 11567 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11568 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11569 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11570 | struct alc_spec *spec = codec->spec; |
| 11571 | |
| 11572 | spec->autocfg.hp_pins[0] = 0x15; |
| 11573 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11574 | spec->ext_mic.pin = 0x18; |
| 11575 | spec->ext_mic.mux_idx = 0; |
| 11576 | spec->int_mic.pin = 0x12; |
| 11577 | spec->int_mic.mux_idx = 9; |
| 11578 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11579 | spec->automute = 1; |
| 11580 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11581 | } |
| 11582 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11583 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11584 | * nec model |
| 11585 | * 0x15 = headphone |
| 11586 | * 0x16 = internal speaker |
| 11587 | * 0x18 = external mic |
| 11588 | */ |
| 11589 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11590 | static const struct snd_kcontrol_new alc262_nec_mixer[] = { |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11591 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11592 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11593 | |
| 11594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11596 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11597 | |
| 11598 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11599 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11600 | { } /* end */ |
| 11601 | }; |
| 11602 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11603 | static const struct hda_verb alc262_nec_verbs[] = { |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11604 | /* Unmute Speaker */ |
| 11605 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11606 | |
| 11607 | /* Headphone */ |
| 11608 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11609 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11610 | |
| 11611 | /* External mic to headphone */ |
| 11612 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11613 | /* External mic to speaker */ |
| 11614 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11615 | {} |
| 11616 | }; |
| 11617 | |
| 11618 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11619 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11620 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11621 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11622 | */ |
| 11623 | |
Takashi Iwai | 20f5e0b | 2011-06-10 09:31:54 +0200 | [diff] [blame] | 11624 | #define ALC_HP_EVENT ALC880_HP_EVENT |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11625 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11626 | static const struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11627 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11628 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11629 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11630 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11631 | {} |
| 11632 | }; |
| 11633 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11634 | static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11635 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11636 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11637 | {} |
| 11638 | }; |
| 11639 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11640 | static const struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11641 | /* Front Mic pin: input vref at 50% */ |
| 11642 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11643 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11644 | {} |
| 11645 | }; |
| 11646 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11647 | static const struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11648 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11649 | .items = { |
| 11650 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11651 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11652 | { "CD", 0x4 }, |
| 11653 | }, |
| 11654 | }; |
| 11655 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11656 | static const struct hda_input_mux alc262_HP_capture_source = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11657 | .num_items = 5, |
| 11658 | .items = { |
| 11659 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11660 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11661 | { "Line", 0x2 }, |
| 11662 | { "CD", 0x4 }, |
| 11663 | { "AUX IN", 0x6 }, |
| 11664 | }, |
| 11665 | }; |
| 11666 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11667 | static const struct hda_input_mux alc262_HP_D7000_capture_source = { |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11668 | .num_items = 4, |
| 11669 | .items = { |
| 11670 | { "Mic", 0x0 }, |
| 11671 | { "Front Mic", 0x2 }, |
| 11672 | { "Line", 0x1 }, |
| 11673 | { "CD", 0x4 }, |
| 11674 | }, |
| 11675 | }; |
| 11676 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11677 | static void alc262_fujitsu_setup(struct hda_codec *codec) |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11678 | { |
| 11679 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11680 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11681 | spec->autocfg.hp_pins[0] = 0x14; |
| 11682 | spec->autocfg.hp_pins[1] = 0x1b; |
| 11683 | spec->autocfg.speaker_pins[0] = 0x15; |
| 11684 | spec->automute = 1; |
| 11685 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11686 | } |
| 11687 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11688 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11689 | static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11690 | .ops = &snd_hda_bind_vol, |
| 11691 | .values = { |
| 11692 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11693 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11694 | 0 |
| 11695 | }, |
| 11696 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11697 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11698 | static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11699 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11700 | { |
| 11701 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11702 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11703 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 11704 | .info = snd_ctl_boolean_mono_info, |
| 11705 | .get = alc262_hp_master_sw_get, |
| 11706 | .put = alc262_hp_master_sw_put, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11707 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11708 | { |
| 11709 | .iface = NID_MAPPING, |
| 11710 | .name = "Master Playback Switch", |
| 11711 | .private_value = 0x1b, |
| 11712 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11713 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11714 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11715 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11716 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11717 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11718 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11719 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11720 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11721 | { } /* end */ |
| 11722 | }; |
| 11723 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11724 | static void alc262_lenovo_3000_setup(struct hda_codec *codec) |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11725 | { |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11726 | struct alc_spec *spec = codec->spec; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11727 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11728 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11729 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11730 | spec->autocfg.speaker_pins[1] = 0x16; |
| 11731 | spec->automute = 1; |
| 11732 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11733 | } |
| 11734 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11735 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11736 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11737 | { |
| 11738 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11739 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11740 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b, |
| 11741 | .info = snd_ctl_boolean_mono_info, |
| 11742 | .get = alc262_hp_master_sw_get, |
| 11743 | .put = alc262_hp_master_sw_put, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11744 | }, |
| 11745 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11746 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11747 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11748 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11750 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11751 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11752 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11753 | { } /* end */ |
| 11754 | }; |
| 11755 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11756 | static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11757 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11758 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11761 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11762 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11763 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11764 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11765 | { } /* end */ |
| 11766 | }; |
| 11767 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11768 | /* additional init verbs for Benq laptops */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11769 | static const struct hda_verb alc262_EAPD_verbs[] = { |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11770 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11771 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11772 | {} |
| 11773 | }; |
| 11774 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11775 | static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11776 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11777 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11778 | |
| 11779 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11780 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11781 | {} |
| 11782 | }; |
| 11783 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11784 | /* Samsung Q1 Ultra Vista model setup */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11785 | static const struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11786 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11787 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11788 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11789 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11790 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 11791 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11792 | { } /* end */ |
| 11793 | }; |
| 11794 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11795 | static const struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11796 | /* output mixer */ |
| 11797 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11798 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11799 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11800 | /* speaker */ |
| 11801 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11802 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11803 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11804 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11805 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11806 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11807 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11809 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11810 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11811 | /* internal mic */ |
| 11812 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11813 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11814 | /* ADC, choose mic */ |
| 11815 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11816 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11817 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11818 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11819 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11820 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11821 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11822 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11823 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11824 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11825 | {} |
| 11826 | }; |
| 11827 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11828 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11829 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11830 | { |
| 11831 | struct alc_spec *spec = codec->spec; |
| 11832 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11833 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11834 | mute = 0; |
| 11835 | /* auto-mute only when HP is used as HP */ |
| 11836 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11837 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11838 | if (spec->jack_present) |
| 11839 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11840 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11841 | /* mute/unmute internal speaker */ |
| 11842 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11843 | HDA_AMP_MUTE, mute); |
| 11844 | /* mute/unmute HP */ |
| 11845 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11846 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11847 | } |
| 11848 | |
| 11849 | /* unsolicited event for HP jack sensing */ |
| 11850 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11851 | unsigned int res) |
| 11852 | { |
| 11853 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11854 | return; |
| 11855 | alc262_ultra_automute(codec); |
| 11856 | } |
| 11857 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11858 | static const struct hda_input_mux alc262_ultra_capture_source = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11859 | .num_items = 2, |
| 11860 | .items = { |
| 11861 | { "Mic", 0x1 }, |
| 11862 | { "Headphone", 0x7 }, |
| 11863 | }, |
| 11864 | }; |
| 11865 | |
| 11866 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11867 | struct snd_ctl_elem_value *ucontrol) |
| 11868 | { |
| 11869 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11870 | struct alc_spec *spec = codec->spec; |
| 11871 | int ret; |
| 11872 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11873 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11874 | if (!ret) |
| 11875 | return 0; |
| 11876 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11877 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11878 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11879 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11880 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11881 | return ret; |
| 11882 | } |
| 11883 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11884 | static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11885 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11886 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11887 | { |
| 11888 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11889 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11890 | .info = alc_mux_enum_info, |
| 11891 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11892 | .put = alc262_ultra_mux_enum_put, |
| 11893 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11894 | { |
| 11895 | .iface = NID_MAPPING, |
| 11896 | .name = "Capture Source", |
| 11897 | .private_value = 0x15, |
| 11898 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11899 | { } /* end */ |
| 11900 | }; |
| 11901 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11902 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11903 | * and thus it's bound with a different mixer. |
| 11904 | * This function returns which mixer amp should be used. |
| 11905 | */ |
| 11906 | static int alc262_check_volbit(hda_nid_t nid) |
| 11907 | { |
| 11908 | if (!nid) |
| 11909 | return 0; |
| 11910 | else if (nid == 0x16) |
| 11911 | return 2; |
| 11912 | else |
| 11913 | return 1; |
| 11914 | } |
| 11915 | |
| 11916 | 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] | 11917 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11918 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11919 | unsigned long val; |
| 11920 | int vbit; |
| 11921 | |
| 11922 | vbit = alc262_check_volbit(nid); |
| 11923 | if (!vbit) |
| 11924 | return 0; |
| 11925 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11926 | return 0; |
| 11927 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11928 | if (vbit == 2) |
| 11929 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11930 | else |
| 11931 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11932 | 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] | 11933 | } |
| 11934 | |
| 11935 | 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] | 11936 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11937 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11938 | unsigned long val; |
| 11939 | |
| 11940 | if (!nid) |
| 11941 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11942 | if (nid == 0x16) |
| 11943 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11944 | else |
| 11945 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11946 | 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] | 11947 | } |
| 11948 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11949 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11950 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11951 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11952 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11953 | const char *pfx; |
| 11954 | int vbits; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 11955 | int i, index, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11956 | |
| 11957 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11958 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 11959 | spec->private_dac_nids[0] = 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11960 | |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11961 | for (i = 0; i < 2; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 11962 | pfx = alc_get_line_out_pfx(spec, i, true, &index); |
| 11963 | if (!pfx) |
| 11964 | pfx = "PCM"; |
| 11965 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, |
| 11966 | index); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11967 | if (err < 0) |
| 11968 | return err; |
| 11969 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11970 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 11971 | "Speaker", i); |
| 11972 | if (err < 0) |
| 11973 | return err; |
| 11974 | } |
| 11975 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 11976 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 11977 | "Headphone", i); |
| 11978 | if (err < 0) |
| 11979 | return err; |
| 11980 | } |
| 11981 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11982 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11983 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11984 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11985 | alc262_check_volbit(cfg->hp_pins[0]); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11986 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11987 | for (i = 0; i < 2; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 11988 | pfx = alc_get_line_out_pfx(spec, i, true, &index); |
| 11989 | if (!pfx) |
| 11990 | pfx = "PCM"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11991 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 11992 | &vbits, i); |
| 11993 | if (err < 0) |
| 11994 | return err; |
| 11995 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11996 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 11997 | "Speaker", &vbits, i); |
| 11998 | if (err < 0) |
| 11999 | return err; |
| 12000 | } |
| 12001 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12002 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12003 | "Headphone", &vbits, i); |
| 12004 | if (err < 0) |
| 12005 | return err; |
| 12006 | } |
| 12007 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12008 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12009 | } |
| 12010 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12011 | static const struct hda_verb alc262_HP_BPC_init_verbs[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12012 | /* |
| 12013 | * Unmute ADC0-2 and set the default input to mic-in |
| 12014 | */ |
| 12015 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12016 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12017 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12018 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12019 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12020 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12021 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12022 | /* 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] | 12023 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12024 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12025 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12026 | */ |
| 12027 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12028 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12029 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12035 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12036 | /* |
| 12037 | * Set up output mixers (0x0c - 0x0e) |
| 12038 | */ |
| 12039 | /* set vol=0 to output mixers */ |
| 12040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12043 | |
| 12044 | /* set up input amps for analog loopback */ |
| 12045 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12049 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12051 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12052 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12053 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12055 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12056 | |
| 12057 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12059 | |
| 12060 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12061 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12062 | |
| 12063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12064 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12065 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12067 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12068 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12071 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12072 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12073 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12074 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12075 | |
| 12076 | |
| 12077 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12078 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12079 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12087 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12088 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12089 | /* Input mixer2 */ |
| 12090 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12091 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12092 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12093 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12094 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12095 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12096 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12099 | /* Input mixer3 */ |
| 12100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12104 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12105 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12106 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12109 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12110 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12111 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12112 | { } |
| 12113 | }; |
| 12114 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12115 | static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12116 | /* |
| 12117 | * Unmute ADC0-2 and set the default input to mic-in |
| 12118 | */ |
| 12119 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12120 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12121 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12122 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12123 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12125 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12126 | /* 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] | 12127 | * mixer widget |
| 12128 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12129 | * panel mic (mic 2) |
| 12130 | */ |
| 12131 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12140 | /* |
| 12141 | * Set up output mixers (0x0c - 0x0e) |
| 12142 | */ |
| 12143 | /* set vol=0 to output mixers */ |
| 12144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12145 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12146 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12147 | |
| 12148 | /* set up input amps for analog loopback */ |
| 12149 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12151 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12153 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12154 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12155 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12156 | |
| 12157 | |
| 12158 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12159 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12160 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12161 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12162 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12163 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12164 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12165 | |
| 12166 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12167 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12168 | |
| 12169 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12170 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12171 | |
| 12172 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12173 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12174 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12175 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12176 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12177 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12178 | |
| 12179 | /* FIXME: use matrix-type input source selection */ |
| 12180 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12181 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12182 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12183 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12184 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12185 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12186 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12187 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12188 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12189 | /* Input mixer2 */ |
| 12190 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12191 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12192 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12194 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12195 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12197 | /* Input mixer3 */ |
| 12198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12199 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12200 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12201 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12202 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12203 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12205 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12206 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12207 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12208 | { } |
| 12209 | }; |
| 12210 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12211 | static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12212 | |
| 12213 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12214 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12215 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12216 | |
| 12217 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12218 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12219 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12220 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12221 | |
| 12222 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12223 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12224 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12225 | {} |
| 12226 | }; |
| 12227 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12228 | /* |
| 12229 | * Pin config fixes |
| 12230 | */ |
| 12231 | enum { |
| 12232 | PINFIX_FSC_H270, |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12233 | PINFIX_HP_Z200, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12234 | }; |
| 12235 | |
| 12236 | static const struct alc_fixup alc262_fixups[] = { |
| 12237 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12238 | .type = ALC_FIXUP_PINS, |
| 12239 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12240 | { 0x14, 0x99130110 }, /* speaker */ |
| 12241 | { 0x15, 0x0221142f }, /* front HP */ |
| 12242 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12243 | { } |
| 12244 | } |
| 12245 | }, |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12246 | [PINFIX_HP_Z200] = { |
| 12247 | .type = ALC_FIXUP_PINS, |
| 12248 | .v.pins = (const struct alc_pincfg[]) { |
| 12249 | { 0x16, 0x99130120 }, /* internal speaker */ |
| 12250 | { } |
| 12251 | } |
| 12252 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12253 | }; |
| 12254 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12255 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12256 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200), |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12257 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12258 | {} |
| 12259 | }; |
| 12260 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12261 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12262 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12263 | #define alc262_loopbacks alc880_loopbacks |
| 12264 | #endif |
| 12265 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12266 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12267 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12268 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12269 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12270 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12271 | |
| 12272 | /* |
| 12273 | * BIOS auto configuration |
| 12274 | */ |
| 12275 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12276 | { |
| 12277 | struct alc_spec *spec = codec->spec; |
| 12278 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12279 | static const hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12280 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12281 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12282 | alc262_ignore); |
| 12283 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12284 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12285 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12286 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12287 | spec->multiout.max_channels = 2; |
| 12288 | spec->no_analog = 1; |
| 12289 | goto dig_only; |
| 12290 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12291 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12292 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12293 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12294 | if (err < 0) |
| 12295 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 12296 | err = alc_auto_create_input_ctls(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12297 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12298 | return err; |
| 12299 | |
| 12300 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12301 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12302 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12303 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12304 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12305 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12306 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12307 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12308 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12309 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12310 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12311 | err = alc_auto_add_mic_boost(codec); |
| 12312 | if (err < 0) |
| 12313 | return err; |
| 12314 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12315 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12316 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12317 | return 1; |
| 12318 | } |
| 12319 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12320 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12321 | |
| 12322 | |
| 12323 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12324 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12325 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12326 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 12327 | alc_auto_init_multi_out(codec); |
| 12328 | alc_auto_init_extra_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 12329 | alc_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12330 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12331 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12332 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12333 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12334 | } |
| 12335 | |
| 12336 | /* |
| 12337 | * configuration and preset |
| 12338 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12339 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12340 | [ALC262_BASIC] = "basic", |
| 12341 | [ALC262_HIPPO] = "hippo", |
| 12342 | [ALC262_HIPPO_1] = "hippo_1", |
| 12343 | [ALC262_FUJITSU] = "fujitsu", |
| 12344 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12345 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12346 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12347 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12348 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12349 | [ALC262_BENQ_T31] = "benq-t31", |
| 12350 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12351 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12352 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12353 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12354 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12355 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12356 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12357 | [ALC262_AUTO] = "auto", |
| 12358 | }; |
| 12359 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12360 | static const struct snd_pci_quirk alc262_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12361 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12362 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12363 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12364 | ALC262_HP_BPC), |
| 12365 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12366 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12367 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12368 | ALC262_HP_BPC), |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12369 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", |
| 12370 | ALC262_AUTO), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12371 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12372 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12373 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12374 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12375 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12376 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12377 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12378 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12379 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12380 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12381 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12382 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12383 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12384 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12385 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12386 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12387 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12388 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12389 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12390 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12391 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12392 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12393 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12394 | #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] | 12395 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12396 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12397 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12398 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12399 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12400 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12401 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12402 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12403 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12404 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12405 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12406 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12407 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12408 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12409 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12410 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12411 | {} |
| 12412 | }; |
| 12413 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12414 | static const struct alc_config_preset alc262_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12415 | [ALC262_BASIC] = { |
| 12416 | .mixers = { alc262_base_mixer }, |
| 12417 | .init_verbs = { alc262_init_verbs }, |
| 12418 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12419 | .dac_nids = alc262_dac_nids, |
| 12420 | .hp_nid = 0x03, |
| 12421 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12422 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12423 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12424 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12425 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12426 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12427 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12428 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12429 | .dac_nids = alc262_dac_nids, |
| 12430 | .hp_nid = 0x03, |
| 12431 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12432 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12433 | .channel_mode = alc262_modes, |
| 12434 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12435 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12436 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12437 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12438 | }, |
| 12439 | [ALC262_HIPPO_1] = { |
| 12440 | .mixers = { alc262_hippo1_mixer }, |
| 12441 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12442 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12443 | .dac_nids = alc262_dac_nids, |
| 12444 | .hp_nid = 0x02, |
| 12445 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12446 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12447 | .channel_mode = alc262_modes, |
| 12448 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12449 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12450 | .setup = alc262_hippo1_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12451 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12452 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12453 | [ALC262_FUJITSU] = { |
| 12454 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12455 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12456 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12457 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12458 | .dac_nids = alc262_dac_nids, |
| 12459 | .hp_nid = 0x03, |
| 12460 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12461 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12462 | .channel_mode = alc262_modes, |
| 12463 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12464 | .unsol_event = alc_sku_unsol_event, |
| 12465 | .setup = alc262_fujitsu_setup, |
| 12466 | .init_hook = alc_inithook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12467 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12468 | [ALC262_HP_BPC] = { |
| 12469 | .mixers = { alc262_HP_BPC_mixer }, |
| 12470 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12471 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12472 | .dac_nids = alc262_dac_nids, |
| 12473 | .hp_nid = 0x03, |
| 12474 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12475 | .channel_mode = alc262_modes, |
| 12476 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12477 | .unsol_event = alc_sku_unsol_event, |
| 12478 | .setup = alc262_hp_bpc_setup, |
| 12479 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12480 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12481 | [ALC262_HP_BPC_D7000_WF] = { |
| 12482 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12483 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12484 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12485 | .dac_nids = alc262_dac_nids, |
| 12486 | .hp_nid = 0x03, |
| 12487 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12488 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12489 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12490 | .unsol_event = alc_sku_unsol_event, |
| 12491 | .setup = alc262_hp_wildwest_setup, |
| 12492 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12493 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12494 | [ALC262_HP_BPC_D7000_WL] = { |
| 12495 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12496 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12497 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12498 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12499 | .dac_nids = alc262_dac_nids, |
| 12500 | .hp_nid = 0x03, |
| 12501 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12502 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12503 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12504 | .unsol_event = alc_sku_unsol_event, |
| 12505 | .setup = alc262_hp_wildwest_setup, |
| 12506 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12507 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12508 | [ALC262_HP_TC_T5735] = { |
| 12509 | .mixers = { alc262_hp_t5735_mixer }, |
| 12510 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12511 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12512 | .dac_nids = alc262_dac_nids, |
| 12513 | .hp_nid = 0x03, |
| 12514 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12515 | .channel_mode = alc262_modes, |
| 12516 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12517 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12518 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12519 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12520 | }, |
| 12521 | [ALC262_HP_RP5700] = { |
| 12522 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12523 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12524 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12525 | .dac_nids = alc262_dac_nids, |
| 12526 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12527 | .channel_mode = alc262_modes, |
| 12528 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12529 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12530 | [ALC262_BENQ_ED8] = { |
| 12531 | .mixers = { alc262_base_mixer }, |
| 12532 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12533 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12534 | .dac_nids = alc262_dac_nids, |
| 12535 | .hp_nid = 0x03, |
| 12536 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12537 | .channel_mode = alc262_modes, |
| 12538 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12539 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12540 | [ALC262_SONY_ASSAMD] = { |
| 12541 | .mixers = { alc262_sony_mixer }, |
| 12542 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12543 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12544 | .dac_nids = alc262_dac_nids, |
| 12545 | .hp_nid = 0x02, |
| 12546 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12547 | .channel_mode = alc262_modes, |
| 12548 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12549 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12550 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12551 | .init_hook = alc_inithook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12552 | }, |
| 12553 | [ALC262_BENQ_T31] = { |
| 12554 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12555 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12556 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12557 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12558 | .dac_nids = alc262_dac_nids, |
| 12559 | .hp_nid = 0x03, |
| 12560 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12561 | .channel_mode = alc262_modes, |
| 12562 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12563 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12564 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12565 | .init_hook = alc_inithook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12566 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12567 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12568 | .mixers = { alc262_ultra_mixer }, |
| 12569 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12570 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12571 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12572 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12573 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12574 | .channel_mode = alc262_modes, |
| 12575 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12576 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12577 | .capsrc_nids = alc262_capsrc_nids, |
| 12578 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12579 | .unsol_event = alc262_ultra_unsol_event, |
| 12580 | .init_hook = alc262_ultra_automute, |
| 12581 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12582 | [ALC262_LENOVO_3000] = { |
| 12583 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12584 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12585 | alc262_lenovo_3000_unsol_verbs, |
| 12586 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12587 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12588 | .dac_nids = alc262_dac_nids, |
| 12589 | .hp_nid = 0x03, |
| 12590 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12591 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12592 | .channel_mode = alc262_modes, |
| 12593 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12594 | .unsol_event = alc_sku_unsol_event, |
| 12595 | .setup = alc262_lenovo_3000_setup, |
| 12596 | .init_hook = alc_inithook, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12597 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12598 | [ALC262_NEC] = { |
| 12599 | .mixers = { alc262_nec_mixer }, |
| 12600 | .init_verbs = { alc262_nec_verbs }, |
| 12601 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12602 | .dac_nids = alc262_dac_nids, |
| 12603 | .hp_nid = 0x03, |
| 12604 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12605 | .channel_mode = alc262_modes, |
| 12606 | .input_mux = &alc262_capture_source, |
| 12607 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12608 | [ALC262_TOSHIBA_S06] = { |
| 12609 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12610 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12611 | alc262_eapd_verbs }, |
| 12612 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12613 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12614 | .dac_nids = alc262_dac_nids, |
| 12615 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12616 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12617 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12618 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12619 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12620 | .unsol_event = alc_sku_unsol_event, |
| 12621 | .setup = alc262_toshiba_s06_setup, |
| 12622 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12623 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12624 | [ALC262_TOSHIBA_RX1] = { |
| 12625 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12626 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12627 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12628 | .dac_nids = alc262_dac_nids, |
| 12629 | .hp_nid = 0x03, |
| 12630 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12631 | .channel_mode = alc262_modes, |
| 12632 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12633 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12634 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12635 | .init_hook = alc_inithook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12636 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12637 | [ALC262_TYAN] = { |
| 12638 | .mixers = { alc262_tyan_mixer }, |
| 12639 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12640 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12641 | .dac_nids = alc262_dac_nids, |
| 12642 | .hp_nid = 0x02, |
| 12643 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12644 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12645 | .channel_mode = alc262_modes, |
| 12646 | .input_mux = &alc262_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12647 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12648 | .setup = alc262_tyan_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12649 | .init_hook = alc_hp_automute, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12650 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12651 | }; |
| 12652 | |
| 12653 | static int patch_alc262(struct hda_codec *codec) |
| 12654 | { |
| 12655 | struct alc_spec *spec; |
| 12656 | int board_config; |
| 12657 | int err; |
| 12658 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12659 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12660 | if (spec == NULL) |
| 12661 | return -ENOMEM; |
| 12662 | |
| 12663 | codec->spec = spec; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 12664 | |
| 12665 | spec->mixer_nid = 0x0b; |
| 12666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12667 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12668 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12669 | * under-run |
| 12670 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12671 | { |
| 12672 | int tmp; |
| 12673 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12674 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12675 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12676 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12677 | } |
| 12678 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12679 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12680 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12681 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12682 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12683 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12684 | alc262_models, |
| 12685 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12686 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12687 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12688 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12689 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12690 | board_config = ALC262_AUTO; |
| 12691 | } |
| 12692 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12693 | if (board_config == ALC262_AUTO) { |
| 12694 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12695 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12696 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12697 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12698 | if (board_config == ALC262_AUTO) { |
| 12699 | /* automatic parse from the BIOS config */ |
| 12700 | err = alc262_parse_auto_config(codec); |
| 12701 | if (err < 0) { |
| 12702 | alc_free(codec); |
| 12703 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12704 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12705 | printk(KERN_INFO |
| 12706 | "hda_codec: Cannot set up configuration " |
| 12707 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12708 | board_config = ALC262_BASIC; |
| 12709 | } |
| 12710 | } |
| 12711 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12712 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12713 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12714 | if (err < 0) { |
| 12715 | alc_free(codec); |
| 12716 | return err; |
| 12717 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12718 | } |
| 12719 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12720 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12721 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12722 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12723 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12724 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12725 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12726 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12727 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12728 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12729 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12730 | int i; |
| 12731 | /* check whether the digital-mic has to be supported */ |
| 12732 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12733 | if (spec->input_mux->items[i].index >= 9) |
| 12734 | break; |
| 12735 | } |
| 12736 | if (i < spec->input_mux->num_items) { |
| 12737 | /* use only ADC0 */ |
| 12738 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12739 | spec->num_adc_nids = 1; |
| 12740 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12741 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12742 | /* all analog inputs */ |
| 12743 | /* check whether NID 0x07 is valid */ |
| 12744 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12745 | |
| 12746 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12747 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12748 | if (wcap != AC_WID_AUD_IN) { |
| 12749 | spec->adc_nids = alc262_adc_nids_alt; |
| 12750 | spec->num_adc_nids = |
| 12751 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12752 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12753 | } else { |
| 12754 | spec->adc_nids = alc262_adc_nids; |
| 12755 | spec->num_adc_nids = |
| 12756 | ARRAY_SIZE(alc262_adc_nids); |
| 12757 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12758 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12759 | } |
| 12760 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12761 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12762 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12763 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12764 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12765 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12766 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12767 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12768 | spec->vmaster_nid = 0x0c; |
| 12769 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12770 | codec->patch_ops = alc_patch_ops; |
| 12771 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12772 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 12773 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 12774 | |
| 12775 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12776 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12777 | if (!spec->loopback.amplist) |
| 12778 | spec->loopback.amplist = alc262_loopbacks; |
| 12779 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12780 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12781 | return 0; |
| 12782 | } |
| 12783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12784 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12785 | * ALC268 channel source setting (2 channel) |
| 12786 | */ |
| 12787 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12788 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12789 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12790 | static const hda_nid_t alc268_dac_nids[2] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12791 | /* front, hp */ |
| 12792 | 0x02, 0x03 |
| 12793 | }; |
| 12794 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12795 | static const hda_nid_t alc268_adc_nids[2] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12796 | /* ADC0-1 */ |
| 12797 | 0x08, 0x07 |
| 12798 | }; |
| 12799 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12800 | static const hda_nid_t alc268_adc_nids_alt[1] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12801 | /* ADC0 */ |
| 12802 | 0x08 |
| 12803 | }; |
| 12804 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12805 | static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12806 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12807 | static const struct snd_kcontrol_new alc268_base_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12808 | /* output mixer control */ |
| 12809 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12810 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12811 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12812 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12813 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 12814 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12815 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12816 | { } |
| 12817 | }; |
| 12818 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12819 | static const struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12820 | /* output mixer control */ |
| 12821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12822 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12823 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12824 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 12825 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12826 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12827 | { } |
| 12828 | }; |
| 12829 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12830 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12831 | static const struct hda_bind_ctls alc268_bind_beep_sw = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12832 | .ops = &snd_hda_bind_sw, |
| 12833 | .values = { |
| 12834 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12835 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12836 | 0 |
| 12837 | }, |
| 12838 | }; |
| 12839 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12840 | static const struct snd_kcontrol_new alc268_beep_mixer[] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12841 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12842 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12843 | { } |
| 12844 | }; |
| 12845 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12846 | static const struct hda_verb alc268_eapd_verbs[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12847 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12848 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12849 | { } |
| 12850 | }; |
| 12851 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12852 | /* Toshiba specific */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12853 | static const struct hda_verb alc268_toshiba_verbs[] = { |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12854 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12855 | { } /* end */ |
| 12856 | }; |
| 12857 | |
| 12858 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12859 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12860 | static const struct hda_bind_ctls alc268_acer_bind_master_vol = { |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12861 | .ops = &snd_hda_bind_vol, |
| 12862 | .values = { |
| 12863 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12864 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12865 | 0 |
| 12866 | }, |
| 12867 | }; |
| 12868 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12869 | static void alc268_acer_setup(struct hda_codec *codec) |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12870 | { |
| 12871 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12872 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12873 | spec->autocfg.hp_pins[0] = 0x14; |
| 12874 | spec->autocfg.speaker_pins[0] = 0x15; |
| 12875 | spec->automute = 1; |
| 12876 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12877 | } |
| 12878 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12879 | #define alc268_acer_master_sw_get alc262_hp_master_sw_get |
| 12880 | #define alc268_acer_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12881 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12882 | static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12883 | /* output mixer control */ |
| 12884 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12885 | { |
| 12886 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12887 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12888 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x15, |
| 12889 | .info = snd_ctl_boolean_mono_info, |
| 12890 | .get = alc268_acer_master_sw_get, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12891 | .put = alc268_acer_master_sw_put, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12892 | }, |
| 12893 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12894 | { } |
| 12895 | }; |
| 12896 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12897 | static const struct snd_kcontrol_new alc268_acer_mixer[] = { |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12898 | /* output mixer control */ |
| 12899 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12900 | { |
| 12901 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12902 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12903 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 12904 | .info = snd_ctl_boolean_mono_info, |
| 12905 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12906 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12907 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12908 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 12909 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12910 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12911 | { } |
| 12912 | }; |
| 12913 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12914 | static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12915 | /* output mixer control */ |
| 12916 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12917 | { |
| 12918 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12919 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12920 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 12921 | .info = snd_ctl_boolean_mono_info, |
| 12922 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12923 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12924 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12925 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 12926 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12927 | { } |
| 12928 | }; |
| 12929 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12930 | static const struct hda_verb alc268_acer_aspire_one_verbs[] = { |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12931 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12932 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12933 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12934 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12935 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12936 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12937 | { } |
| 12938 | }; |
| 12939 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12940 | static const struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12941 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12942 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12943 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12944 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12945 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12946 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12947 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12948 | { } |
| 12949 | }; |
| 12950 | |
| 12951 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12952 | #define alc268_toshiba_setup alc262_hippo_setup |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12953 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12954 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12955 | { |
| 12956 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 12957 | spec->autocfg.hp_pins[0] = 0x15; |
| 12958 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 12959 | spec->automute = 1; |
Takashi Iwai | 54463a6 | 2011-06-13 08:32:06 +0200 | [diff] [blame] | 12960 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12961 | spec->ext_mic.pin = 0x18; |
| 12962 | spec->ext_mic.mux_idx = 0; |
| 12963 | spec->int_mic.pin = 0x12; |
| 12964 | spec->int_mic.mux_idx = 6; |
| 12965 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12966 | } |
| 12967 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12968 | static const struct snd_kcontrol_new alc268_dell_mixer[] = { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12969 | /* output mixer control */ |
| 12970 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12971 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12972 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12973 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12974 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 12975 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12976 | { } |
| 12977 | }; |
| 12978 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12979 | static const struct hda_verb alc268_dell_verbs[] = { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12981 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12982 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12983 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12984 | { } |
| 12985 | }; |
| 12986 | |
| 12987 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12988 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12989 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12990 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12991 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12992 | spec->autocfg.hp_pins[0] = 0x15; |
| 12993 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12994 | spec->ext_mic.pin = 0x18; |
| 12995 | spec->ext_mic.mux_idx = 0; |
| 12996 | spec->int_mic.pin = 0x19; |
| 12997 | spec->int_mic.mux_idx = 1; |
| 12998 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12999 | spec->automute = 1; |
| 13000 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13001 | } |
| 13002 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13003 | static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13004 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13005 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13006 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13008 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13009 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13010 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13011 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13012 | { } |
| 13013 | }; |
| 13014 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13015 | static const struct hda_verb alc267_quanta_il1_verbs[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13016 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13017 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13018 | { } |
| 13019 | }; |
| 13020 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13021 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13022 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13023 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13024 | spec->autocfg.hp_pins[0] = 0x15; |
| 13025 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13026 | spec->ext_mic.pin = 0x18; |
| 13027 | spec->ext_mic.mux_idx = 0; |
| 13028 | spec->int_mic.pin = 0x19; |
| 13029 | spec->int_mic.mux_idx = 1; |
| 13030 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13031 | spec->automute = 1; |
| 13032 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13033 | } |
| 13034 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13035 | /* |
| 13036 | * generic initialization of ADC, input mixers and output mixers |
| 13037 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13038 | static const struct hda_verb alc268_base_init_verbs[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13039 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13040 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13041 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13042 | |
| 13043 | /* |
| 13044 | * Set up output mixers (0x0c - 0x0e) |
| 13045 | */ |
| 13046 | /* set vol=0 to output mixers */ |
| 13047 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13048 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13049 | |
| 13050 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13051 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13052 | |
| 13053 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13055 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13056 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13057 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13058 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13059 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13060 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13061 | |
| 13062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13064 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13065 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13066 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13067 | |
| 13068 | /* set PCBEEP vol = 0, mute connections */ |
| 13069 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13070 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13071 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13072 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13073 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13074 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13075 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13076 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13077 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13078 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13079 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13080 | { } |
| 13081 | }; |
| 13082 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13083 | /* only for model=test */ |
| 13084 | #ifdef CONFIG_SND_DEBUG |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13085 | /* |
| 13086 | * generic initialization of ADC, input mixers and output mixers |
| 13087 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13088 | static const struct hda_verb alc268_volume_init_verbs[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13089 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13090 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13091 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13092 | |
| 13093 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13094 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13095 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13096 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13097 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13098 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13099 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13100 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13101 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13102 | |
| 13103 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13104 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13105 | { } |
| 13106 | }; |
| 13107 | #endif /* CONFIG_SND_DEBUG */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13108 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13109 | /* set PCBEEP vol = 0, mute connections */ |
| 13110 | static const struct hda_verb alc268_beep_init_verbs[] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13111 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13112 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13113 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13114 | { } |
| 13115 | }; |
| 13116 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13117 | static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13118 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13119 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13120 | { } /* end */ |
| 13121 | }; |
| 13122 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13123 | static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13124 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13125 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13126 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13127 | { } /* end */ |
| 13128 | }; |
| 13129 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13130 | static const struct snd_kcontrol_new alc268_capture_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13131 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13132 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13133 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13134 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13135 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13136 | { } /* end */ |
| 13137 | }; |
| 13138 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13139 | static const struct hda_input_mux alc268_capture_source = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13140 | .num_items = 4, |
| 13141 | .items = { |
| 13142 | { "Mic", 0x0 }, |
| 13143 | { "Front Mic", 0x1 }, |
| 13144 | { "Line", 0x2 }, |
| 13145 | { "CD", 0x3 }, |
| 13146 | }, |
| 13147 | }; |
| 13148 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13149 | static const struct hda_input_mux alc268_acer_capture_source = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13150 | .num_items = 3, |
| 13151 | .items = { |
| 13152 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13153 | { "Internal Mic", 0x1 }, |
| 13154 | { "Line", 0x2 }, |
| 13155 | }, |
| 13156 | }; |
| 13157 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13158 | static const struct hda_input_mux alc268_acer_dmic_capture_source = { |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13159 | .num_items = 3, |
| 13160 | .items = { |
| 13161 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13162 | { "Internal Mic", 0x6 }, |
| 13163 | { "Line", 0x2 }, |
| 13164 | }, |
| 13165 | }; |
| 13166 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13167 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13168 | static const struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13169 | /* Volume widgets */ |
| 13170 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13171 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13172 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13173 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13174 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13175 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13176 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13177 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13178 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13179 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13180 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13181 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13182 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13183 | /* The below appears problematic on some hardwares */ |
| 13184 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13185 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13186 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13187 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13188 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13189 | |
| 13190 | /* Modes for retasking pin widgets */ |
| 13191 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13192 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13193 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13194 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13195 | |
| 13196 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13197 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13198 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13199 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13200 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13201 | |
| 13202 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13203 | * The ALC268 does not have an SPDIF input. |
| 13204 | */ |
| 13205 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13206 | |
| 13207 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13208 | * this output to turn on an external amplifier. |
| 13209 | */ |
| 13210 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13211 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13212 | |
| 13213 | { } /* end */ |
| 13214 | }; |
| 13215 | #endif |
| 13216 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13217 | /* create input playback/capture controls for the given pin */ |
| 13218 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13219 | const char *ctlname, int idx) |
| 13220 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13221 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13222 | int err; |
| 13223 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13224 | switch (nid) { |
| 13225 | case 0x14: |
| 13226 | case 0x16: |
| 13227 | dac = 0x02; |
| 13228 | break; |
| 13229 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13230 | case 0x1a: /* ALC259/269 only */ |
| 13231 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13232 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13233 | dac = 0x03; |
| 13234 | break; |
| 13235 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13236 | snd_printd(KERN_WARNING "hda_codec: " |
| 13237 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13238 | return 0; |
| 13239 | } |
| 13240 | if (spec->multiout.dac_nids[0] != dac && |
| 13241 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13242 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13243 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13244 | HDA_OUTPUT)); |
| 13245 | if (err < 0) |
| 13246 | return err; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 13247 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13248 | } |
| 13249 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13250 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13251 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13252 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13253 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13254 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13255 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13256 | if (err < 0) |
| 13257 | return err; |
| 13258 | return 0; |
| 13259 | } |
| 13260 | |
| 13261 | /* add playback controls from the parsed DAC table */ |
| 13262 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13263 | const struct auto_pin_cfg *cfg) |
| 13264 | { |
| 13265 | hda_nid_t nid; |
| 13266 | int err; |
| 13267 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13268 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13269 | |
| 13270 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13271 | if (nid) { |
| 13272 | const char *name; |
Takashi Iwai | 2e925dd | 2011-06-24 11:27:22 +0200 | [diff] [blame] | 13273 | int index; |
| 13274 | name = alc_get_line_out_pfx(spec, 0, true, &index); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13275 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13276 | if (err < 0) |
| 13277 | return err; |
| 13278 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13279 | |
| 13280 | nid = cfg->speaker_pins[0]; |
| 13281 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13282 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13283 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13284 | if (err < 0) |
| 13285 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13286 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13287 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13288 | if (err < 0) |
| 13289 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13290 | } |
| 13291 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13292 | if (nid) { |
| 13293 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13294 | if (err < 0) |
| 13295 | return err; |
| 13296 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13297 | |
| 13298 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13299 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13300 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13301 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13302 | if (err < 0) |
| 13303 | return err; |
| 13304 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13305 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13306 | } |
| 13307 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13308 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13309 | hda_nid_t nid, int pin_type) |
| 13310 | { |
| 13311 | int idx; |
| 13312 | |
| 13313 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 13314 | if (snd_hda_get_conn_list(codec, nid, NULL) <= 1) |
| 13315 | return; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13316 | if (nid == 0x14 || nid == 0x16) |
| 13317 | idx = 0; |
| 13318 | else |
| 13319 | idx = 1; |
| 13320 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13321 | } |
| 13322 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13323 | static void alc268_auto_init_dac(struct hda_codec *codec, hda_nid_t nid) |
| 13324 | { |
| 13325 | if (!nid) |
| 13326 | return; |
| 13327 | 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] | 13328 | AMP_OUT_ZERO); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13329 | } |
| 13330 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13331 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13332 | { |
| 13333 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13334 | int i; |
| 13335 | |
| 13336 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13337 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13338 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13339 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13340 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13341 | /* mute DACs */ |
| 13342 | for (i = 0; i < spec->multiout.num_dacs; i++) |
| 13343 | alc268_auto_init_dac(codec, spec->multiout.dac_nids[i]); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13344 | } |
| 13345 | |
| 13346 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13347 | { |
| 13348 | struct alc_spec *spec = codec->spec; |
| 13349 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13350 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13351 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13352 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13353 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13354 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13355 | } |
| 13356 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13357 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13358 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13359 | } |
| 13360 | if (spec->autocfg.mono_out_pin) |
| 13361 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13362 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13363 | /* mute DACs */ |
| 13364 | alc268_auto_init_dac(codec, spec->multiout.hp_nid); |
| 13365 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) |
| 13366 | alc268_auto_init_dac(codec, spec->multiout.extra_out_nid[i]); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13367 | } |
| 13368 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13369 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13370 | { |
| 13371 | struct alc_spec *spec = codec->spec; |
| 13372 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13373 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13374 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13375 | unsigned int dac_vol1, dac_vol2; |
| 13376 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13377 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13378 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13379 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13380 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13381 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13382 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13383 | AMP_IN_UNMUTE(1)); |
| 13384 | snd_hda_codec_write(codec, 0x10, 0, |
| 13385 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13386 | AMP_IN_UNMUTE(1)); |
| 13387 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13388 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13389 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13390 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13391 | snd_hda_codec_write(codec, 0x10, 0, |
| 13392 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13393 | } |
| 13394 | |
| 13395 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13396 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13397 | dac_vol2 = AMP_OUT_ZERO; |
| 13398 | else if (line_nid == 0x15) |
| 13399 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13400 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13401 | dac_vol2 = AMP_OUT_ZERO; |
| 13402 | else if (hp_nid == 0x15) |
| 13403 | dac_vol1 = AMP_OUT_ZERO; |
| 13404 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13405 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13406 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13407 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13408 | |
| 13409 | snd_hda_codec_write(codec, 0x02, 0, |
| 13410 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13411 | snd_hda_codec_write(codec, 0x03, 0, |
| 13412 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13413 | } |
| 13414 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13415 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13416 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13417 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13418 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13419 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13420 | |
| 13421 | /* |
| 13422 | * BIOS auto configuration |
| 13423 | */ |
| 13424 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13425 | { |
| 13426 | struct alc_spec *spec = codec->spec; |
| 13427 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13428 | static const hda_nid_t alc268_ignore[] = { 0 }; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13429 | |
| 13430 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13431 | alc268_ignore); |
| 13432 | if (err < 0) |
| 13433 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13434 | if (!spec->autocfg.line_outs) { |
| 13435 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13436 | spec->multiout.max_channels = 2; |
| 13437 | spec->no_analog = 1; |
| 13438 | goto dig_only; |
| 13439 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13440 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13441 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13442 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13443 | if (err < 0) |
| 13444 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 13445 | err = alc_auto_create_input_ctls(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13446 | if (err < 0) |
| 13447 | return err; |
| 13448 | |
| 13449 | spec->multiout.max_channels = 2; |
| 13450 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13451 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13452 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13453 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13454 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13455 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13456 | |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 13457 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) { |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13458 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 13459 | add_verb(spec, alc268_beep_init_verbs); |
| 13460 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13461 | |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13462 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13463 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13464 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13465 | err = alc_auto_add_mic_boost(codec); |
| 13466 | if (err < 0) |
| 13467 | return err; |
| 13468 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13469 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13470 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13471 | return 1; |
| 13472 | } |
| 13473 | |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13474 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13475 | |
| 13476 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13477 | static void alc268_auto_init(struct hda_codec *codec) |
| 13478 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13479 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13480 | alc268_auto_init_multi_out(codec); |
| 13481 | alc268_auto_init_hp_out(codec); |
| 13482 | alc268_auto_init_mono_speaker_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 13483 | alc_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13484 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13485 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13486 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13487 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13488 | } |
| 13489 | |
| 13490 | /* |
| 13491 | * configuration and preset |
| 13492 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13493 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13494 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13495 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13496 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13497 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13498 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13499 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13500 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13501 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13502 | #ifdef CONFIG_SND_DEBUG |
| 13503 | [ALC268_TEST] = "test", |
| 13504 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13505 | [ALC268_AUTO] = "auto", |
| 13506 | }; |
| 13507 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13508 | static const struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13509 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13510 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13511 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13512 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13513 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13514 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13515 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13516 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | 0a1896b | 2011-06-06 18:55:34 -0400 | [diff] [blame] | 13517 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13518 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13519 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13520 | /* almost compatible with toshiba but with optional digital outs; |
| 13521 | * auto-probing seems working fine |
| 13522 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13523 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13524 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13525 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13526 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13527 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13528 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13529 | {} |
| 13530 | }; |
| 13531 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13532 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13533 | static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13534 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13535 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13536 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13537 | ALC268_TOSHIBA), |
| 13538 | {} |
| 13539 | }; |
| 13540 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13541 | static const struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13542 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13543 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13544 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13545 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13546 | alc267_quanta_il1_verbs }, |
| 13547 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13548 | .dac_nids = alc268_dac_nids, |
| 13549 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13550 | .adc_nids = alc268_adc_nids_alt, |
| 13551 | .hp_nid = 0x03, |
| 13552 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13553 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13554 | .unsol_event = alc_sku_unsol_event, |
| 13555 | .setup = alc267_quanta_il1_setup, |
| 13556 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13557 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13558 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13559 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13560 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13561 | .init_verbs = { alc268_base_init_verbs }, |
| 13562 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13563 | .dac_nids = alc268_dac_nids, |
| 13564 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13565 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13566 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13567 | .hp_nid = 0x03, |
| 13568 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13569 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13570 | .channel_mode = alc268_modes, |
| 13571 | .input_mux = &alc268_capture_source, |
| 13572 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13573 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13574 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13575 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13576 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13577 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13578 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13579 | .dac_nids = alc268_dac_nids, |
| 13580 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13581 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13582 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13583 | .hp_nid = 0x03, |
| 13584 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13585 | .channel_mode = alc268_modes, |
| 13586 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13587 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13588 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13589 | .init_hook = alc_inithook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13590 | }, |
| 13591 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13592 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13593 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13594 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13595 | alc268_acer_verbs }, |
| 13596 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13597 | .dac_nids = alc268_dac_nids, |
| 13598 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13599 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13600 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13601 | .hp_nid = 0x02, |
| 13602 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13603 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13604 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13605 | .unsol_event = alc_sku_unsol_event, |
| 13606 | .setup = alc268_acer_setup, |
| 13607 | .init_hook = alc_inithook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13608 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13609 | [ALC268_ACER_DMIC] = { |
| 13610 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13611 | alc268_beep_mixer }, |
| 13612 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13613 | alc268_acer_verbs }, |
| 13614 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13615 | .dac_nids = alc268_dac_nids, |
| 13616 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13617 | .adc_nids = alc268_adc_nids_alt, |
| 13618 | .capsrc_nids = alc268_capsrc_nids, |
| 13619 | .hp_nid = 0x02, |
| 13620 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13621 | .channel_mode = alc268_modes, |
| 13622 | .input_mux = &alc268_acer_dmic_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13623 | .unsol_event = alc_sku_unsol_event, |
| 13624 | .setup = alc268_acer_setup, |
| 13625 | .init_hook = alc_inithook, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13626 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13627 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13628 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13629 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13630 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13631 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13632 | alc268_acer_aspire_one_verbs }, |
| 13633 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13634 | .dac_nids = alc268_dac_nids, |
| 13635 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13636 | .adc_nids = alc268_adc_nids_alt, |
| 13637 | .capsrc_nids = alc268_capsrc_nids, |
| 13638 | .hp_nid = 0x03, |
| 13639 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13640 | .channel_mode = alc268_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13641 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13642 | .setup = alc268_acer_lc_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13643 | .init_hook = alc_inithook, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13644 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13645 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13646 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13647 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13648 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13649 | alc268_dell_verbs }, |
| 13650 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13651 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13652 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13653 | .adc_nids = alc268_adc_nids_alt, |
| 13654 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13655 | .hp_nid = 0x02, |
| 13656 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13657 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13658 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13659 | .setup = alc268_dell_setup, |
| 13660 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13661 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13662 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13663 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13664 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13665 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13666 | alc268_toshiba_verbs }, |
| 13667 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13668 | .dac_nids = alc268_dac_nids, |
| 13669 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13670 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13671 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13672 | .hp_nid = 0x03, |
| 13673 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13674 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13675 | .channel_mode = alc268_modes, |
| 13676 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13677 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13678 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13679 | .init_hook = alc_inithook, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13680 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13681 | #ifdef CONFIG_SND_DEBUG |
| 13682 | [ALC268_TEST] = { |
| 13683 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13684 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13685 | alc268_volume_init_verbs, |
| 13686 | alc268_beep_init_verbs }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13687 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13688 | .dac_nids = alc268_dac_nids, |
| 13689 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13690 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13691 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13692 | .hp_nid = 0x03, |
| 13693 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13694 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13695 | .channel_mode = alc268_modes, |
| 13696 | .input_mux = &alc268_capture_source, |
| 13697 | }, |
| 13698 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13699 | }; |
| 13700 | |
| 13701 | static int patch_alc268(struct hda_codec *codec) |
| 13702 | { |
| 13703 | struct alc_spec *spec; |
| 13704 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13705 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13706 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13707 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13708 | if (spec == NULL) |
| 13709 | return -ENOMEM; |
| 13710 | |
| 13711 | codec->spec = spec; |
| 13712 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13713 | /* ALC268 has no aa-loopback mixer */ |
| 13714 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13715 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13716 | alc268_models, |
| 13717 | alc268_cfg_tbl); |
| 13718 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13719 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13720 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13721 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13722 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13723 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13724 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13725 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13726 | board_config = ALC268_AUTO; |
| 13727 | } |
| 13728 | |
| 13729 | if (board_config == ALC268_AUTO) { |
| 13730 | /* automatic parse from the BIOS config */ |
| 13731 | err = alc268_parse_auto_config(codec); |
| 13732 | if (err < 0) { |
| 13733 | alc_free(codec); |
| 13734 | return err; |
| 13735 | } else if (!err) { |
| 13736 | printk(KERN_INFO |
| 13737 | "hda_codec: Cannot set up configuration " |
| 13738 | "from BIOS. Using base mode...\n"); |
| 13739 | board_config = ALC268_3ST; |
| 13740 | } |
| 13741 | } |
| 13742 | |
| 13743 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13744 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13745 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13746 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13747 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13748 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13749 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13750 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13751 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13752 | has_beep = 0; |
| 13753 | for (i = 0; i < spec->num_mixers; i++) { |
| 13754 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13755 | has_beep = 1; |
| 13756 | break; |
| 13757 | } |
| 13758 | } |
| 13759 | |
| 13760 | if (has_beep) { |
| 13761 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13762 | if (err < 0) { |
| 13763 | alc_free(codec); |
| 13764 | return err; |
| 13765 | } |
| 13766 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13767 | /* override the amp caps for beep generator */ |
| 13768 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13769 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13770 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13771 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13772 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13773 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13774 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13775 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13776 | /* check whether NID 0x07 is valid */ |
| 13777 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13778 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13779 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13780 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13781 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13782 | if (spec->auto_mic || |
| 13783 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13784 | spec->adc_nids = alc268_adc_nids_alt; |
| 13785 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13786 | if (spec->auto_mic) |
| 13787 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13788 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13789 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13790 | else |
| 13791 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13792 | } else { |
| 13793 | spec->adc_nids = alc268_adc_nids; |
| 13794 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13795 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13796 | } |
| 13797 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13798 | |
| 13799 | spec->vmaster_nid = 0x02; |
| 13800 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13801 | codec->patch_ops = alc_patch_ops; |
| 13802 | if (board_config == ALC268_AUTO) |
| 13803 | spec->init_hook = alc268_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 13804 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13805 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13806 | alc_init_jacks(codec); |
| 13807 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13808 | return 0; |
| 13809 | } |
| 13810 | |
| 13811 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13812 | * ALC269 channel source setting (2 channel) |
| 13813 | */ |
| 13814 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13815 | |
| 13816 | #define alc269_dac_nids alc260_dac_nids |
| 13817 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13818 | static const hda_nid_t alc269_adc_nids[1] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13819 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13820 | 0x08, |
| 13821 | }; |
| 13822 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13823 | static const hda_nid_t alc269_capsrc_nids[1] = { |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13824 | 0x23, |
| 13825 | }; |
| 13826 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13827 | static const hda_nid_t alc269vb_adc_nids[1] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13828 | /* ADC1 */ |
| 13829 | 0x09, |
| 13830 | }; |
| 13831 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13832 | static const hda_nid_t alc269vb_capsrc_nids[1] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13833 | 0x22, |
| 13834 | }; |
| 13835 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13836 | static const hda_nid_t alc269_adc_candidates[] = { |
David Henningsson | 262ac22 | 2011-04-07 11:43:00 +0200 | [diff] [blame] | 13837 | 0x08, 0x09, 0x07, 0x11, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13838 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13839 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13840 | #define alc269_modes alc260_modes |
| 13841 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13842 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13843 | static const struct snd_kcontrol_new alc269_base_mixer[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13844 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13845 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13847 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13849 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13850 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13851 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13852 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13853 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13855 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13856 | { } /* end */ |
| 13857 | }; |
| 13858 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13859 | static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13860 | /* output mixer control */ |
| 13861 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13862 | { |
| 13863 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13864 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13865 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13866 | .info = snd_hda_mixer_amp_switch_info, |
| 13867 | .get = snd_hda_mixer_amp_switch_get, |
| 13868 | .put = alc268_acer_master_sw_put, |
| 13869 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13870 | }, |
| 13871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13873 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13874 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13875 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13876 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13877 | { } |
| 13878 | }; |
| 13879 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13880 | static const struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13881 | /* output mixer control */ |
| 13882 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13883 | { |
| 13884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13885 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13886 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13887 | .info = snd_hda_mixer_amp_switch_info, |
| 13888 | .get = snd_hda_mixer_amp_switch_get, |
| 13889 | .put = alc268_acer_master_sw_put, |
| 13890 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13891 | }, |
| 13892 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13893 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13894 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13895 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13896 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13897 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13898 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13899 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13900 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13901 | { } |
| 13902 | }; |
| 13903 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13904 | static const struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13905 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13906 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13908 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13909 | { } /* end */ |
| 13910 | }; |
| 13911 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13912 | static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13913 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13915 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13916 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13917 | { } /* end */ |
| 13918 | }; |
| 13919 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13920 | static const struct snd_kcontrol_new alc269_asus_mixer[] = { |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 13921 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13922 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 13923 | { } /* end */ |
| 13924 | }; |
| 13925 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13926 | /* capture mixer elements */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13927 | static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13928 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13929 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13930 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13931 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13932 | { } /* end */ |
| 13933 | }; |
| 13934 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13935 | static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13936 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13937 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13938 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13939 | { } /* end */ |
| 13940 | }; |
| 13941 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13942 | static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13943 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13944 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13945 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13946 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13947 | { } /* end */ |
| 13948 | }; |
| 13949 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13950 | static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13951 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13952 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13953 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13954 | { } /* end */ |
| 13955 | }; |
| 13956 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13957 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13958 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13959 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13960 | static const struct hda_verb alc269_quanta_fl1_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13961 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13962 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13963 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13964 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13965 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13966 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13967 | { } |
| 13968 | }; |
| 13969 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13970 | static const struct hda_verb alc269_lifebook_verbs[] = { |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13971 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13972 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13973 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13975 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13976 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13977 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13978 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13979 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13980 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13981 | { } |
| 13982 | }; |
| 13983 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13984 | /* toggle speaker-output according to the hp-jack state */ |
| 13985 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13986 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13987 | alc_hp_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13988 | |
| 13989 | snd_hda_codec_write(codec, 0x20, 0, |
| 13990 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13991 | snd_hda_codec_write(codec, 0x20, 0, |
| 13992 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13993 | |
| 13994 | snd_hda_codec_write(codec, 0x20, 0, |
| 13995 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13996 | snd_hda_codec_write(codec, 0x20, 0, |
| 13997 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13998 | } |
| 13999 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14000 | #define alc269_lifebook_speaker_automute \ |
| 14001 | alc269_quanta_fl1_speaker_automute |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14002 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14003 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14004 | { |
| 14005 | unsigned int present_laptop; |
| 14006 | unsigned int present_dock; |
| 14007 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14008 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14009 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14010 | |
| 14011 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14012 | if (present_dock) |
| 14013 | snd_hda_codec_write(codec, 0x23, 0, |
| 14014 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14015 | if (present_laptop) |
| 14016 | snd_hda_codec_write(codec, 0x23, 0, |
| 14017 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14018 | if (!present_dock && !present_laptop) |
| 14019 | snd_hda_codec_write(codec, 0x23, 0, |
| 14020 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14021 | } |
| 14022 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14023 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14024 | unsigned int res) |
| 14025 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14026 | switch (res >> 26) { |
| 14027 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14028 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14029 | break; |
| 14030 | case ALC880_MIC_EVENT: |
| 14031 | alc_mic_automute(codec); |
| 14032 | break; |
| 14033 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14034 | } |
| 14035 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14036 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14037 | unsigned int res) |
| 14038 | { |
| 14039 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14040 | alc269_lifebook_speaker_automute(codec); |
| 14041 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14042 | alc269_lifebook_mic_autoswitch(codec); |
| 14043 | } |
| 14044 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14045 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14046 | { |
| 14047 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14048 | spec->autocfg.hp_pins[0] = 0x15; |
| 14049 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14050 | spec->automute_mixer_nid[0] = 0x0c; |
| 14051 | spec->automute = 1; |
| 14052 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14053 | spec->ext_mic.pin = 0x18; |
| 14054 | spec->ext_mic.mux_idx = 0; |
| 14055 | spec->int_mic.pin = 0x19; |
| 14056 | spec->int_mic.mux_idx = 1; |
| 14057 | spec->auto_mic = 1; |
| 14058 | } |
| 14059 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14060 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14061 | { |
| 14062 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14063 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14064 | } |
| 14065 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14066 | static void alc269_lifebook_setup(struct hda_codec *codec) |
| 14067 | { |
| 14068 | struct alc_spec *spec = codec->spec; |
| 14069 | spec->autocfg.hp_pins[0] = 0x15; |
| 14070 | spec->autocfg.hp_pins[1] = 0x1a; |
| 14071 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14072 | spec->automute_mixer_nid[0] = 0x0c; |
| 14073 | spec->automute = 1; |
| 14074 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 14075 | } |
| 14076 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14077 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14078 | { |
| 14079 | alc269_lifebook_speaker_automute(codec); |
| 14080 | alc269_lifebook_mic_autoswitch(codec); |
| 14081 | } |
| 14082 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14083 | static const struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14084 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14085 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14086 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14088 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14089 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14090 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14091 | {} |
| 14092 | }; |
| 14093 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14094 | static const struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14095 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14096 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14097 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14098 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14099 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14100 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14101 | {} |
| 14102 | }; |
| 14103 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14104 | static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14105 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14106 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14107 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14108 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14109 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14110 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14111 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14112 | {} |
| 14113 | }; |
| 14114 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14115 | static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14116 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14117 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14118 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14119 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14120 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14121 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14122 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14123 | {} |
| 14124 | }; |
| 14125 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14126 | static const struct hda_verb alc271_acer_dmic_verbs[] = { |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14127 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14128 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14129 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14130 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14131 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14132 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14133 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14134 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14135 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14136 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14137 | { } |
| 14138 | }; |
| 14139 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14140 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14141 | { |
| 14142 | struct alc_spec *spec = codec->spec; |
| 14143 | spec->autocfg.hp_pins[0] = 0x15; |
| 14144 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14145 | spec->automute_mixer_nid[0] = 0x0c; |
| 14146 | spec->automute = 1; |
| 14147 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14148 | spec->ext_mic.pin = 0x18; |
| 14149 | spec->ext_mic.mux_idx = 0; |
| 14150 | spec->int_mic.pin = 0x19; |
| 14151 | spec->int_mic.mux_idx = 1; |
| 14152 | spec->auto_mic = 1; |
| 14153 | } |
| 14154 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14155 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14156 | { |
| 14157 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14158 | spec->autocfg.hp_pins[0] = 0x15; |
| 14159 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14160 | spec->automute_mixer_nid[0] = 0x0c; |
| 14161 | spec->automute = 1; |
| 14162 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14163 | spec->ext_mic.pin = 0x18; |
| 14164 | spec->ext_mic.mux_idx = 0; |
| 14165 | spec->int_mic.pin = 0x12; |
| 14166 | spec->int_mic.mux_idx = 5; |
| 14167 | spec->auto_mic = 1; |
| 14168 | } |
| 14169 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14170 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14171 | { |
| 14172 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14173 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14174 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14175 | spec->automute_mixer_nid[0] = 0x0c; |
| 14176 | spec->automute = 1; |
| 14177 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14178 | spec->ext_mic.pin = 0x18; |
| 14179 | spec->ext_mic.mux_idx = 0; |
| 14180 | spec->int_mic.pin = 0x19; |
| 14181 | spec->int_mic.mux_idx = 1; |
| 14182 | spec->auto_mic = 1; |
| 14183 | } |
| 14184 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14185 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14186 | { |
| 14187 | struct alc_spec *spec = codec->spec; |
| 14188 | spec->autocfg.hp_pins[0] = 0x21; |
| 14189 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14190 | spec->automute_mixer_nid[0] = 0x0c; |
| 14191 | spec->automute = 1; |
| 14192 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14193 | spec->ext_mic.pin = 0x18; |
| 14194 | spec->ext_mic.mux_idx = 0; |
| 14195 | spec->int_mic.pin = 0x12; |
| 14196 | spec->int_mic.mux_idx = 6; |
| 14197 | spec->auto_mic = 1; |
| 14198 | } |
| 14199 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14200 | /* |
| 14201 | * generic initialization of ADC, input mixers and output mixers |
| 14202 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14203 | static const struct hda_verb alc269_init_verbs[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14204 | /* |
| 14205 | * Unmute ADC0 and set the default input to mic-in |
| 14206 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14207 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14208 | |
| 14209 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14210 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14211 | */ |
| 14212 | /* set vol=0 to output mixers */ |
| 14213 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14214 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14215 | |
| 14216 | /* set up input amps for analog loopback */ |
| 14217 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14222 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14224 | |
| 14225 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14226 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14227 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14228 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14229 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14230 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14231 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14232 | |
| 14233 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14234 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14235 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14236 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14237 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14238 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14239 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14240 | |
| 14241 | /* set EAPD */ |
| 14242 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14243 | { } |
| 14244 | }; |
| 14245 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14246 | static const struct hda_verb alc269vb_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14247 | /* |
| 14248 | * Unmute ADC0 and set the default input to mic-in |
| 14249 | */ |
| 14250 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14251 | |
| 14252 | /* |
| 14253 | * Set up output mixers (0x02 - 0x03) |
| 14254 | */ |
| 14255 | /* set vol=0 to output mixers */ |
| 14256 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14257 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14258 | |
| 14259 | /* set up input amps for analog loopback */ |
| 14260 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14261 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14263 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14264 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14265 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14266 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14267 | |
| 14268 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14269 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14270 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14271 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14272 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14273 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14274 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14275 | |
| 14276 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14277 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14278 | |
| 14279 | /* FIXME: use Mux-type input source selection */ |
| 14280 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14281 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14282 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14283 | |
| 14284 | /* set EAPD */ |
| 14285 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14286 | { } |
| 14287 | }; |
| 14288 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14289 | #define alc269_auto_create_multi_out_ctls \ |
| 14290 | alc268_auto_create_multi_out_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14291 | |
| 14292 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14293 | #define alc269_loopbacks alc880_loopbacks |
| 14294 | #endif |
| 14295 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14296 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14297 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14298 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14299 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14300 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14301 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14302 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14303 | .substreams = 1, |
| 14304 | .channels_min = 2, |
| 14305 | .channels_max = 8, |
| 14306 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14307 | /* NID is set in alc_build_pcms */ |
| 14308 | .ops = { |
| 14309 | .open = alc880_playback_pcm_open, |
| 14310 | .prepare = alc880_playback_pcm_prepare, |
| 14311 | .cleanup = alc880_playback_pcm_cleanup |
| 14312 | }, |
| 14313 | }; |
| 14314 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14315 | static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14316 | .substreams = 1, |
| 14317 | .channels_min = 2, |
| 14318 | .channels_max = 2, |
| 14319 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14320 | /* NID is set in alc_build_pcms */ |
| 14321 | }; |
| 14322 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14323 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14324 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14325 | { |
| 14326 | switch (codec->subsystem_id) { |
| 14327 | case 0x103c1586: |
| 14328 | return 1; |
| 14329 | } |
| 14330 | return 0; |
| 14331 | } |
| 14332 | |
| 14333 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14334 | { |
| 14335 | /* update mute-LED according to the speaker mute state */ |
| 14336 | if (nid == 0x01 || nid == 0x14) { |
| 14337 | int pinval; |
| 14338 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14339 | HDA_AMP_MUTE) |
| 14340 | pinval = 0x24; |
| 14341 | else |
| 14342 | pinval = 0x20; |
| 14343 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14344 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14345 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14346 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14347 | } |
| 14348 | return alc_check_power_status(codec, nid); |
| 14349 | } |
| 14350 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14351 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14352 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14353 | { |
| 14354 | struct alc_spec *spec = codec->spec; |
| 14355 | |
| 14356 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14357 | return 0; |
| 14358 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14359 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14360 | if (spec->ext_mic.pin <= 0x12) { |
| 14361 | spec->private_adc_nids[0] = 0x08; |
| 14362 | spec->private_adc_nids[1] = 0x11; |
| 14363 | spec->private_capsrc_nids[0] = 0x23; |
| 14364 | spec->private_capsrc_nids[1] = 0x22; |
| 14365 | } else { |
| 14366 | spec->private_adc_nids[0] = 0x11; |
| 14367 | spec->private_adc_nids[1] = 0x08; |
| 14368 | spec->private_capsrc_nids[0] = 0x22; |
| 14369 | spec->private_capsrc_nids[1] = 0x23; |
| 14370 | } |
| 14371 | spec->adc_nids = spec->private_adc_nids; |
| 14372 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14373 | spec->num_adc_nids = 2; |
| 14374 | spec->dual_adc_switch = 1; |
| 14375 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14376 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14377 | return 1; |
| 14378 | } |
| 14379 | return 0; |
| 14380 | } |
| 14381 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14382 | /* different alc269-variants */ |
| 14383 | enum { |
Kailang Yang | b687857 | 2011-07-06 09:51:29 +0200 | [diff] [blame] | 14384 | ALC269_TYPE_ALC269VA, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14385 | ALC269_TYPE_ALC269VB, |
Kailang Yang | b687857 | 2011-07-06 09:51:29 +0200 | [diff] [blame] | 14386 | ALC269_TYPE_ALC269VC, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14387 | }; |
| 14388 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14389 | /* |
| 14390 | * BIOS auto configuration |
| 14391 | */ |
| 14392 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14393 | { |
| 14394 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14395 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14396 | static const hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14397 | |
| 14398 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14399 | alc269_ignore); |
| 14400 | if (err < 0) |
| 14401 | return err; |
| 14402 | |
| 14403 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14404 | if (err < 0) |
| 14405 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 14406 | err = alc_auto_create_input_ctls(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14407 | if (err < 0) |
| 14408 | return err; |
| 14409 | |
| 14410 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14411 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14412 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14413 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14414 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14415 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14416 | |
Kailang Yang | b687857 | 2011-07-06 09:51:29 +0200 | [diff] [blame] | 14417 | if (spec->codec_variant != ALC269_TYPE_ALC269VA) |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14418 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 14419 | else |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14420 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14421 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14422 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14423 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14424 | |
| 14425 | if (!alc275_setup_dual_adc(codec)) |
| 14426 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14427 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14428 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14429 | err = alc_auto_add_mic_boost(codec); |
| 14430 | if (err < 0) |
| 14431 | return err; |
| 14432 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14433 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14434 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14435 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14436 | return 1; |
| 14437 | } |
| 14438 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14439 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14440 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14441 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14442 | |
| 14443 | |
| 14444 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14445 | static void alc269_auto_init(struct hda_codec *codec) |
| 14446 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14447 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14448 | alc269_auto_init_multi_out(codec); |
| 14449 | alc269_auto_init_hp_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 14450 | alc_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14451 | if (!spec->dual_adc_switch) |
| 14452 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14453 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14454 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14455 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14456 | } |
| 14457 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14458 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14459 | { |
| 14460 | int val = alc_read_coef_idx(codec, 0x04); |
| 14461 | if (power_up) |
| 14462 | val |= 1 << 11; |
| 14463 | else |
| 14464 | val &= ~(1 << 11); |
| 14465 | alc_write_coef_idx(codec, 0x04, val); |
| 14466 | } |
| 14467 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14468 | static void alc269_shutup(struct hda_codec *codec) |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14469 | { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14470 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14471 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14472 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14473 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14474 | msleep(150); |
| 14475 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14476 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14477 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14478 | #ifdef SND_HDA_NEEDS_RESUME |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14479 | static int alc269_resume(struct hda_codec *codec) |
| 14480 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14481 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14482 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14483 | msleep(150); |
| 14484 | } |
| 14485 | |
| 14486 | codec->patch_ops.init(codec); |
| 14487 | |
| 14488 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14489 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14490 | msleep(200); |
| 14491 | } |
| 14492 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14493 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14494 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14495 | |
| 14496 | snd_hda_codec_resume_amp(codec); |
| 14497 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14498 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14499 | return 0; |
| 14500 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14501 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14502 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14503 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14504 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14505 | { |
| 14506 | int coef; |
| 14507 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14508 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14509 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14510 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14511 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14512 | } |
| 14513 | |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14514 | static void alc271_fixup_dmic(struct hda_codec *codec, |
| 14515 | const struct alc_fixup *fix, int action) |
| 14516 | { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14517 | static const struct hda_verb verbs[] = { |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14518 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14519 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14520 | {} |
| 14521 | }; |
| 14522 | unsigned int cfg; |
| 14523 | |
| 14524 | if (strcmp(codec->chip_name, "ALC271X")) |
| 14525 | return; |
| 14526 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 14527 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 14528 | snd_hda_sequence_write(codec, verbs); |
| 14529 | } |
| 14530 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14531 | enum { |
| 14532 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14533 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14534 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14535 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14536 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14537 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14538 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14539 | ALC271_FIXUP_DMIC, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14540 | }; |
| 14541 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14542 | static const struct alc_fixup alc269_fixups[] = { |
| 14543 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14544 | .type = ALC_FIXUP_VERBS, |
| 14545 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14546 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14547 | {} |
| 14548 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14549 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14550 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14551 | .type = ALC_FIXUP_VERBS, |
| 14552 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14553 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14554 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14555 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14556 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14557 | }, |
| 14558 | .chained = true, |
| 14559 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14560 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14561 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14562 | .type = ALC_FIXUP_VERBS, |
| 14563 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14564 | /* Enables internal speaker */ |
| 14565 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14566 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14567 | {} |
| 14568 | } |
| 14569 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14570 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14571 | .type = ALC_FIXUP_SKU, |
| 14572 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14573 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14574 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14575 | .type = ALC_FIXUP_PINS, |
| 14576 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14577 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14578 | { } |
| 14579 | } |
| 14580 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14581 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14582 | .type = ALC_FIXUP_VERBS, |
| 14583 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14584 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14585 | {} |
| 14586 | } |
| 14587 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14588 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14589 | .type = ALC_FIXUP_FUNC, |
| 14590 | .v.func = alc269_fixup_hweq, |
| 14591 | .chained = true, |
| 14592 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14593 | }, |
| 14594 | [ALC271_FIXUP_DMIC] = { |
| 14595 | .type = ALC_FIXUP_FUNC, |
| 14596 | .v.func = alc271_fixup_dmic, |
| 14597 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14598 | }; |
| 14599 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14600 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14601 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14602 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14603 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14604 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14605 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14606 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14607 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14608 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14609 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14610 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14611 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14612 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14613 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14614 | {} |
| 14615 | }; |
| 14616 | |
| 14617 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14618 | /* |
| 14619 | * configuration and preset |
| 14620 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14621 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14622 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14623 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14624 | [ALC269_AMIC] = "laptop-amic", |
| 14625 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14626 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14627 | [ALC269_LIFEBOOK] = "lifebook", |
| 14628 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14629 | }; |
| 14630 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14631 | static const struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14632 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14633 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14634 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14635 | ALC269_AMIC), |
| 14636 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14637 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14638 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14639 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14640 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14641 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14642 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14643 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14644 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 14645 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14646 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14647 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14648 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14649 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14650 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14651 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14652 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14653 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14654 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14655 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14656 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14657 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14658 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14659 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14660 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14661 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14662 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14663 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14664 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14665 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14666 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14667 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14668 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14669 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14670 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14671 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14672 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14673 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14674 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14675 | ALC269_DMIC), |
| 14676 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14677 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14678 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14679 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14680 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14681 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14682 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14683 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14684 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14685 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14686 | {} |
| 14687 | }; |
| 14688 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14689 | static const struct alc_config_preset alc269_presets[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14690 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14691 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14692 | .init_verbs = { alc269_init_verbs }, |
| 14693 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14694 | .dac_nids = alc269_dac_nids, |
| 14695 | .hp_nid = 0x03, |
| 14696 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14697 | .channel_mode = alc269_modes, |
| 14698 | .input_mux = &alc269_capture_source, |
| 14699 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14700 | [ALC269_QUANTA_FL1] = { |
| 14701 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14702 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14703 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14704 | .dac_nids = alc269_dac_nids, |
| 14705 | .hp_nid = 0x03, |
| 14706 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14707 | .channel_mode = alc269_modes, |
| 14708 | .input_mux = &alc269_capture_source, |
| 14709 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14710 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14711 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14712 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14713 | [ALC269_AMIC] = { |
| 14714 | .mixers = { alc269_laptop_mixer }, |
| 14715 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14716 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14717 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14718 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14719 | .dac_nids = alc269_dac_nids, |
| 14720 | .hp_nid = 0x03, |
| 14721 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14722 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14723 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14724 | .setup = alc269_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14725 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14726 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14727 | [ALC269_DMIC] = { |
| 14728 | .mixers = { alc269_laptop_mixer }, |
| 14729 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14730 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14731 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14732 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14733 | .dac_nids = alc269_dac_nids, |
| 14734 | .hp_nid = 0x03, |
| 14735 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14736 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14737 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14738 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14739 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14740 | }, |
| 14741 | [ALC269VB_AMIC] = { |
| 14742 | .mixers = { alc269vb_laptop_mixer }, |
| 14743 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14744 | .init_verbs = { alc269vb_init_verbs, |
| 14745 | alc269vb_laptop_amic_init_verbs }, |
| 14746 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14747 | .dac_nids = alc269_dac_nids, |
| 14748 | .hp_nid = 0x03, |
| 14749 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14750 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14751 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14752 | .setup = alc269vb_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14753 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14754 | }, |
| 14755 | [ALC269VB_DMIC] = { |
| 14756 | .mixers = { alc269vb_laptop_mixer }, |
| 14757 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14758 | .init_verbs = { alc269vb_init_verbs, |
| 14759 | alc269vb_laptop_dmic_init_verbs }, |
| 14760 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14761 | .dac_nids = alc269_dac_nids, |
| 14762 | .hp_nid = 0x03, |
| 14763 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14764 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14765 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14766 | .setup = alc269vb_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14767 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14768 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14769 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14770 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14771 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14772 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14773 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14774 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14775 | .dac_nids = alc269_dac_nids, |
| 14776 | .hp_nid = 0x03, |
| 14777 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14778 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14779 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14780 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14781 | .init_hook = alc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14782 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14783 | [ALC269_LIFEBOOK] = { |
| 14784 | .mixers = { alc269_lifebook_mixer }, |
| 14785 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14786 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14787 | .dac_nids = alc269_dac_nids, |
| 14788 | .hp_nid = 0x03, |
| 14789 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14790 | .channel_mode = alc269_modes, |
| 14791 | .input_mux = &alc269_capture_source, |
| 14792 | .unsol_event = alc269_lifebook_unsol_event, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14793 | .setup = alc269_lifebook_setup, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14794 | .init_hook = alc269_lifebook_init_hook, |
| 14795 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14796 | [ALC271_ACER] = { |
| 14797 | .mixers = { alc269_asus_mixer }, |
| 14798 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14799 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14800 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14801 | .dac_nids = alc269_dac_nids, |
| 14802 | .adc_nids = alc262_dmic_adc_nids, |
| 14803 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14804 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14805 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14806 | .channel_mode = alc269_modes, |
| 14807 | .input_mux = &alc269_capture_source, |
| 14808 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14809 | .unsol_event = alc_sku_unsol_event, |
| 14810 | .setup = alc269vb_laptop_dmic_setup, |
| 14811 | .init_hook = alc_inithook, |
| 14812 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14813 | }; |
| 14814 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14815 | static int alc269_fill_coef(struct hda_codec *codec) |
| 14816 | { |
| 14817 | int val; |
| 14818 | |
| 14819 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 14820 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14821 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 14822 | } |
| 14823 | |
| 14824 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 14825 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14826 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 14827 | } |
| 14828 | |
| 14829 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 14830 | val = alc_read_coef_idx(codec, 0x04); |
| 14831 | /* Power up output pin */ |
| 14832 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 14833 | } |
| 14834 | |
| 14835 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 14836 | val = alc_read_coef_idx(codec, 0xd); |
| 14837 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 14838 | /* Capless ramp up clock control */ |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 14839 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14840 | } |
| 14841 | val = alc_read_coef_idx(codec, 0x17); |
| 14842 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 14843 | /* Class D power on reset */ |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 14844 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14845 | } |
| 14846 | } |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 14847 | |
| 14848 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ |
| 14849 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); |
| 14850 | |
| 14851 | val = alc_read_coef_idx(codec, 0x4); /* HP */ |
| 14852 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); |
| 14853 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14854 | return 0; |
| 14855 | } |
| 14856 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14857 | static int patch_alc269(struct hda_codec *codec) |
| 14858 | { |
| 14859 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14860 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14861 | int err; |
| 14862 | |
| 14863 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14864 | if (spec == NULL) |
| 14865 | return -ENOMEM; |
| 14866 | |
| 14867 | codec->spec = spec; |
| 14868 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 14869 | spec->mixer_nid = 0x0b; |
| 14870 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14871 | alc_auto_parse_customize_define(codec); |
| 14872 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 14873 | if (codec->vendor_id == 0x10ec0269) { |
Kailang Yang | b687857 | 2011-07-06 09:51:29 +0200 | [diff] [blame] | 14874 | spec->codec_variant = ALC269_TYPE_ALC269VA; |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 14875 | coef = alc_read_coef_idx(codec, 0); |
| 14876 | if ((coef & 0x00f0) == 0x0010) { |
| 14877 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14878 | spec->cdefine.platform_type == 1) { |
| 14879 | alc_codec_rename(codec, "ALC271X"); |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 14880 | } else if ((coef & 0xf000) == 0x2000) { |
| 14881 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 14882 | } else if ((coef & 0xf000) == 0x3000) { |
| 14883 | alc_codec_rename(codec, "ALC258"); |
Kailang Yang | b687857 | 2011-07-06 09:51:29 +0200 | [diff] [blame] | 14884 | } else if ((coef & 0xfff0) == 0x3010) { |
| 14885 | alc_codec_rename(codec, "ALC277"); |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 14886 | } else { |
| 14887 | alc_codec_rename(codec, "ALC269VB"); |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 14888 | } |
Kailang Yang | b687857 | 2011-07-06 09:51:29 +0200 | [diff] [blame] | 14889 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 14890 | } else if ((coef & 0x00f0) == 0x0020) { |
| 14891 | if (coef == 0xa023) |
| 14892 | alc_codec_rename(codec, "ALC259"); |
| 14893 | else if (coef == 0x6023) |
| 14894 | alc_codec_rename(codec, "ALC281X"); |
| 14895 | else if (codec->bus->pci->subsystem_vendor == 0x17aa && |
| 14896 | codec->bus->pci->subsystem_device == 0x21f3) |
| 14897 | alc_codec_rename(codec, "ALC3202"); |
| 14898 | else |
| 14899 | alc_codec_rename(codec, "ALC269VC"); |
| 14900 | spec->codec_variant = ALC269_TYPE_ALC269VC; |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 14901 | } else |
| 14902 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 14903 | alc269_fill_coef(codec); |
| 14904 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14905 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14906 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14907 | alc269_models, |
| 14908 | alc269_cfg_tbl); |
| 14909 | |
| 14910 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14911 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14912 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14913 | board_config = ALC269_AUTO; |
| 14914 | } |
| 14915 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14916 | if (board_config == ALC269_AUTO) { |
| 14917 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 14918 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 14919 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14920 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14921 | if (board_config == ALC269_AUTO) { |
| 14922 | /* automatic parse from the BIOS config */ |
| 14923 | err = alc269_parse_auto_config(codec); |
| 14924 | if (err < 0) { |
| 14925 | alc_free(codec); |
| 14926 | return err; |
| 14927 | } else if (!err) { |
| 14928 | printk(KERN_INFO |
| 14929 | "hda_codec: Cannot set up configuration " |
| 14930 | "from BIOS. Using base mode...\n"); |
| 14931 | board_config = ALC269_BASIC; |
| 14932 | } |
| 14933 | } |
| 14934 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14935 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14936 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14937 | if (err < 0) { |
| 14938 | alc_free(codec); |
| 14939 | return err; |
| 14940 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14941 | } |
| 14942 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14943 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14944 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14945 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14946 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14947 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14948 | * fix the sample rate of analog I/O to 44.1kHz |
| 14949 | */ |
| 14950 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14951 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14952 | } else if (spec->dual_adc_switch) { |
| 14953 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14954 | /* switch ADC dynamically */ |
| 14955 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14956 | } else { |
| 14957 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14958 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14959 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14960 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14961 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14962 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14963 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | b687857 | 2011-07-06 09:51:29 +0200 | [diff] [blame] | 14964 | if (spec->codec_variant == ALC269_TYPE_ALC269VA) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14965 | spec->adc_nids = alc269_adc_nids; |
| 14966 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14967 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14968 | } else { |
| 14969 | spec->adc_nids = alc269vb_adc_nids; |
| 14970 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14971 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14972 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14973 | } |
| 14974 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14975 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14976 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14977 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14978 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14979 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14980 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14981 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14982 | spec->vmaster_nid = 0x02; |
| 14983 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14984 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14985 | #ifdef SND_HDA_NEEDS_RESUME |
| 14986 | codec->patch_ops.resume = alc269_resume; |
| 14987 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14988 | if (board_config == ALC269_AUTO) |
| 14989 | spec->init_hook = alc269_auto_init; |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14990 | spec->shutup = alc269_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14991 | |
| 14992 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14993 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14994 | if (!spec->loopback.amplist) |
| 14995 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14996 | if (alc269_mic2_for_mute_led(codec)) |
| 14997 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14998 | #endif |
| 14999 | |
| 15000 | return 0; |
| 15001 | } |
| 15002 | |
| 15003 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15004 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15005 | */ |
| 15006 | |
| 15007 | /* |
| 15008 | * set the path ways for 2 channel output |
| 15009 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15010 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15011 | static const struct hda_verb alc861_threestack_ch2_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15012 | /* set pin widget 1Ah (line in) for input */ |
| 15013 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15014 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15015 | * the vref |
| 15016 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15017 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15018 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15019 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15020 | #if 0 |
| 15021 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15022 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15023 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15024 | { } /* end */ |
| 15025 | }; |
| 15026 | /* |
| 15027 | * 6ch mode |
| 15028 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15029 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15030 | static const struct hda_verb alc861_threestack_ch6_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15031 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15032 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15033 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15034 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15035 | |
| 15036 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15037 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15038 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15039 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15040 | #if 0 |
| 15041 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15042 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15043 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15044 | { } /* end */ |
| 15045 | }; |
| 15046 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15047 | static const struct hda_channel_mode alc861_threestack_modes[2] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15048 | { 2, alc861_threestack_ch2_init }, |
| 15049 | { 6, alc861_threestack_ch6_init }, |
| 15050 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15051 | /* Set mic1 as input and unmute the mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15052 | static const struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15053 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15054 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15055 | { } /* end */ |
| 15056 | }; |
| 15057 | /* Set mic1 as output and mute mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15058 | static const struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15059 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15060 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15061 | { } /* end */ |
| 15062 | }; |
| 15063 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15064 | static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15065 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15066 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15067 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15068 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15069 | /* Set mic1 and line-in as input and unmute the mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15070 | static const struct hda_verb alc861_asus_ch2_init[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15071 | /* set pin widget 1Ah (line in) for input */ |
| 15072 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15073 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15074 | * the vref |
| 15075 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15076 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15077 | |
| 15078 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15079 | #if 0 |
| 15080 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15081 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15082 | #endif |
| 15083 | { } /* end */ |
| 15084 | }; |
| 15085 | /* Set mic1 nad line-in as output and mute mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15086 | static const struct hda_verb alc861_asus_ch6_init[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15087 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15088 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15089 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15090 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15091 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15092 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15093 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15094 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15095 | |
| 15096 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15097 | #if 0 |
| 15098 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15099 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15100 | #endif |
| 15101 | { } /* end */ |
| 15102 | }; |
| 15103 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15104 | static const struct hda_channel_mode alc861_asus_modes[2] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15105 | { 2, alc861_asus_ch2_init }, |
| 15106 | { 6, alc861_asus_ch6_init }, |
| 15107 | }; |
| 15108 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15109 | /* patch-ALC861 */ |
| 15110 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15111 | static const struct snd_kcontrol_new alc861_base_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15112 | /* output mixer control */ |
| 15113 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15114 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15115 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15116 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15117 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15118 | |
| 15119 | /*Input mixer control */ |
| 15120 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15121 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15122 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15123 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15124 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15125 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15126 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15127 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15128 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15129 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15130 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15131 | { } /* end */ |
| 15132 | }; |
| 15133 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15134 | static const struct snd_kcontrol_new alc861_3ST_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15135 | /* output mixer control */ |
| 15136 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15137 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15138 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15139 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15140 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15141 | |
| 15142 | /* Input mixer control */ |
| 15143 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15144 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15145 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15146 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15147 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15148 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15151 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15154 | { |
| 15155 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15156 | .name = "Channel Mode", |
| 15157 | .info = alc_ch_mode_info, |
| 15158 | .get = alc_ch_mode_get, |
| 15159 | .put = alc_ch_mode_put, |
| 15160 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15161 | }, |
| 15162 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15163 | }; |
| 15164 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15165 | static const struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15166 | /* output mixer control */ |
| 15167 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15168 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15170 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15171 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15172 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15173 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15174 | static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15175 | /* output mixer control */ |
| 15176 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15177 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15178 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15179 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15180 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15181 | |
| 15182 | /* Input mixer control */ |
| 15183 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15184 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15185 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15186 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15187 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15188 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15189 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15190 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15191 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15192 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15193 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15194 | { |
| 15195 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15196 | .name = "Channel Mode", |
| 15197 | .info = alc_ch_mode_info, |
| 15198 | .get = alc_ch_mode_get, |
| 15199 | .put = alc_ch_mode_put, |
| 15200 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15201 | }, |
| 15202 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15203 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15204 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15205 | static const struct snd_kcontrol_new alc861_asus_mixer[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15206 | /* output mixer control */ |
| 15207 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15208 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15209 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15210 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15211 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15212 | |
| 15213 | /* Input mixer control */ |
| 15214 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15215 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15217 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15219 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15221 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15222 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15223 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15224 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15225 | { |
| 15226 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15227 | .name = "Channel Mode", |
| 15228 | .info = alc_ch_mode_info, |
| 15229 | .get = alc_ch_mode_get, |
| 15230 | .put = alc_ch_mode_put, |
| 15231 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15232 | }, |
| 15233 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15234 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15235 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15236 | /* additional mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15237 | static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15239 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15240 | { } |
| 15241 | }; |
| 15242 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15243 | /* |
| 15244 | * generic initialization of ADC, input mixers and output mixers |
| 15245 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15246 | static const struct hda_verb alc861_base_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15247 | /* |
| 15248 | * Unmute ADC0 and set the default input to mic-in |
| 15249 | */ |
| 15250 | /* port-A for surround (rear panel) */ |
| 15251 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15252 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15253 | /* port-B for mic-in (rear panel) with vref */ |
| 15254 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15255 | /* port-C for line-in (rear panel) */ |
| 15256 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15257 | /* port-D for Front */ |
| 15258 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15259 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15260 | /* port-E for HP out (front panel) */ |
| 15261 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15262 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15263 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15264 | /* port-F for mic-in (front panel) with vref */ |
| 15265 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15266 | /* port-G for CLFE (rear panel) */ |
| 15267 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15268 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15269 | /* port-H for side (rear panel) */ |
| 15270 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15271 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15272 | /* CD-in */ |
| 15273 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15274 | /* route front mic to ADC1*/ |
| 15275 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15276 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15278 | /* Unmute DAC0~3 & spdif out*/ |
| 15279 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15280 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15281 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15282 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15284 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15285 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15286 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15287 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15288 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15289 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15290 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15291 | /* Unmute Stereo Mixer 15 */ |
| 15292 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15293 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15294 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15295 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15296 | |
| 15297 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15298 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15299 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15300 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15301 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15302 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15303 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15304 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15305 | /* hp used DAC 3 (Front) */ |
| 15306 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15307 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15308 | |
| 15309 | { } |
| 15310 | }; |
| 15311 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15312 | static const struct hda_verb alc861_threestack_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15313 | /* |
| 15314 | * Unmute ADC0 and set the default input to mic-in |
| 15315 | */ |
| 15316 | /* port-A for surround (rear panel) */ |
| 15317 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15318 | /* port-B for mic-in (rear panel) with vref */ |
| 15319 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15320 | /* port-C for line-in (rear panel) */ |
| 15321 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15322 | /* port-D for Front */ |
| 15323 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15324 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15325 | /* port-E for HP out (front panel) */ |
| 15326 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15327 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15328 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15329 | /* port-F for mic-in (front panel) with vref */ |
| 15330 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15331 | /* port-G for CLFE (rear panel) */ |
| 15332 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15333 | /* port-H for side (rear panel) */ |
| 15334 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15335 | /* CD-in */ |
| 15336 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15337 | /* route front mic to ADC1*/ |
| 15338 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15339 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15340 | /* Unmute DAC0~3 & spdif out*/ |
| 15341 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15342 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15343 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15344 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15345 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15346 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15347 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15348 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15349 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15350 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15351 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15352 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15353 | /* Unmute Stereo Mixer 15 */ |
| 15354 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15355 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15356 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15357 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15358 | |
| 15359 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15360 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15361 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15362 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15363 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15364 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15365 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15366 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15367 | /* hp used DAC 3 (Front) */ |
| 15368 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15369 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15370 | { } |
| 15371 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15372 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15373 | static const struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15374 | /* |
| 15375 | * Unmute ADC0 and set the default input to mic-in |
| 15376 | */ |
| 15377 | /* port-A for surround (rear panel) */ |
| 15378 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15379 | /* port-B for mic-in (rear panel) with vref */ |
| 15380 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15381 | /* port-C for line-in (rear panel) */ |
| 15382 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15383 | /* port-D for Front */ |
| 15384 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15385 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15386 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15387 | /* this has to be set to VREF80 */ |
| 15388 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15389 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15390 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15391 | /* port-F for mic-in (front panel) with vref */ |
| 15392 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15393 | /* port-G for CLFE (rear panel) */ |
| 15394 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15395 | /* port-H for side (rear panel) */ |
| 15396 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15397 | /* CD-in */ |
| 15398 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15399 | /* route front mic to ADC1*/ |
| 15400 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15401 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15402 | /* Unmute DAC0~3 & spdif out*/ |
| 15403 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15404 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15405 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15406 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15407 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15408 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15409 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15410 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15411 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15412 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15413 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15414 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15415 | /* Unmute Stereo Mixer 15 */ |
| 15416 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15417 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15418 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15419 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15420 | |
| 15421 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15422 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15423 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15424 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15425 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15426 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15427 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15428 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15429 | /* hp used DAC 3 (Front) */ |
| 15430 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15431 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15432 | { } |
| 15433 | }; |
| 15434 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15435 | static const struct hda_verb alc861_asus_init_verbs[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15436 | /* |
| 15437 | * Unmute ADC0 and set the default input to mic-in |
| 15438 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15439 | /* port-A for surround (rear panel) |
| 15440 | * according to codec#0 this is the HP jack |
| 15441 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15442 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15443 | /* route front PCM to HP */ |
| 15444 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15445 | /* port-B for mic-in (rear panel) with vref */ |
| 15446 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15447 | /* port-C for line-in (rear panel) */ |
| 15448 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15449 | /* port-D for Front */ |
| 15450 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15451 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15452 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15453 | /* this has to be set to VREF80 */ |
| 15454 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15455 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15456 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15457 | /* port-F for mic-in (front panel) with vref */ |
| 15458 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15459 | /* port-G for CLFE (rear panel) */ |
| 15460 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15461 | /* port-H for side (rear panel) */ |
| 15462 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15463 | /* CD-in */ |
| 15464 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15465 | /* route front mic to ADC1*/ |
| 15466 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15467 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15468 | /* Unmute DAC0~3 & spdif out*/ |
| 15469 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15470 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15471 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15472 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15473 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15474 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15475 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15476 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15477 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15478 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15479 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15480 | /* Unmute Stereo Mixer 15 */ |
| 15481 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15482 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15483 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15484 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15485 | |
| 15486 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15487 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15488 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15489 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15490 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15491 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15492 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15493 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15494 | /* hp used DAC 3 (Front) */ |
| 15495 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15496 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15497 | { } |
| 15498 | }; |
| 15499 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15500 | /* additional init verbs for ASUS laptops */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15501 | static const struct hda_verb alc861_asus_laptop_init_verbs[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15502 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15503 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15504 | { } |
| 15505 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15506 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15507 | static const struct hda_verb alc861_toshiba_init_verbs[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15508 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15509 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15510 | { } |
| 15511 | }; |
| 15512 | |
| 15513 | /* toggle speaker-output according to the hp-jack state */ |
| 15514 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15515 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15516 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15517 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15518 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15519 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15520 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15521 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15522 | } |
| 15523 | |
| 15524 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15525 | unsigned int res) |
| 15526 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15527 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15528 | alc861_toshiba_automute(codec); |
| 15529 | } |
| 15530 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15531 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15532 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15533 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15534 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15535 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15536 | |
| 15537 | |
| 15538 | #define ALC861_DIGOUT_NID 0x07 |
| 15539 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15540 | static const struct hda_channel_mode alc861_8ch_modes[1] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15541 | { 8, NULL } |
| 15542 | }; |
| 15543 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15544 | static const hda_nid_t alc861_dac_nids[4] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15545 | /* front, surround, clfe, side */ |
| 15546 | 0x03, 0x06, 0x05, 0x04 |
| 15547 | }; |
| 15548 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15549 | static const hda_nid_t alc660_dac_nids[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15550 | /* front, clfe, surround */ |
| 15551 | 0x03, 0x05, 0x06 |
| 15552 | }; |
| 15553 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15554 | static const hda_nid_t alc861_adc_nids[1] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15555 | /* ADC0-2 */ |
| 15556 | 0x08, |
| 15557 | }; |
| 15558 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15559 | static const struct hda_input_mux alc861_capture_source = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15560 | .num_items = 5, |
| 15561 | .items = { |
| 15562 | { "Mic", 0x0 }, |
| 15563 | { "Front Mic", 0x3 }, |
| 15564 | { "Line", 0x1 }, |
| 15565 | { "CD", 0x4 }, |
| 15566 | { "Mixer", 0x5 }, |
| 15567 | }, |
| 15568 | }; |
| 15569 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15570 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15571 | { |
| 15572 | struct alc_spec *spec = codec->spec; |
| 15573 | hda_nid_t mix, srcs[5]; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 15574 | int i, num; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15575 | |
| 15576 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15577 | return 0; |
| 15578 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15579 | if (num < 0) |
| 15580 | return 0; |
| 15581 | for (i = 0; i < num; i++) { |
| 15582 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15583 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15584 | if (type != AC_WID_AUD_OUT) |
| 15585 | continue; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 15586 | if (!found_in_nid_list(srcs[i], spec->multiout.dac_nids, |
| 15587 | spec->multiout.num_dacs)) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15588 | return srcs[i]; |
| 15589 | } |
| 15590 | return 0; |
| 15591 | } |
| 15592 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15593 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 15594 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15595 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15596 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 15597 | const struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15598 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15599 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15600 | |
| 15601 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15602 | for (i = 0; i < cfg->line_outs; i++) { |
| 15603 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15604 | dac = alc861_look_for_dac(codec, nid); |
| 15605 | if (!dac) |
| 15606 | continue; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 15607 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15608 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15609 | return 0; |
| 15610 | } |
| 15611 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15612 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15613 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15614 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15615 | 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] | 15616 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15617 | } |
| 15618 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15619 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15620 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15621 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15622 | /* add playback controls from the parsed DAC table */ |
| 15623 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15624 | const struct auto_pin_cfg *cfg) |
| 15625 | { |
| 15626 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15627 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15628 | int i, err, noutputs; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15629 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15630 | noutputs = cfg->line_outs; |
| 15631 | if (spec->multi_ios > 0) |
| 15632 | noutputs += spec->multi_ios; |
| 15633 | |
| 15634 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 15635 | const char *name; |
| 15636 | int index; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15637 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15638 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15639 | continue; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 15640 | name = alc_get_line_out_pfx(spec, i, true, &index); |
| 15641 | if (!name) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15642 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15643 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15644 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15645 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15646 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15647 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15648 | return err; |
| 15649 | } else { |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15650 | err = __alc861_create_out_sw(codec, name, nid, index, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15651 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15652 | return err; |
| 15653 | } |
| 15654 | } |
| 15655 | return 0; |
| 15656 | } |
| 15657 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15658 | 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] | 15659 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15660 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15661 | int err; |
| 15662 | hda_nid_t nid; |
| 15663 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15664 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15665 | return 0; |
| 15666 | |
| 15667 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15668 | nid = alc861_look_for_dac(codec, pin); |
| 15669 | if (nid) { |
| 15670 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15671 | if (err < 0) |
| 15672 | return err; |
| 15673 | spec->multiout.hp_nid = nid; |
| 15674 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15675 | } |
| 15676 | return 0; |
| 15677 | } |
| 15678 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15679 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15680 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15681 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15682 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15683 | hda_nid_t mix, srcs[5]; |
| 15684 | int i, num; |
| 15685 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15686 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15687 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15688 | 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] | 15689 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15690 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15691 | return; |
| 15692 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15693 | if (num < 0) |
| 15694 | return; |
| 15695 | for (i = 0; i < num; i++) { |
| 15696 | unsigned int mute; |
| 15697 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15698 | mute = AMP_IN_UNMUTE(i); |
| 15699 | else |
| 15700 | mute = AMP_IN_MUTE(i); |
| 15701 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15702 | mute); |
| 15703 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15704 | } |
| 15705 | |
| 15706 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15707 | { |
| 15708 | struct alc_spec *spec = codec->spec; |
| 15709 | int i; |
| 15710 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 15711 | for (i = 0; i < spec->autocfg.line_outs + spec->multi_ios; i++) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15712 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15713 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15714 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15715 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15716 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15717 | } |
| 15718 | } |
| 15719 | |
| 15720 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15721 | { |
| 15722 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15723 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15724 | if (spec->autocfg.hp_outs) |
| 15725 | alc861_auto_set_output_and_unmute(codec, |
| 15726 | spec->autocfg.hp_pins[0], |
| 15727 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15728 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15729 | if (spec->autocfg.speaker_outs) |
| 15730 | alc861_auto_set_output_and_unmute(codec, |
| 15731 | spec->autocfg.speaker_pins[0], |
| 15732 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15733 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15734 | } |
| 15735 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15736 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15737 | /* return 1 if successful, 0 if the proper config is not found, |
| 15738 | * or a negative error code |
| 15739 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15740 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15741 | { |
| 15742 | struct alc_spec *spec = codec->spec; |
| 15743 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15744 | static const hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15745 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15746 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15747 | alc861_ignore); |
| 15748 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15749 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15750 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15751 | return 0; /* can't find valid BIOS pin config */ |
| 15752 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 15753 | err = alc861_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15754 | if (err < 0) |
| 15755 | return err; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 15756 | 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] | 15757 | if (err < 0) |
| 15758 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15759 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15760 | if (err < 0) |
| 15761 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15762 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15763 | if (err < 0) |
| 15764 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 15765 | err = alc_auto_create_input_ctls(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15766 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15767 | return err; |
| 15768 | |
| 15769 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15770 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15771 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15772 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15773 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15774 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15775 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15776 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15777 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15778 | |
| 15779 | spec->adc_nids = alc861_adc_nids; |
| 15780 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15781 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15782 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15783 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15784 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15785 | return 1; |
| 15786 | } |
| 15787 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15788 | /* additional initialization for auto-configuration model */ |
| 15789 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15790 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15791 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15792 | alc861_auto_init_multi_out(codec); |
| 15793 | alc861_auto_init_hp_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 15794 | alc_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15795 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15796 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15797 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15798 | } |
| 15799 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15800 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15801 | static const struct hda_amp_list alc861_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15802 | { 0x15, HDA_INPUT, 0 }, |
| 15803 | { 0x15, HDA_INPUT, 1 }, |
| 15804 | { 0x15, HDA_INPUT, 2 }, |
| 15805 | { 0x15, HDA_INPUT, 3 }, |
| 15806 | { } /* end */ |
| 15807 | }; |
| 15808 | #endif |
| 15809 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15810 | |
| 15811 | /* |
| 15812 | * configuration and preset |
| 15813 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 15814 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15815 | [ALC861_3ST] = "3stack", |
| 15816 | [ALC660_3ST] = "3stack-660", |
| 15817 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15818 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15819 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15820 | [ALC861_TOSHIBA] = "toshiba", |
| 15821 | [ALC861_ASUS] = "asus", |
| 15822 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15823 | [ALC861_AUTO] = "auto", |
| 15824 | }; |
| 15825 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15826 | static const struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15827 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15828 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15829 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15830 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15831 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15832 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15833 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15834 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15835 | * Any other models that need this preset? |
| 15836 | */ |
| 15837 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15838 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15839 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15840 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15841 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15842 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15843 | /* FIXME: the below seems conflict */ |
| 15844 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15845 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15846 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15847 | {} |
| 15848 | }; |
| 15849 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15850 | static const struct alc_config_preset alc861_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15851 | [ALC861_3ST] = { |
| 15852 | .mixers = { alc861_3ST_mixer }, |
| 15853 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15854 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15855 | .dac_nids = alc861_dac_nids, |
| 15856 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15857 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15858 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15859 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15860 | .adc_nids = alc861_adc_nids, |
| 15861 | .input_mux = &alc861_capture_source, |
| 15862 | }, |
| 15863 | [ALC861_3ST_DIG] = { |
| 15864 | .mixers = { alc861_base_mixer }, |
| 15865 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15866 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15867 | .dac_nids = alc861_dac_nids, |
| 15868 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15869 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15870 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15871 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15872 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15873 | .adc_nids = alc861_adc_nids, |
| 15874 | .input_mux = &alc861_capture_source, |
| 15875 | }, |
| 15876 | [ALC861_6ST_DIG] = { |
| 15877 | .mixers = { alc861_base_mixer }, |
| 15878 | .init_verbs = { alc861_base_init_verbs }, |
| 15879 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15880 | .dac_nids = alc861_dac_nids, |
| 15881 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15882 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15883 | .channel_mode = alc861_8ch_modes, |
| 15884 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15885 | .adc_nids = alc861_adc_nids, |
| 15886 | .input_mux = &alc861_capture_source, |
| 15887 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15888 | [ALC660_3ST] = { |
| 15889 | .mixers = { alc861_3ST_mixer }, |
| 15890 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15891 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15892 | .dac_nids = alc660_dac_nids, |
| 15893 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15894 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15895 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15896 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15897 | .adc_nids = alc861_adc_nids, |
| 15898 | .input_mux = &alc861_capture_source, |
| 15899 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15900 | [ALC861_UNIWILL_M31] = { |
| 15901 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15902 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15903 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15904 | .dac_nids = alc861_dac_nids, |
| 15905 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15906 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15907 | .channel_mode = alc861_uniwill_m31_modes, |
| 15908 | .need_dac_fix = 1, |
| 15909 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15910 | .adc_nids = alc861_adc_nids, |
| 15911 | .input_mux = &alc861_capture_source, |
| 15912 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15913 | [ALC861_TOSHIBA] = { |
| 15914 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15915 | .init_verbs = { alc861_base_init_verbs, |
| 15916 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15917 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15918 | .dac_nids = alc861_dac_nids, |
| 15919 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15920 | .channel_mode = alc883_3ST_2ch_modes, |
| 15921 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15922 | .adc_nids = alc861_adc_nids, |
| 15923 | .input_mux = &alc861_capture_source, |
| 15924 | .unsol_event = alc861_toshiba_unsol_event, |
| 15925 | .init_hook = alc861_toshiba_automute, |
| 15926 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15927 | [ALC861_ASUS] = { |
| 15928 | .mixers = { alc861_asus_mixer }, |
| 15929 | .init_verbs = { alc861_asus_init_verbs }, |
| 15930 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15931 | .dac_nids = alc861_dac_nids, |
| 15932 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15933 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15934 | .channel_mode = alc861_asus_modes, |
| 15935 | .need_dac_fix = 1, |
| 15936 | .hp_nid = 0x06, |
| 15937 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15938 | .adc_nids = alc861_adc_nids, |
| 15939 | .input_mux = &alc861_capture_source, |
| 15940 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15941 | [ALC861_ASUS_LAPTOP] = { |
| 15942 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15943 | .init_verbs = { alc861_asus_init_verbs, |
| 15944 | alc861_asus_laptop_init_verbs }, |
| 15945 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15946 | .dac_nids = alc861_dac_nids, |
| 15947 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15948 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15949 | .channel_mode = alc883_3ST_2ch_modes, |
| 15950 | .need_dac_fix = 1, |
| 15951 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15952 | .adc_nids = alc861_adc_nids, |
| 15953 | .input_mux = &alc861_capture_source, |
| 15954 | }, |
| 15955 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15956 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15957 | /* Pin config fixes */ |
| 15958 | enum { |
| 15959 | PINFIX_FSC_AMILO_PI1505, |
| 15960 | }; |
| 15961 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15962 | static const struct alc_fixup alc861_fixups[] = { |
| 15963 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15964 | .type = ALC_FIXUP_PINS, |
| 15965 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 15966 | { 0x0b, 0x0221101f }, /* HP */ |
| 15967 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15968 | { } |
| 15969 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15970 | }, |
| 15971 | }; |
| 15972 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15973 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15974 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15975 | {} |
| 15976 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15977 | |
| 15978 | static int patch_alc861(struct hda_codec *codec) |
| 15979 | { |
| 15980 | struct alc_spec *spec; |
| 15981 | int board_config; |
| 15982 | int err; |
| 15983 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15984 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15985 | if (spec == NULL) |
| 15986 | return -ENOMEM; |
| 15987 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15988 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15989 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 15990 | spec->mixer_nid = 0x15; |
| 15991 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15992 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15993 | alc861_models, |
| 15994 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15995 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15996 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15997 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15998 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15999 | board_config = ALC861_AUTO; |
| 16000 | } |
| 16001 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16002 | if (board_config == ALC861_AUTO) { |
| 16003 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16004 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16005 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16006 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16007 | if (board_config == ALC861_AUTO) { |
| 16008 | /* automatic parse from the BIOS config */ |
| 16009 | err = alc861_parse_auto_config(codec); |
| 16010 | if (err < 0) { |
| 16011 | alc_free(codec); |
| 16012 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16013 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16014 | printk(KERN_INFO |
| 16015 | "hda_codec: Cannot set up configuration " |
| 16016 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16017 | board_config = ALC861_3ST_DIG; |
| 16018 | } |
| 16019 | } |
| 16020 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16021 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16022 | if (err < 0) { |
| 16023 | alc_free(codec); |
| 16024 | return err; |
| 16025 | } |
| 16026 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16027 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16028 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16029 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16030 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16031 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16032 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16033 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16034 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16035 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16036 | if (!spec->cap_mixer) |
| 16037 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16038 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16039 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16040 | spec->vmaster_nid = 0x03; |
| 16041 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16042 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16043 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16044 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16045 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16046 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16047 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16048 | spec->power_hook = alc_power_eapd; |
| 16049 | #endif |
| 16050 | } |
| 16051 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16052 | if (!spec->loopback.amplist) |
| 16053 | spec->loopback.amplist = alc861_loopbacks; |
| 16054 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16055 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16056 | return 0; |
| 16057 | } |
| 16058 | |
| 16059 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16060 | * ALC861-VD support |
| 16061 | * |
| 16062 | * Based on ALC882 |
| 16063 | * |
| 16064 | * In addition, an independent DAC |
| 16065 | */ |
| 16066 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16067 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16068 | static const hda_nid_t alc861vd_dac_nids[4] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16069 | /* front, surr, clfe, side surr */ |
| 16070 | 0x02, 0x03, 0x04, 0x05 |
| 16071 | }; |
| 16072 | |
| 16073 | /* dac_nids for ALC660vd are in a different order - according to |
| 16074 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16075 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16076 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16077 | * - and it is the same as in 861vd. |
| 16078 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16079 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16080 | static const hda_nid_t alc660vd_dac_nids[3] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16081 | /* front, rear, clfe, rear_surr */ |
| 16082 | 0x02, 0x04, 0x03 |
| 16083 | }; |
| 16084 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16085 | static const hda_nid_t alc861vd_adc_nids[1] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16086 | /* ADC0 */ |
| 16087 | 0x09, |
| 16088 | }; |
| 16089 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16090 | static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16091 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16092 | /* input MUX */ |
| 16093 | /* FIXME: should be a matrix-type input source selection */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16094 | static const struct hda_input_mux alc861vd_capture_source = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16095 | .num_items = 4, |
| 16096 | .items = { |
| 16097 | { "Mic", 0x0 }, |
| 16098 | { "Front Mic", 0x1 }, |
| 16099 | { "Line", 0x2 }, |
| 16100 | { "CD", 0x4 }, |
| 16101 | }, |
| 16102 | }; |
| 16103 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16104 | static const struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16105 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16106 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16107 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16108 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16109 | }, |
| 16110 | }; |
| 16111 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16112 | static const struct hda_input_mux alc861vd_hp_capture_source = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16113 | .num_items = 2, |
| 16114 | .items = { |
| 16115 | { "Front Mic", 0x0 }, |
| 16116 | { "ATAPI Mic", 0x1 }, |
| 16117 | }, |
| 16118 | }; |
| 16119 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16120 | /* |
| 16121 | * 2ch mode |
| 16122 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16123 | static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16124 | { 2, NULL } |
| 16125 | }; |
| 16126 | |
| 16127 | /* |
| 16128 | * 6ch mode |
| 16129 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16130 | static const struct hda_verb alc861vd_6stack_ch6_init[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16131 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16132 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16133 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16134 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16135 | { } /* end */ |
| 16136 | }; |
| 16137 | |
| 16138 | /* |
| 16139 | * 8ch mode |
| 16140 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16141 | static const struct hda_verb alc861vd_6stack_ch8_init[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16142 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16143 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16144 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16145 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16146 | { } /* end */ |
| 16147 | }; |
| 16148 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16149 | static const struct hda_channel_mode alc861vd_6stack_modes[2] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16150 | { 6, alc861vd_6stack_ch6_init }, |
| 16151 | { 8, alc861vd_6stack_ch8_init }, |
| 16152 | }; |
| 16153 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16154 | static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16155 | { |
| 16156 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16157 | .name = "Channel Mode", |
| 16158 | .info = alc_ch_mode_info, |
| 16159 | .get = alc_ch_mode_get, |
| 16160 | .put = alc_ch_mode_put, |
| 16161 | }, |
| 16162 | { } /* end */ |
| 16163 | }; |
| 16164 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16165 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16166 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16167 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16168 | static const struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16169 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16170 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16171 | |
| 16172 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16173 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16174 | |
| 16175 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16176 | HDA_OUTPUT), |
| 16177 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16178 | HDA_OUTPUT), |
| 16179 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16180 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16181 | |
| 16182 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16183 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16184 | |
| 16185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16186 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16187 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16188 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16189 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16190 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16191 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16192 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16193 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16194 | |
| 16195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16196 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16197 | |
| 16198 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16199 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16200 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16201 | { } /* end */ |
| 16202 | }; |
| 16203 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16204 | static const struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16205 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16206 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16207 | |
| 16208 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16209 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16210 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16213 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16214 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16215 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16216 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16217 | |
| 16218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16219 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16220 | |
| 16221 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16222 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16223 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16224 | { } /* end */ |
| 16225 | }; |
| 16226 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16227 | static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16228 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16229 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16230 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16231 | |
| 16232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16233 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16234 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16236 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16237 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16238 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16239 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16240 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16241 | |
| 16242 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16243 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16244 | |
| 16245 | { } /* end */ |
| 16246 | }; |
| 16247 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16248 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16249 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16250 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16251 | static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16252 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16253 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16254 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16255 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16256 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16259 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16260 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16261 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16262 | { } /* end */ |
| 16263 | }; |
| 16264 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16265 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16266 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16267 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16268 | static const struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16269 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16270 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16271 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16272 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16273 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16274 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16275 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16276 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16277 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16278 | { } /* end */ |
| 16279 | }; |
| 16280 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16281 | /* |
| 16282 | * generic initialization of ADC, input mixers and output mixers |
| 16283 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16284 | static const struct hda_verb alc861vd_volume_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16285 | /* |
| 16286 | * Unmute ADC0 and set the default input to mic-in |
| 16287 | */ |
| 16288 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16289 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16290 | |
| 16291 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16292 | * the analog-loopback mixer widget |
| 16293 | */ |
| 16294 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16296 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16297 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16298 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16300 | |
| 16301 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16304 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16305 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16306 | |
| 16307 | /* |
| 16308 | * Set up output mixers (0x02 - 0x05) |
| 16309 | */ |
| 16310 | /* set vol=0 to output mixers */ |
| 16311 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16312 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16313 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16314 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16315 | |
| 16316 | /* set up input amps for analog loopback */ |
| 16317 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16319 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16320 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16321 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16322 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16323 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16324 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16325 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16326 | |
| 16327 | { } |
| 16328 | }; |
| 16329 | |
| 16330 | /* |
| 16331 | * 3-stack pin configuration: |
| 16332 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16333 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16334 | static const struct hda_verb alc861vd_3stack_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16335 | /* |
| 16336 | * Set pin mode and muting |
| 16337 | */ |
| 16338 | /* set front pin widgets 0x14 for output */ |
| 16339 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16340 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16341 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16342 | |
| 16343 | /* Mic (rear) pin: input vref at 80% */ |
| 16344 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16345 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16346 | /* Front Mic pin: input vref at 80% */ |
| 16347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16348 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16349 | /* Line In pin: input */ |
| 16350 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16351 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16352 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16353 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16354 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16355 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16356 | /* CD pin widget for input */ |
| 16357 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16358 | |
| 16359 | { } |
| 16360 | }; |
| 16361 | |
| 16362 | /* |
| 16363 | * 6-stack pin configuration: |
| 16364 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16365 | static const struct hda_verb alc861vd_6stack_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16366 | /* |
| 16367 | * Set pin mode and muting |
| 16368 | */ |
| 16369 | /* set front pin widgets 0x14 for output */ |
| 16370 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16371 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16372 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16373 | |
| 16374 | /* Rear Pin: output 1 (0x0d) */ |
| 16375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16376 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16377 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16378 | /* CLFE Pin: output 2 (0x0e) */ |
| 16379 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16380 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16381 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16382 | /* Side Pin: output 3 (0x0f) */ |
| 16383 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16384 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16385 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16386 | |
| 16387 | /* Mic (rear) pin: input vref at 80% */ |
| 16388 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16389 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16390 | /* Front Mic pin: input vref at 80% */ |
| 16391 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16392 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16393 | /* Line In pin: input */ |
| 16394 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16395 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16396 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16397 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16398 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16399 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16400 | /* CD pin widget for input */ |
| 16401 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16402 | |
| 16403 | { } |
| 16404 | }; |
| 16405 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16406 | static const struct hda_verb alc861vd_eapd_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16407 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16408 | { } |
| 16409 | }; |
| 16410 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16411 | static const struct hda_verb alc660vd_eapd_verbs[] = { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16412 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16413 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16414 | { } |
| 16415 | }; |
| 16416 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16417 | static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16418 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16419 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16420 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16421 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16422 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16423 | {} |
| 16424 | }; |
| 16425 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16426 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16427 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16428 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16429 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16430 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16431 | spec->automute = 1; |
| 16432 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16433 | } |
| 16434 | |
| 16435 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16436 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16437 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16438 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16439 | } |
| 16440 | |
| 16441 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16442 | unsigned int res) |
| 16443 | { |
| 16444 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16445 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16446 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16447 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16448 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16449 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16450 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16451 | } |
| 16452 | } |
| 16453 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16454 | static const struct hda_verb alc861vd_dallas_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16455 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16456 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16457 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16458 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16459 | |
| 16460 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16462 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16463 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16464 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16465 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16466 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16467 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16468 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16469 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16470 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16472 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16473 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16474 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16475 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16476 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16477 | |
| 16478 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16479 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16480 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16481 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16482 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16483 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16484 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16485 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16486 | |
| 16487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16488 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16489 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16490 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16491 | |
| 16492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16493 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16494 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16495 | |
| 16496 | { } /* end */ |
| 16497 | }; |
| 16498 | |
| 16499 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16500 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16501 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16502 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16503 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16504 | spec->autocfg.hp_pins[0] = 0x15; |
| 16505 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16506 | spec->automute = 1; |
| 16507 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16508 | } |
| 16509 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16510 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16511 | #define alc861vd_loopbacks alc880_loopbacks |
| 16512 | #endif |
| 16513 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16514 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16515 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16516 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16517 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16518 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16519 | |
| 16520 | /* |
| 16521 | * configuration and preset |
| 16522 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16523 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16524 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16525 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16526 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16527 | [ALC861VD_3ST] = "3stack", |
| 16528 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16529 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16530 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16531 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16532 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16533 | [ALC861VD_AUTO] = "auto", |
| 16534 | }; |
| 16535 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16536 | static const struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16537 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16538 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16539 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16540 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16541 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16542 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16543 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16544 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16545 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16546 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16547 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16548 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16549 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16550 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16551 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16552 | {} |
| 16553 | }; |
| 16554 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16555 | static const struct alc_config_preset alc861vd_presets[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16556 | [ALC660VD_3ST] = { |
| 16557 | .mixers = { alc861vd_3st_mixer }, |
| 16558 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16559 | alc861vd_3stack_init_verbs }, |
| 16560 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16561 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16562 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16563 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16564 | .input_mux = &alc861vd_capture_source, |
| 16565 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16566 | [ALC660VD_3ST_DIG] = { |
| 16567 | .mixers = { alc861vd_3st_mixer }, |
| 16568 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16569 | alc861vd_3stack_init_verbs }, |
| 16570 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16571 | .dac_nids = alc660vd_dac_nids, |
| 16572 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16573 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16574 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16575 | .input_mux = &alc861vd_capture_source, |
| 16576 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16577 | [ALC861VD_3ST] = { |
| 16578 | .mixers = { alc861vd_3st_mixer }, |
| 16579 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16580 | alc861vd_3stack_init_verbs }, |
| 16581 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16582 | .dac_nids = alc861vd_dac_nids, |
| 16583 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16584 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16585 | .input_mux = &alc861vd_capture_source, |
| 16586 | }, |
| 16587 | [ALC861VD_3ST_DIG] = { |
| 16588 | .mixers = { alc861vd_3st_mixer }, |
| 16589 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16590 | alc861vd_3stack_init_verbs }, |
| 16591 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16592 | .dac_nids = alc861vd_dac_nids, |
| 16593 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16594 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16595 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16596 | .input_mux = &alc861vd_capture_source, |
| 16597 | }, |
| 16598 | [ALC861VD_6ST_DIG] = { |
| 16599 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16600 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16601 | alc861vd_6stack_init_verbs }, |
| 16602 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16603 | .dac_nids = alc861vd_dac_nids, |
| 16604 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16605 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16606 | .channel_mode = alc861vd_6stack_modes, |
| 16607 | .input_mux = &alc861vd_capture_source, |
| 16608 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16609 | [ALC861VD_LENOVO] = { |
| 16610 | .mixers = { alc861vd_lenovo_mixer }, |
| 16611 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16612 | alc861vd_3stack_init_verbs, |
| 16613 | alc861vd_eapd_verbs, |
| 16614 | alc861vd_lenovo_unsol_verbs }, |
| 16615 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16616 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16617 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16618 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16619 | .input_mux = &alc861vd_capture_source, |
| 16620 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16621 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16622 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16623 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16624 | [ALC861VD_DALLAS] = { |
| 16625 | .mixers = { alc861vd_dallas_mixer }, |
| 16626 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16627 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16628 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16629 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16630 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16631 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16632 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16633 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16634 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16635 | }, |
| 16636 | [ALC861VD_HP] = { |
| 16637 | .mixers = { alc861vd_hp_mixer }, |
| 16638 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16639 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16640 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16641 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16642 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16643 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16644 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16645 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16646 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16647 | .init_hook = alc_hp_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16648 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16649 | [ALC660VD_ASUS_V1S] = { |
| 16650 | .mixers = { alc861vd_lenovo_mixer }, |
| 16651 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16652 | alc861vd_3stack_init_verbs, |
| 16653 | alc861vd_eapd_verbs, |
| 16654 | alc861vd_lenovo_unsol_verbs }, |
| 16655 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16656 | .dac_nids = alc660vd_dac_nids, |
| 16657 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16658 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16659 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16660 | .input_mux = &alc861vd_capture_source, |
| 16661 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16662 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16663 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16664 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16665 | }; |
| 16666 | |
| 16667 | /* |
| 16668 | * BIOS auto configuration |
| 16669 | */ |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16670 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16671 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16672 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16673 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16674 | |
| 16675 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 16676 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16677 | * different NIDs for mute/unmute switch and volume control */ |
| 16678 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16679 | const struct auto_pin_cfg *cfg) |
| 16680 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16681 | hda_nid_t nid_v, nid_s; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16682 | int i, err, noutputs; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16683 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16684 | noutputs = cfg->line_outs; |
| 16685 | if (spec->multi_ios > 0) |
| 16686 | noutputs += spec->multi_ios; |
| 16687 | |
| 16688 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 16689 | const char *name; |
| 16690 | int index; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16691 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16692 | continue; |
| 16693 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16694 | alc880_dac_to_idx( |
| 16695 | spec->multiout.dac_nids[i])); |
| 16696 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16697 | alc880_dac_to_idx( |
| 16698 | spec->multiout.dac_nids[i])); |
| 16699 | |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 16700 | name = alc_get_line_out_pfx(spec, i, true, &index); |
| 16701 | if (!name) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16702 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16703 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16704 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16705 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16706 | HDA_OUTPUT)); |
| 16707 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16708 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16709 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16710 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16711 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16712 | HDA_OUTPUT)); |
| 16713 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16714 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16715 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16716 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16717 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16718 | HDA_INPUT)); |
| 16719 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16720 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16721 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16722 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16723 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16724 | HDA_INPUT)); |
| 16725 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16726 | return err; |
| 16727 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16728 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 16729 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16730 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16731 | HDA_OUTPUT)); |
| 16732 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16733 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16734 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 16735 | name, index, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16736 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16737 | HDA_INPUT)); |
| 16738 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16739 | return err; |
| 16740 | } |
| 16741 | } |
| 16742 | return 0; |
| 16743 | } |
| 16744 | |
| 16745 | /* add playback controls for speaker and HP outputs */ |
| 16746 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16747 | * different NIDs for mute/unmute switch and volume control */ |
| 16748 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16749 | hda_nid_t pin, const char *pfx) |
| 16750 | { |
| 16751 | hda_nid_t nid_v, nid_s; |
| 16752 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16753 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16754 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16755 | return 0; |
| 16756 | |
| 16757 | if (alc880_is_fixed_pin(pin)) { |
| 16758 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16759 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16760 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16761 | spec->multiout.hp_nid = nid_v; |
| 16762 | else |
| 16763 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16764 | /* control HP volume/switch on the output mixer amp */ |
| 16765 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16766 | alc880_fixed_pin_idx(pin)); |
| 16767 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16768 | alc880_fixed_pin_idx(pin)); |
| 16769 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16770 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16771 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16772 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16773 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16774 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16775 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16776 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16777 | return err; |
| 16778 | } else if (alc880_is_multi_pin(pin)) { |
| 16779 | /* set manual connection */ |
| 16780 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16781 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16782 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16783 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16784 | return err; |
| 16785 | } |
| 16786 | return 0; |
| 16787 | } |
| 16788 | |
| 16789 | /* parse the BIOS configuration and set up the alc_spec |
| 16790 | * return 1 if successful, 0 if the proper config is not found, |
| 16791 | * or a negative error code |
| 16792 | * Based on ALC880 version - had to change it to override |
| 16793 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16794 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16795 | { |
| 16796 | struct alc_spec *spec = codec->spec; |
| 16797 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16798 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16799 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16800 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16801 | alc861vd_ignore); |
| 16802 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16803 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16804 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16805 | return 0; /* can't find valid BIOS pin config */ |
| 16806 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 16807 | err = alc_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16808 | if (err < 0) |
| 16809 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 16810 | err = alc_auto_add_multi_channel_mode(codec, alc_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16811 | if (err < 0) |
| 16812 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16813 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16814 | if (err < 0) |
| 16815 | return err; |
| 16816 | err = alc861vd_auto_create_extra_out(spec, |
| 16817 | spec->autocfg.speaker_pins[0], |
| 16818 | "Speaker"); |
| 16819 | if (err < 0) |
| 16820 | return err; |
| 16821 | err = alc861vd_auto_create_extra_out(spec, |
| 16822 | spec->autocfg.hp_pins[0], |
| 16823 | "Headphone"); |
| 16824 | if (err < 0) |
| 16825 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 16826 | err = alc_auto_create_input_ctls(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16827 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16828 | return err; |
| 16829 | |
| 16830 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16831 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16832 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16833 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16834 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16835 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16836 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16837 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16838 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16839 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16840 | err = alc_auto_add_mic_boost(codec); |
| 16841 | if (err < 0) |
| 16842 | return err; |
| 16843 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16844 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16845 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16846 | return 1; |
| 16847 | } |
| 16848 | |
| 16849 | /* additional initialization for auto-configuration model */ |
| 16850 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16851 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16852 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 16853 | alc_auto_init_multi_out(codec); |
| 16854 | alc_auto_init_extra_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 16855 | alc_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16856 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16857 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16858 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16859 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16860 | } |
| 16861 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16862 | enum { |
| 16863 | ALC660VD_FIX_ASUS_GPIO1 |
| 16864 | }; |
| 16865 | |
| 16866 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16867 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16868 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16869 | .type = ALC_FIXUP_VERBS, |
| 16870 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16871 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16872 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16873 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16874 | { } |
| 16875 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16876 | }, |
| 16877 | }; |
| 16878 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16879 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16880 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16881 | {} |
| 16882 | }; |
| 16883 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16884 | static int patch_alc861vd(struct hda_codec *codec) |
| 16885 | { |
| 16886 | struct alc_spec *spec; |
| 16887 | int err, board_config; |
| 16888 | |
| 16889 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16890 | if (spec == NULL) |
| 16891 | return -ENOMEM; |
| 16892 | |
| 16893 | codec->spec = spec; |
| 16894 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 16895 | spec->mixer_nid = 0x0b; |
| 16896 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16897 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16898 | alc861vd_models, |
| 16899 | alc861vd_cfg_tbl); |
| 16900 | |
| 16901 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16902 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16903 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16904 | board_config = ALC861VD_AUTO; |
| 16905 | } |
| 16906 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16907 | if (board_config == ALC861VD_AUTO) { |
| 16908 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 16909 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16910 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16911 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16912 | if (board_config == ALC861VD_AUTO) { |
| 16913 | /* automatic parse from the BIOS config */ |
| 16914 | err = alc861vd_parse_auto_config(codec); |
| 16915 | if (err < 0) { |
| 16916 | alc_free(codec); |
| 16917 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16918 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16919 | printk(KERN_INFO |
| 16920 | "hda_codec: Cannot set up configuration " |
| 16921 | "from BIOS. Using base mode...\n"); |
| 16922 | board_config = ALC861VD_3ST; |
| 16923 | } |
| 16924 | } |
| 16925 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16926 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16927 | if (err < 0) { |
| 16928 | alc_free(codec); |
| 16929 | return err; |
| 16930 | } |
| 16931 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16932 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16933 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16934 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16935 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16936 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16937 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16938 | } |
| 16939 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16940 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16941 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16942 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16943 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16944 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16945 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16946 | if (!spec->adc_nids) { |
| 16947 | spec->adc_nids = alc861vd_adc_nids; |
| 16948 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16949 | } |
| 16950 | if (!spec->capsrc_nids) |
| 16951 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16952 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16953 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16954 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16955 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16956 | spec->vmaster_nid = 0x02; |
| 16957 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16958 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16959 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16960 | codec->patch_ops = alc_patch_ops; |
| 16961 | |
| 16962 | if (board_config == ALC861VD_AUTO) |
| 16963 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 16964 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16965 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16966 | if (!spec->loopback.amplist) |
| 16967 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16968 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16969 | |
| 16970 | return 0; |
| 16971 | } |
| 16972 | |
| 16973 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16974 | * ALC662 support |
| 16975 | * |
| 16976 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16977 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16978 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16979 | * 6-channel independent captures. |
| 16980 | * |
| 16981 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16982 | * driver yet). |
| 16983 | */ |
| 16984 | #define ALC662_DIGOUT_NID 0x06 |
| 16985 | #define ALC662_DIGIN_NID 0x0a |
| 16986 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16987 | static const hda_nid_t alc662_dac_nids[3] = { |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 16988 | /* front, rear, clfe */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16989 | 0x02, 0x03, 0x04 |
| 16990 | }; |
| 16991 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16992 | static const hda_nid_t alc272_dac_nids[2] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16993 | 0x02, 0x03 |
| 16994 | }; |
| 16995 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16996 | static const hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16997 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16998 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16999 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17000 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17001 | static const hda_nid_t alc272_adc_nids[1] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17002 | /* ADC1-2 */ |
| 17003 | 0x08, |
| 17004 | }; |
| 17005 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17006 | static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
| 17007 | static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17008 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17009 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17010 | /* input MUX */ |
| 17011 | /* FIXME: should be a matrix-type input source selection */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17012 | static const struct hda_input_mux alc662_capture_source = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17013 | .num_items = 4, |
| 17014 | .items = { |
| 17015 | { "Mic", 0x0 }, |
| 17016 | { "Front Mic", 0x1 }, |
| 17017 | { "Line", 0x2 }, |
| 17018 | { "CD", 0x4 }, |
| 17019 | }, |
| 17020 | }; |
| 17021 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17022 | static const struct hda_input_mux alc662_lenovo_101e_capture_source = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17023 | .num_items = 2, |
| 17024 | .items = { |
| 17025 | { "Mic", 0x1 }, |
| 17026 | { "Line", 0x2 }, |
| 17027 | }, |
| 17028 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17029 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17030 | static const struct hda_input_mux alc663_capture_source = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17031 | .num_items = 3, |
| 17032 | .items = { |
| 17033 | { "Mic", 0x0 }, |
| 17034 | { "Front Mic", 0x1 }, |
| 17035 | { "Line", 0x2 }, |
| 17036 | }, |
| 17037 | }; |
| 17038 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17039 | #if 0 /* set to 1 for testing other input sources below */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17040 | static const struct hda_input_mux alc272_nc10_capture_source = { |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17041 | .num_items = 16, |
| 17042 | .items = { |
| 17043 | { "Autoselect Mic", 0x0 }, |
| 17044 | { "Internal Mic", 0x1 }, |
| 17045 | { "In-0x02", 0x2 }, |
| 17046 | { "In-0x03", 0x3 }, |
| 17047 | { "In-0x04", 0x4 }, |
| 17048 | { "In-0x05", 0x5 }, |
| 17049 | { "In-0x06", 0x6 }, |
| 17050 | { "In-0x07", 0x7 }, |
| 17051 | { "In-0x08", 0x8 }, |
| 17052 | { "In-0x09", 0x9 }, |
| 17053 | { "In-0x0a", 0x0a }, |
| 17054 | { "In-0x0b", 0x0b }, |
| 17055 | { "In-0x0c", 0x0c }, |
| 17056 | { "In-0x0d", 0x0d }, |
| 17057 | { "In-0x0e", 0x0e }, |
| 17058 | { "In-0x0f", 0x0f }, |
| 17059 | }, |
| 17060 | }; |
| 17061 | #endif |
| 17062 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17063 | /* |
| 17064 | * 2ch mode |
| 17065 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17066 | static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17067 | { 2, NULL } |
| 17068 | }; |
| 17069 | |
| 17070 | /* |
| 17071 | * 2ch mode |
| 17072 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17073 | static const struct hda_verb alc662_3ST_ch2_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17074 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17075 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17076 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17077 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17078 | { } /* end */ |
| 17079 | }; |
| 17080 | |
| 17081 | /* |
| 17082 | * 6ch mode |
| 17083 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17084 | static const struct hda_verb alc662_3ST_ch6_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17085 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17086 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17087 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17088 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17089 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17090 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17091 | { } /* end */ |
| 17092 | }; |
| 17093 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17094 | static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17095 | { 2, alc662_3ST_ch2_init }, |
| 17096 | { 6, alc662_3ST_ch6_init }, |
| 17097 | }; |
| 17098 | |
| 17099 | /* |
| 17100 | * 2ch mode |
| 17101 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17102 | static const struct hda_verb alc662_sixstack_ch6_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17103 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17104 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17105 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17106 | { } /* end */ |
| 17107 | }; |
| 17108 | |
| 17109 | /* |
| 17110 | * 6ch mode |
| 17111 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17112 | static const struct hda_verb alc662_sixstack_ch8_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17113 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17114 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17115 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17116 | { } /* end */ |
| 17117 | }; |
| 17118 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17119 | static const struct hda_channel_mode alc662_5stack_modes[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17120 | { 2, alc662_sixstack_ch6_init }, |
| 17121 | { 6, alc662_sixstack_ch8_init }, |
| 17122 | }; |
| 17123 | |
| 17124 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17125 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17126 | */ |
| 17127 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17128 | static const struct snd_kcontrol_new alc662_base_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17129 | /* output mixer control */ |
| 17130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17131 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17132 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17133 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17134 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17135 | 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] | 17136 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17137 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17138 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17139 | |
| 17140 | /*Input mixer control */ |
| 17141 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17142 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17143 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17144 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17146 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17147 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17148 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17149 | { } /* end */ |
| 17150 | }; |
| 17151 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17152 | static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17153 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17154 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17155 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17157 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17159 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17162 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17163 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17164 | { } /* end */ |
| 17165 | }; |
| 17166 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17167 | static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17168 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17169 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17170 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17171 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17172 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17173 | 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] | 17174 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17175 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17176 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17177 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17178 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17179 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17180 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17183 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17184 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17185 | { } /* end */ |
| 17186 | }; |
| 17187 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17188 | static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17189 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17190 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17192 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17193 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17195 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17198 | { } /* end */ |
| 17199 | }; |
| 17200 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17201 | static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17202 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17203 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17204 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17205 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17208 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17209 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17210 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17211 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17212 | { } /* end */ |
| 17213 | }; |
| 17214 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17215 | static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17216 | ALC262_HIPPO_MASTER_SWITCH, |
| 17217 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17218 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17219 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17220 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17221 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17222 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17223 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17224 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17225 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17226 | { } /* end */ |
| 17227 | }; |
| 17228 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17229 | static const struct hda_bind_ctls alc663_asus_bind_master_vol = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17230 | .ops = &snd_hda_bind_vol, |
| 17231 | .values = { |
| 17232 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17233 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17234 | 0 |
| 17235 | }, |
| 17236 | }; |
| 17237 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17238 | static const struct hda_bind_ctls alc663_asus_one_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17239 | .ops = &snd_hda_bind_sw, |
| 17240 | .values = { |
| 17241 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17242 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17243 | 0 |
| 17244 | }, |
| 17245 | }; |
| 17246 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17247 | static const struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17248 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17249 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17250 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17251 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17252 | { } /* end */ |
| 17253 | }; |
| 17254 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17255 | static const struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17256 | .ops = &snd_hda_bind_sw, |
| 17257 | .values = { |
| 17258 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17259 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17260 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17261 | 0 |
| 17262 | }, |
| 17263 | }; |
| 17264 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17265 | static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17266 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17267 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17268 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17269 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17270 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17271 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17272 | |
| 17273 | { } /* end */ |
| 17274 | }; |
| 17275 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17276 | static const struct hda_bind_ctls alc663_asus_four_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17277 | .ops = &snd_hda_bind_sw, |
| 17278 | .values = { |
| 17279 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17280 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17281 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17282 | 0 |
| 17283 | }, |
| 17284 | }; |
| 17285 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17286 | static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17287 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17288 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17290 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17291 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17292 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17293 | { } /* end */ |
| 17294 | }; |
| 17295 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17296 | static const struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17297 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17298 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17299 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17300 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17301 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17302 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17303 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17304 | { } /* end */ |
| 17305 | }; |
| 17306 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17307 | static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17308 | .ops = &snd_hda_bind_vol, |
| 17309 | .values = { |
| 17310 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17311 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17312 | 0 |
| 17313 | }, |
| 17314 | }; |
| 17315 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17316 | static const struct hda_bind_ctls alc663_asus_two_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17317 | .ops = &snd_hda_bind_sw, |
| 17318 | .values = { |
| 17319 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17320 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17321 | 0 |
| 17322 | }, |
| 17323 | }; |
| 17324 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17325 | static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17326 | HDA_BIND_VOL("Master Playback Volume", |
| 17327 | &alc663_asus_two_bind_master_vol), |
| 17328 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17329 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17330 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17331 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17332 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17333 | { } /* end */ |
| 17334 | }; |
| 17335 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17336 | static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17337 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17338 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17339 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17340 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17341 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17342 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17343 | { } /* end */ |
| 17344 | }; |
| 17345 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17346 | static const struct snd_kcontrol_new alc663_g71v_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17347 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17348 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17349 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17350 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17352 | |
| 17353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17355 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17356 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17357 | { } /* end */ |
| 17358 | }; |
| 17359 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17360 | static const struct snd_kcontrol_new alc663_g50v_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17361 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17362 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17363 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17364 | |
| 17365 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17366 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17367 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17368 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17369 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17370 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17371 | { } /* end */ |
| 17372 | }; |
| 17373 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17374 | 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] | 17375 | .ops = &snd_hda_bind_sw, |
| 17376 | .values = { |
| 17377 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17378 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17379 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17380 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17381 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17382 | 0 |
| 17383 | }, |
| 17384 | }; |
| 17385 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17386 | 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] | 17387 | .ops = &snd_hda_bind_sw, |
| 17388 | .values = { |
| 17389 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17390 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17391 | 0 |
| 17392 | }, |
| 17393 | }; |
| 17394 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17395 | static const struct snd_kcontrol_new alc663_mode7_mixer[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17396 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17397 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17398 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17399 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17400 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17401 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17402 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17405 | { } /* end */ |
| 17406 | }; |
| 17407 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17408 | static const struct snd_kcontrol_new alc663_mode8_mixer[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17409 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17410 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17411 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17412 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17413 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17414 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17415 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17416 | { } /* end */ |
| 17417 | }; |
| 17418 | |
| 17419 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17420 | static const struct snd_kcontrol_new alc662_chmode_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17421 | { |
| 17422 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17423 | .name = "Channel Mode", |
| 17424 | .info = alc_ch_mode_info, |
| 17425 | .get = alc_ch_mode_get, |
| 17426 | .put = alc_ch_mode_put, |
| 17427 | }, |
| 17428 | { } /* end */ |
| 17429 | }; |
| 17430 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17431 | static const struct hda_verb alc662_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17432 | /* ADC: mute amp left and right */ |
| 17433 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17434 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17435 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17436 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17437 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17438 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17439 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17441 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17442 | |
| 17443 | /* Front Pin: output 0 (0x0c) */ |
| 17444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17445 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17446 | |
| 17447 | /* Rear Pin: output 1 (0x0d) */ |
| 17448 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17450 | |
| 17451 | /* CLFE Pin: output 2 (0x0e) */ |
| 17452 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17453 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17454 | |
| 17455 | /* Mic (rear) pin: input vref at 80% */ |
| 17456 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17457 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17458 | /* Front Mic pin: input vref at 80% */ |
| 17459 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17460 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17461 | /* Line In pin: input */ |
| 17462 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17463 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17464 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17465 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17466 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17467 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17468 | /* CD pin widget for input */ |
| 17469 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17470 | |
| 17471 | /* FIXME: use matrix-type input source selection */ |
| 17472 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17473 | /* Input mixer */ |
| 17474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17475 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17476 | |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 17477 | { } |
| 17478 | }; |
| 17479 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17480 | static const struct hda_verb alc662_eapd_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17481 | /* always trun on EAPD */ |
| 17482 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17483 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17484 | { } |
| 17485 | }; |
| 17486 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17487 | static const struct hda_verb alc662_sue_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17488 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17489 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17490 | {} |
| 17491 | }; |
| 17492 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17493 | static const struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17494 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17495 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17496 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17497 | }; |
| 17498 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17499 | /* Set Unsolicited Event*/ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17500 | static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17501 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17502 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17503 | {} |
| 17504 | }; |
| 17505 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17506 | static const struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17508 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17509 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17510 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17511 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17512 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17513 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17514 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17515 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17516 | {} |
| 17517 | }; |
| 17518 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17519 | static const struct hda_verb alc663_21jd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17520 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17521 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17522 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17525 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17526 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17527 | {} |
| 17528 | }; |
| 17529 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17530 | static const struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17531 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17532 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17533 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17534 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17535 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17536 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17537 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17538 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17539 | {} |
| 17540 | }; |
| 17541 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17542 | static const struct hda_verb alc663_15jd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17543 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17544 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17545 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17546 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17547 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17548 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17549 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17550 | {} |
| 17551 | }; |
| 17552 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17553 | static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17554 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17555 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17556 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17557 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17558 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17559 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17560 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17562 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17563 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17564 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17565 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17566 | {} |
| 17567 | }; |
| 17568 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17569 | static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17570 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17571 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17572 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17573 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17574 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17575 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17576 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17577 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17579 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17580 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17581 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17582 | {} |
| 17583 | }; |
| 17584 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17585 | static const struct hda_verb alc663_g71v_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17586 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17587 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17588 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17589 | |
| 17590 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17591 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17592 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17593 | |
| 17594 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17595 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17596 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17597 | {} |
| 17598 | }; |
| 17599 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17600 | static const struct hda_verb alc663_g50v_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17601 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17602 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17603 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17604 | |
| 17605 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17606 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17607 | {} |
| 17608 | }; |
| 17609 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17610 | static const struct hda_verb alc662_ecs_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17611 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17612 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17613 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17614 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17615 | {} |
| 17616 | }; |
| 17617 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17618 | static const struct hda_verb alc272_dell_zm1_init_verbs[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17619 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17620 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17621 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17622 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17623 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17624 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17625 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17627 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17628 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17629 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17630 | {} |
| 17631 | }; |
| 17632 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17633 | static const struct hda_verb alc272_dell_init_verbs[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17634 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17635 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17636 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17637 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17638 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17639 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17640 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17641 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17642 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17643 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17644 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17645 | {} |
| 17646 | }; |
| 17647 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17648 | static const struct hda_verb alc663_mode7_init_verbs[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17650 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17651 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17652 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17653 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17654 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17655 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17656 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17657 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17658 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17659 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17660 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17661 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17662 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17663 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17664 | {} |
| 17665 | }; |
| 17666 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17667 | static const struct hda_verb alc663_mode8_init_verbs[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17668 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17669 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17670 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17671 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17672 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17673 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17674 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17675 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17676 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17677 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17678 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17679 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17680 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17681 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17682 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17683 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17684 | {} |
| 17685 | }; |
| 17686 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17687 | static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17688 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17689 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17690 | { } /* end */ |
| 17691 | }; |
| 17692 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17693 | static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17694 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17695 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17696 | { } /* end */ |
| 17697 | }; |
| 17698 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17699 | static void alc662_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17700 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17701 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17702 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17703 | spec->autocfg.hp_pins[0] = 0x1b; |
| 17704 | spec->autocfg.line_out_pins[0] = 0x14; |
| 17705 | spec->autocfg.speaker_pins[0] = 0x15; |
| 17706 | spec->automute = 1; |
| 17707 | spec->detect_line = 1; |
| 17708 | spec->automute_lines = 1; |
| 17709 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17710 | } |
| 17711 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17712 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17713 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17714 | struct alc_spec *spec = codec->spec; |
| 17715 | |
| 17716 | alc262_hippo1_setup(codec); |
| 17717 | spec->ext_mic.pin = 0x18; |
| 17718 | spec->ext_mic.mux_idx = 0; |
| 17719 | spec->int_mic.pin = 0x19; |
| 17720 | spec->int_mic.mux_idx = 1; |
| 17721 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17722 | } |
| 17723 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17724 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17725 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17726 | struct alc_spec *spec = codec->spec; |
| 17727 | |
| 17728 | spec->autocfg.hp_pins[0] = 0x14; |
| 17729 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 17730 | spec->automute = 1; |
| 17731 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17732 | } |
| 17733 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17734 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17735 | { |
| 17736 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17737 | spec->autocfg.hp_pins[0] = 0x21; |
| 17738 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17739 | spec->automute_mixer_nid[0] = 0x0c; |
| 17740 | spec->automute = 1; |
| 17741 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17742 | spec->ext_mic.pin = 0x18; |
| 17743 | spec->ext_mic.mux_idx = 0; |
| 17744 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17745 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17746 | spec->auto_mic = 1; |
| 17747 | } |
| 17748 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17749 | /* ***************** Mode1 ******************************/ |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17750 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17751 | { |
| 17752 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17753 | spec->autocfg.hp_pins[0] = 0x21; |
| 17754 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17755 | spec->automute_mixer_nid[0] = 0x0c; |
| 17756 | spec->automute = 1; |
| 17757 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17758 | spec->ext_mic.pin = 0x18; |
| 17759 | spec->ext_mic.mux_idx = 0; |
| 17760 | spec->int_mic.pin = 0x19; |
| 17761 | spec->int_mic.mux_idx = 1; |
| 17762 | spec->auto_mic = 1; |
| 17763 | } |
| 17764 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17765 | /* ***************** Mode2 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17766 | static void alc662_mode2_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17767 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17768 | struct alc_spec *spec = codec->spec; |
| 17769 | spec->autocfg.hp_pins[0] = 0x1b; |
| 17770 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17771 | spec->automute = 1; |
| 17772 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 17773 | spec->ext_mic.pin = 0x18; |
| 17774 | spec->ext_mic.mux_idx = 0; |
| 17775 | spec->int_mic.pin = 0x19; |
| 17776 | spec->int_mic.mux_idx = 1; |
| 17777 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17778 | } |
| 17779 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17780 | /* ***************** Mode3 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17781 | static void alc663_mode3_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17782 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17783 | struct alc_spec *spec = codec->spec; |
| 17784 | spec->autocfg.hp_pins[0] = 0x21; |
| 17785 | spec->autocfg.hp_pins[0] = 0x15; |
| 17786 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17787 | spec->automute = 1; |
| 17788 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 17789 | spec->ext_mic.pin = 0x18; |
| 17790 | spec->ext_mic.mux_idx = 0; |
| 17791 | spec->int_mic.pin = 0x19; |
| 17792 | spec->int_mic.mux_idx = 1; |
| 17793 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17794 | } |
| 17795 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17796 | /* ***************** Mode4 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17797 | static void alc663_mode4_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17798 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17799 | struct alc_spec *spec = codec->spec; |
| 17800 | spec->autocfg.hp_pins[0] = 0x21; |
| 17801 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17802 | spec->autocfg.speaker_pins[1] = 0x16; |
| 17803 | spec->automute_mixer_nid[0] = 0x0c; |
| 17804 | spec->automute_mixer_nid[1] = 0x0e; |
| 17805 | spec->automute = 1; |
| 17806 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 17807 | spec->ext_mic.pin = 0x18; |
| 17808 | spec->ext_mic.mux_idx = 0; |
| 17809 | spec->int_mic.pin = 0x19; |
| 17810 | spec->int_mic.mux_idx = 1; |
| 17811 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17812 | } |
| 17813 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17814 | /* ***************** Mode5 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17815 | static void alc663_mode5_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17816 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17817 | struct alc_spec *spec = codec->spec; |
| 17818 | spec->autocfg.hp_pins[0] = 0x15; |
| 17819 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17820 | spec->autocfg.speaker_pins[1] = 0x16; |
| 17821 | spec->automute_mixer_nid[0] = 0x0c; |
| 17822 | spec->automute_mixer_nid[1] = 0x0e; |
| 17823 | spec->automute = 1; |
| 17824 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 17825 | spec->ext_mic.pin = 0x18; |
| 17826 | spec->ext_mic.mux_idx = 0; |
| 17827 | spec->int_mic.pin = 0x19; |
| 17828 | spec->int_mic.mux_idx = 1; |
| 17829 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17830 | } |
| 17831 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17832 | /* ***************** Mode6 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17833 | static void alc663_mode6_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17834 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17835 | struct alc_spec *spec = codec->spec; |
| 17836 | spec->autocfg.hp_pins[0] = 0x1b; |
| 17837 | spec->autocfg.hp_pins[0] = 0x15; |
| 17838 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17839 | spec->automute_mixer_nid[0] = 0x0c; |
| 17840 | spec->automute = 1; |
| 17841 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 17842 | spec->ext_mic.pin = 0x18; |
| 17843 | spec->ext_mic.mux_idx = 0; |
| 17844 | spec->int_mic.pin = 0x19; |
| 17845 | spec->int_mic.mux_idx = 1; |
| 17846 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17847 | } |
| 17848 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17849 | /* ***************** Mode7 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17850 | static void alc663_mode7_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17851 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17852 | struct alc_spec *spec = codec->spec; |
| 17853 | spec->autocfg.hp_pins[0] = 0x1b; |
| 17854 | spec->autocfg.hp_pins[0] = 0x21; |
| 17855 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17856 | spec->autocfg.speaker_pins[0] = 0x17; |
| 17857 | spec->automute = 1; |
| 17858 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 17859 | spec->ext_mic.pin = 0x18; |
| 17860 | spec->ext_mic.mux_idx = 0; |
| 17861 | spec->int_mic.pin = 0x19; |
| 17862 | spec->int_mic.mux_idx = 1; |
| 17863 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17864 | } |
| 17865 | |
| 17866 | /* ***************** Mode8 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17867 | static void alc663_mode8_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17868 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 17869 | struct alc_spec *spec = codec->spec; |
| 17870 | spec->autocfg.hp_pins[0] = 0x21; |
| 17871 | spec->autocfg.hp_pins[1] = 0x15; |
| 17872 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17873 | spec->autocfg.speaker_pins[0] = 0x17; |
| 17874 | spec->automute = 1; |
| 17875 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 17876 | spec->ext_mic.pin = 0x18; |
| 17877 | spec->ext_mic.mux_idx = 0; |
| 17878 | spec->int_mic.pin = 0x12; |
| 17879 | spec->int_mic.mux_idx = 9; |
| 17880 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17881 | } |
| 17882 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17883 | static void alc663_g71v_setup(struct hda_codec *codec) |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17884 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17885 | struct alc_spec *spec = codec->spec; |
| 17886 | spec->autocfg.hp_pins[0] = 0x21; |
| 17887 | spec->autocfg.line_out_pins[0] = 0x15; |
| 17888 | spec->autocfg.speaker_pins[0] = 0x14; |
| 17889 | spec->automute = 1; |
| 17890 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
| 17891 | spec->detect_line = 1; |
| 17892 | spec->automute_lines = 1; |
| 17893 | spec->ext_mic.pin = 0x18; |
| 17894 | spec->ext_mic.mux_idx = 0; |
| 17895 | spec->int_mic.pin = 0x12; |
| 17896 | spec->int_mic.mux_idx = 9; |
| 17897 | spec->auto_mic = 1; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17898 | } |
| 17899 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17900 | #define alc663_g50v_setup alc663_m51va_setup |
| 17901 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17902 | static const struct snd_kcontrol_new alc662_ecs_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17903 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17904 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17905 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17906 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17907 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17908 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17909 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17910 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17911 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17912 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17913 | { } /* end */ |
| 17914 | }; |
| 17915 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17916 | static const struct snd_kcontrol_new alc272_nc10_mixer[] = { |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17917 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17918 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17919 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17920 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17921 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17922 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 17923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17924 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17925 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17926 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 17927 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17928 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17929 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17930 | { } /* end */ |
| 17931 | }; |
| 17932 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17933 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17934 | #define alc662_loopbacks alc880_loopbacks |
| 17935 | #endif |
| 17936 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17937 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17938 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17939 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17940 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17941 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17942 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17943 | |
| 17944 | /* |
| 17945 | * configuration and preset |
| 17946 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17947 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17948 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17949 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17950 | [ALC662_3ST_6ch] = "3stack-6ch", |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 17951 | [ALC662_5ST_DIG] = "5stack-dig", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17952 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17953 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17954 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17955 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17956 | [ALC663_ASUS_M51VA] = "m51va", |
| 17957 | [ALC663_ASUS_G71V] = "g71v", |
| 17958 | [ALC663_ASUS_H13] = "h13", |
| 17959 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17960 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17961 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17962 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17963 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17964 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17965 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17966 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17967 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17968 | [ALC272_DELL] = "dell", |
| 17969 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17970 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17971 | [ALC662_AUTO] = "auto", |
| 17972 | }; |
| 17973 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17974 | static const struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17975 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17976 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17977 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17978 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17979 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17980 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17981 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17982 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17983 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17984 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17985 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17986 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17987 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17988 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17989 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17990 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17991 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17992 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17993 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17994 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17995 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17996 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17997 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17998 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17999 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18000 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18001 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18002 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18003 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18004 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18005 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18006 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18007 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18008 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18009 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18010 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18011 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18012 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18013 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18014 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18015 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18016 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18017 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18018 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18019 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18020 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18021 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18022 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18023 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18024 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18025 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18026 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18027 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18028 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18029 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18030 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18031 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18032 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18033 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18034 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18035 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18036 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18037 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18038 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18039 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18040 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18041 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Takashi Iwai | ebb4724 | 2011-05-02 10:37:29 +0200 | [diff] [blame] | 18042 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18043 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18044 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18045 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18046 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18047 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18048 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18049 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18050 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18051 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18052 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18053 | {} |
| 18054 | }; |
| 18055 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18056 | static const struct alc_config_preset alc662_presets[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18057 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18058 | .mixers = { alc662_3ST_2ch_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18059 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18060 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18061 | .dac_nids = alc662_dac_nids, |
| 18062 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18063 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18064 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18065 | .channel_mode = alc662_3ST_2ch_modes, |
| 18066 | .input_mux = &alc662_capture_source, |
| 18067 | }, |
| 18068 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18069 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18070 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18071 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18072 | .dac_nids = alc662_dac_nids, |
| 18073 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18074 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18075 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18076 | .channel_mode = alc662_3ST_6ch_modes, |
| 18077 | .need_dac_fix = 1, |
| 18078 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18079 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18080 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18081 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18082 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18083 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18084 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18085 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18086 | .channel_mode = alc662_3ST_6ch_modes, |
| 18087 | .need_dac_fix = 1, |
| 18088 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18089 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18090 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18091 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18092 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18093 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18094 | .dac_nids = alc662_dac_nids, |
| 18095 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18096 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18097 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18098 | .channel_mode = alc662_5stack_modes, |
| 18099 | .input_mux = &alc662_capture_source, |
| 18100 | }, |
| 18101 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18102 | .mixers = { alc662_lenovo_101e_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18103 | .init_verbs = { alc662_init_verbs, |
| 18104 | alc662_eapd_init_verbs, |
| 18105 | alc662_sue_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18106 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18107 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18108 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18109 | .channel_mode = alc662_3ST_2ch_modes, |
| 18110 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18111 | .unsol_event = alc_sku_unsol_event, |
| 18112 | .setup = alc662_lenovo_101e_setup, |
| 18113 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18114 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18115 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18116 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18117 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18118 | alc662_eapd_init_verbs, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18119 | alc662_eeepc_sue_init_verbs }, |
| 18120 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18121 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18122 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18123 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18124 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18125 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18126 | .init_hook = alc_inithook, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18127 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18128 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18129 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18130 | alc662_chmode_mixer }, |
| 18131 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18132 | alc662_eapd_init_verbs, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18133 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18134 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18135 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18136 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18137 | .channel_mode = alc662_3ST_6ch_modes, |
| 18138 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18139 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18140 | .setup = alc662_eeepc_ep20_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18141 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18142 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18143 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18144 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18145 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18146 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18147 | alc662_ecs_init_verbs }, |
| 18148 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18149 | .dac_nids = alc662_dac_nids, |
| 18150 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18151 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18152 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18153 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18154 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18155 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18156 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18157 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18158 | .init_verbs = { alc662_init_verbs, |
| 18159 | alc662_eapd_init_verbs, |
| 18160 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18161 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18162 | .dac_nids = alc662_dac_nids, |
| 18163 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18164 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18165 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18166 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18167 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18168 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18169 | }, |
| 18170 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18171 | .mixers = { alc663_g71v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18172 | .init_verbs = { alc662_init_verbs, |
| 18173 | alc662_eapd_init_verbs, |
| 18174 | alc663_g71v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18175 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18176 | .dac_nids = alc662_dac_nids, |
| 18177 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18178 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18179 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18180 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18181 | .setup = alc663_g71v_setup, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18182 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18183 | }, |
| 18184 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18185 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18186 | .init_verbs = { alc662_init_verbs, |
| 18187 | alc662_eapd_init_verbs, |
| 18188 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18189 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18190 | .dac_nids = alc662_dac_nids, |
| 18191 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18192 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18193 | .setup = alc663_m51va_setup, |
| 18194 | .unsol_event = alc_sku_unsol_event, |
| 18195 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18196 | }, |
| 18197 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18198 | .mixers = { alc663_g50v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18199 | .init_verbs = { alc662_init_verbs, |
| 18200 | alc662_eapd_init_verbs, |
| 18201 | alc663_g50v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18202 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18203 | .dac_nids = alc662_dac_nids, |
| 18204 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18205 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18206 | .channel_mode = alc662_3ST_6ch_modes, |
| 18207 | .input_mux = &alc663_capture_source, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18208 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18209 | .setup = alc663_g50v_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18210 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18211 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18212 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18213 | .mixers = { alc663_m51va_mixer }, |
| 18214 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18215 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18216 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18217 | alc663_21jd_amic_init_verbs }, |
| 18218 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18219 | .hp_nid = 0x03, |
| 18220 | .dac_nids = alc662_dac_nids, |
| 18221 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18222 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18223 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18224 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18225 | .setup = alc663_mode1_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18226 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18227 | }, |
| 18228 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18229 | .mixers = { alc662_1bjd_mixer }, |
| 18230 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18231 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18232 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18233 | alc662_1bjd_amic_init_verbs }, |
| 18234 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18235 | .dac_nids = alc662_dac_nids, |
| 18236 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18237 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18238 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18239 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18240 | .setup = alc662_mode2_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18241 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18242 | }, |
| 18243 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18244 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18245 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18246 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18247 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18248 | alc663_two_hp_amic_m1_init_verbs }, |
| 18249 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18250 | .hp_nid = 0x03, |
| 18251 | .dac_nids = alc662_dac_nids, |
| 18252 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18253 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18254 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18255 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18256 | .setup = alc663_mode3_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18257 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18258 | }, |
| 18259 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18260 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18261 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18262 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18263 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18264 | alc663_21jd_amic_init_verbs}, |
| 18265 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18266 | .hp_nid = 0x03, |
| 18267 | .dac_nids = alc662_dac_nids, |
| 18268 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18269 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18270 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18271 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18272 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18273 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18274 | }, |
| 18275 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18276 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18277 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18278 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18279 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18280 | alc663_15jd_amic_init_verbs }, |
| 18281 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18282 | .hp_nid = 0x03, |
| 18283 | .dac_nids = alc662_dac_nids, |
| 18284 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18285 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18286 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18287 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18288 | .setup = alc663_mode5_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18289 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18290 | }, |
| 18291 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18292 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18293 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18294 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18295 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18296 | alc663_two_hp_amic_m2_init_verbs }, |
| 18297 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18298 | .hp_nid = 0x03, |
| 18299 | .dac_nids = alc662_dac_nids, |
| 18300 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18301 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18302 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18303 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18304 | .setup = alc663_mode6_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18305 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18306 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18307 | [ALC663_ASUS_MODE7] = { |
| 18308 | .mixers = { alc663_mode7_mixer }, |
| 18309 | .cap_mixer = alc662_auto_capture_mixer, |
| 18310 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18311 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18312 | alc663_mode7_init_verbs }, |
| 18313 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18314 | .hp_nid = 0x03, |
| 18315 | .dac_nids = alc662_dac_nids, |
| 18316 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18317 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18318 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18319 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18320 | .setup = alc663_mode7_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18321 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18322 | }, |
| 18323 | [ALC663_ASUS_MODE8] = { |
| 18324 | .mixers = { alc663_mode8_mixer }, |
| 18325 | .cap_mixer = alc662_auto_capture_mixer, |
| 18326 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18327 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18328 | alc663_mode8_init_verbs }, |
| 18329 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18330 | .hp_nid = 0x03, |
| 18331 | .dac_nids = alc662_dac_nids, |
| 18332 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18333 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18334 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18335 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18336 | .setup = alc663_mode8_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18337 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18338 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18339 | [ALC272_DELL] = { |
| 18340 | .mixers = { alc663_m51va_mixer }, |
| 18341 | .cap_mixer = alc272_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18342 | .init_verbs = { alc662_init_verbs, |
| 18343 | alc662_eapd_init_verbs, |
| 18344 | alc272_dell_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18345 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18346 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18347 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18348 | .adc_nids = alc272_adc_nids, |
| 18349 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18350 | .capsrc_nids = alc272_capsrc_nids, |
| 18351 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18352 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18353 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18354 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18355 | }, |
| 18356 | [ALC272_DELL_ZM1] = { |
| 18357 | .mixers = { alc663_m51va_mixer }, |
| 18358 | .cap_mixer = alc662_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18359 | .init_verbs = { alc662_init_verbs, |
| 18360 | alc662_eapd_init_verbs, |
| 18361 | alc272_dell_zm1_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18362 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18363 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18364 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18365 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18366 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18367 | .capsrc_nids = alc662_capsrc_nids, |
| 18368 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18369 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18370 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18371 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18372 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18373 | [ALC272_SAMSUNG_NC10] = { |
| 18374 | .mixers = { alc272_nc10_mixer }, |
| 18375 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18376 | alc662_eapd_init_verbs, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18377 | alc663_21jd_amic_init_verbs }, |
| 18378 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18379 | .dac_nids = alc272_dac_nids, |
| 18380 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18381 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18382 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18383 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18384 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18385 | .init_hook = alc_inithook, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18386 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18387 | }; |
| 18388 | |
| 18389 | |
| 18390 | /* |
| 18391 | * BIOS auto configuration |
| 18392 | */ |
| 18393 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18394 | /* convert from MIX nid to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18395 | 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] | 18396 | { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18397 | hda_nid_t list[5]; |
Takashi Iwai | 1304ac8 | 2011-04-06 15:16:21 +0200 | [diff] [blame] | 18398 | int i, num; |
| 18399 | |
| 18400 | num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list)); |
| 18401 | for (i = 0; i < num; i++) { |
| 18402 | if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT) |
| 18403 | return list[i]; |
| 18404 | } |
| 18405 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18406 | } |
| 18407 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18408 | /* go down to the selector widget before the mixer */ |
| 18409 | static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin) |
| 18410 | { |
| 18411 | hda_nid_t srcs[5]; |
| 18412 | int num = snd_hda_get_connections(codec, pin, srcs, |
| 18413 | ARRAY_SIZE(srcs)); |
| 18414 | if (num != 1 || |
| 18415 | get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL) |
| 18416 | return pin; |
| 18417 | return srcs[0]; |
| 18418 | } |
| 18419 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18420 | /* get MIX nid connected to the given pin targeted to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18421 | 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] | 18422 | hda_nid_t dac) |
| 18423 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 18424 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18425 | int i, num; |
| 18426 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18427 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18428 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18429 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18430 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18431 | return mix[i]; |
| 18432 | } |
| 18433 | return 0; |
| 18434 | } |
| 18435 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18436 | /* select the connection from pin to DAC if needed */ |
| 18437 | static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin, |
| 18438 | hda_nid_t dac) |
| 18439 | { |
| 18440 | hda_nid_t mix[5]; |
| 18441 | int i, num; |
| 18442 | |
| 18443 | pin = alc_go_down_to_selector(codec, pin); |
| 18444 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18445 | if (num < 2) |
| 18446 | return 0; |
| 18447 | for (i = 0; i < num; i++) { |
| 18448 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) { |
| 18449 | snd_hda_codec_update_cache(codec, pin, 0, |
| 18450 | AC_VERB_SET_CONNECT_SEL, i); |
| 18451 | return 0; |
| 18452 | } |
| 18453 | } |
| 18454 | return 0; |
| 18455 | } |
| 18456 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18457 | /* look for an empty DAC slot */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18458 | 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] | 18459 | { |
| 18460 | struct alc_spec *spec = codec->spec; |
| 18461 | hda_nid_t srcs[5]; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18462 | int i, num; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18463 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18464 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18465 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18466 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18467 | hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18468 | if (!nid) |
| 18469 | continue; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18470 | if (found_in_nid_list(nid, spec->multiout.dac_nids, |
| 18471 | spec->multiout.num_dacs)) |
| 18472 | continue; |
| 18473 | if (spec->multiout.hp_nid == nid) |
| 18474 | continue; |
| 18475 | if (found_in_nid_list(nid, spec->multiout.extra_out_nid, |
| 18476 | ARRAY_SIZE(spec->multiout.extra_out_nid))) |
| 18477 | continue; |
| 18478 | return nid; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18479 | } |
| 18480 | return 0; |
| 18481 | } |
| 18482 | |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18483 | static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) |
| 18484 | { |
| 18485 | hda_nid_t sel = alc_go_down_to_selector(codec, pin); |
| 18486 | if (snd_hda_get_conn_list(codec, sel, NULL) == 1) |
| 18487 | return alc_auto_look_for_dac(codec, pin); |
| 18488 | return 0; |
| 18489 | } |
| 18490 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18491 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18492 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18493 | { |
| 18494 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 18495 | const struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 350434e | 2011-06-30 21:29:12 +0200 | [diff] [blame] | 18496 | bool redone = false; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18497 | int i; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18498 | |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18499 | again: |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 18500 | spec->multiout.num_dacs = 0; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18501 | spec->multiout.hp_nid = 0; |
| 18502 | spec->multiout.extra_out_nid[0] = 0; |
| 18503 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); |
| 18504 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18505 | |
| 18506 | /* fill hard-wired DACs first */ |
| 18507 | if (!redone) { |
| 18508 | for (i = 0; i < cfg->line_outs; i++) |
| 18509 | spec->private_dac_nids[i] = |
| 18510 | get_dac_if_single(codec, cfg->line_out_pins[i]); |
| 18511 | if (cfg->hp_outs) |
| 18512 | spec->multiout.hp_nid = |
| 18513 | get_dac_if_single(codec, cfg->hp_pins[0]); |
| 18514 | if (cfg->speaker_outs) |
| 18515 | spec->multiout.extra_out_nid[0] = |
| 18516 | get_dac_if_single(codec, cfg->speaker_pins[0]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18517 | } |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18518 | |
| 18519 | for (i = 0; i < cfg->line_outs; i++) { |
| 18520 | hda_nid_t pin = cfg->line_out_pins[i]; |
| 18521 | if (spec->private_dac_nids[i]) |
| 18522 | continue; |
| 18523 | spec->private_dac_nids[i] = alc_auto_look_for_dac(codec, pin); |
| 18524 | if (!spec->private_dac_nids[i] && !redone) { |
| 18525 | /* if we can't find primary DACs, re-probe without |
| 18526 | * checking the hard-wired DACs |
| 18527 | */ |
| 18528 | redone = true; |
| 18529 | goto again; |
| 18530 | } |
| 18531 | } |
| 18532 | |
| 18533 | for (i = 0; i < cfg->line_outs; i++) { |
| 18534 | if (spec->private_dac_nids[i]) |
| 18535 | spec->multiout.num_dacs++; |
| 18536 | else |
| 18537 | memmove(spec->private_dac_nids + i, |
| 18538 | spec->private_dac_nids + i + 1, |
| 18539 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); |
| 18540 | } |
| 18541 | |
Takashi Iwai | bb8bf4d | 2011-07-06 13:07:54 +0200 | [diff] [blame] | 18542 | if (cfg->hp_outs && !spec->multiout.hp_nid) |
| 18543 | spec->multiout.hp_nid = |
| 18544 | alc_auto_look_for_dac(codec, cfg->hp_pins[0]); |
| 18545 | if (cfg->speaker_outs && !spec->multiout.extra_out_nid[0]) |
| 18546 | spec->multiout.extra_out_nid[0] = |
| 18547 | alc_auto_look_for_dac(codec, cfg->speaker_pins[0]); |
| 18548 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18549 | return 0; |
| 18550 | } |
| 18551 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18552 | static int alc_auto_add_vol_ctl(struct hda_codec *codec, |
Takashi Iwai | 97aaab7 | 2011-07-06 14:02:55 +0200 | [diff] [blame] | 18553 | const char *pfx, int cidx, |
| 18554 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18555 | { |
Takashi Iwai | 97aaab7 | 2011-07-06 14:02:55 +0200 | [diff] [blame] | 18556 | return __add_pb_vol_ctrl(codec->spec, ALC_CTL_WIDGET_VOL, pfx, cidx, |
| 18557 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18558 | } |
| 18559 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18560 | #define alc_auto_add_stereo_vol(codec, pfx, cidx, nid) \ |
| 18561 | alc_auto_add_vol_ctl(codec, pfx, cidx, nid, 3) |
Takashi Iwai | 97aaab7 | 2011-07-06 14:02:55 +0200 | [diff] [blame] | 18562 | |
| 18563 | /* create a mute-switch for the given mixer widget; |
| 18564 | * if it has multiple sources (e.g. DAC and loopback), create a bind-mute |
| 18565 | */ |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18566 | static int alc_auto_add_sw_ctl(struct hda_codec *codec, |
Takashi Iwai | 97aaab7 | 2011-07-06 14:02:55 +0200 | [diff] [blame] | 18567 | const char *pfx, int cidx, |
| 18568 | hda_nid_t nid, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18569 | { |
Takashi Iwai | 97aaab7 | 2011-07-06 14:02:55 +0200 | [diff] [blame] | 18570 | int type; |
| 18571 | unsigned long val; |
| 18572 | if (snd_hda_get_conn_list(codec, nid, NULL) == 1) { |
| 18573 | type = ALC_CTL_WIDGET_MUTE; |
| 18574 | val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT); |
| 18575 | } else { |
| 18576 | type = ALC_CTL_BIND_MUTE; |
| 18577 | val = HDA_COMPOSE_AMP_VAL(nid, chs, 2, HDA_INPUT); |
| 18578 | } |
| 18579 | return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18580 | } |
| 18581 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18582 | #define alc_auto_add_stereo_sw(codec, pfx, cidx, nid) \ |
| 18583 | alc_auto_add_sw_ctl(codec, pfx, cidx, nid, 3) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18584 | |
| 18585 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18586 | static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18587 | const struct auto_pin_cfg *cfg) |
| 18588 | { |
| 18589 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18590 | hda_nid_t nid, mix, pin; |
| 18591 | int i, err, noutputs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18592 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18593 | noutputs = cfg->line_outs; |
| 18594 | if (spec->multi_ios > 0) |
| 18595 | noutputs += spec->multi_ios; |
| 18596 | |
| 18597 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 18598 | const char *name; |
| 18599 | int index; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18600 | nid = spec->multiout.dac_nids[i]; |
| 18601 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18602 | continue; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18603 | if (i >= cfg->line_outs) |
| 18604 | pin = spec->multi_io[i - 1].pin; |
| 18605 | else |
| 18606 | pin = cfg->line_out_pins[i]; |
| 18607 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18608 | if (!mix) |
| 18609 | continue; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 18610 | name = alc_get_line_out_pfx(spec, i, true, &index); |
| 18611 | if (!name) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18612 | /* Center/LFE */ |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18613 | err = alc_auto_add_vol_ctl(codec, "Center", 0, nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18614 | if (err < 0) |
| 18615 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18616 | err = alc_auto_add_vol_ctl(codec, "LFE", 0, nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18617 | if (err < 0) |
| 18618 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18619 | err = alc_auto_add_sw_ctl(codec, "Center", 0, mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18620 | if (err < 0) |
| 18621 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18622 | err = alc_auto_add_sw_ctl(codec, "LFE", 0, mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18623 | if (err < 0) |
| 18624 | return err; |
| 18625 | } else { |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18626 | err = alc_auto_add_stereo_vol(codec, name, index, nid); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18627 | if (err < 0) |
| 18628 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18629 | err = alc_auto_add_stereo_sw(codec, name, index, mix); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18630 | if (err < 0) |
| 18631 | return err; |
| 18632 | } |
| 18633 | } |
| 18634 | return 0; |
| 18635 | } |
| 18636 | |
| 18637 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18638 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18639 | hda_nid_t dac, const char *pfx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18640 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18641 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18642 | hda_nid_t mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18643 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18644 | |
| 18645 | if (!pin) |
| 18646 | return 0; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18647 | if (!dac) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18648 | /* the corresponding DAC is already occupied */ |
| 18649 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18650 | return 0; /* no way */ |
| 18651 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18652 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18653 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18654 | } |
| 18655 | |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18656 | mix = alc_auto_dac_to_mix(codec, pin, dac); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18657 | if (!mix) |
| 18658 | return 0; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18659 | err = alc_auto_add_stereo_vol(codec, pfx, 0, dac); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18660 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18661 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18662 | err = alc_auto_add_stereo_sw(codec, pfx, 0, mix); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18663 | if (err < 0) |
| 18664 | return err; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18665 | return 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18666 | } |
| 18667 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18668 | static int alc_auto_create_hp_out(struct hda_codec *codec) |
| 18669 | { |
| 18670 | struct alc_spec *spec = codec->spec; |
| 18671 | return alc_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
| 18672 | spec->multiout.hp_nid, |
| 18673 | "Headphone"); |
| 18674 | } |
| 18675 | |
| 18676 | static int alc_auto_create_speaker_out(struct hda_codec *codec) |
| 18677 | { |
| 18678 | struct alc_spec *spec = codec->spec; |
| 18679 | return alc_auto_create_extra_out(codec, spec->autocfg.speaker_pins[0], |
| 18680 | spec->multiout.extra_out_nid[0], |
| 18681 | "Speaker"); |
| 18682 | } |
| 18683 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18684 | static void alc_auto_set_output_and_unmute(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18685 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18686 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18687 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18688 | int i, num; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18689 | hda_nid_t mix = 0; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 18690 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18691 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18692 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | cd51155 | 2011-07-06 13:10:42 +0200 | [diff] [blame] | 18693 | nid = alc_go_down_to_selector(codec, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18694 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18695 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18696 | if (alc_auto_mix_to_dac(codec, srcs[i]) != dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18697 | continue; |
Takashi Iwai | cd51155 | 2011-07-06 13:10:42 +0200 | [diff] [blame] | 18698 | mix = srcs[i]; |
| 18699 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18700 | } |
Takashi Iwai | cd51155 | 2011-07-06 13:10:42 +0200 | [diff] [blame] | 18701 | if (!mix) |
| 18702 | return; |
| 18703 | |
| 18704 | /* need the manual connection? */ |
| 18705 | if (num > 1) |
| 18706 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18707 | /* unmute mixer widget inputs */ |
| 18708 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 18709 | AMP_IN_UNMUTE(0)); |
| 18710 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 18711 | AMP_IN_UNMUTE(1)); |
| 18712 | /* initialize volume */ |
| 18713 | if (query_amp_caps(codec, dac, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS) |
| 18714 | nid = dac; |
| 18715 | else if (query_amp_caps(codec, mix, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS) |
| 18716 | nid = mix; |
| 18717 | else |
| 18718 | return; |
| 18719 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 18720 | AMP_OUT_ZERO); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18721 | } |
| 18722 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18723 | static void alc_auto_init_multi_out(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18724 | { |
| 18725 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18726 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18727 | int i; |
| 18728 | |
| 18729 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18730 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18731 | if (nid) |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18732 | alc_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18733 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18734 | } |
| 18735 | } |
| 18736 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18737 | static void alc_auto_init_extra_out(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18738 | { |
| 18739 | struct alc_spec *spec = codec->spec; |
| 18740 | hda_nid_t pin; |
| 18741 | |
| 18742 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18743 | if (pin) |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18744 | alc_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18745 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18746 | pin = spec->autocfg.speaker_pins[0]; |
| 18747 | if (pin) |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18748 | alc_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18749 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18750 | } |
| 18751 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18752 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18753 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18754 | /* |
| 18755 | * multi-io helper |
| 18756 | */ |
| 18757 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
| 18758 | unsigned int location) |
| 18759 | { |
| 18760 | struct alc_spec *spec = codec->spec; |
| 18761 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 18762 | int type, i, num_pins = 0; |
| 18763 | |
| 18764 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
| 18765 | for (i = 0; i < cfg->num_inputs; i++) { |
| 18766 | hda_nid_t nid = cfg->inputs[i].pin; |
| 18767 | hda_nid_t dac; |
| 18768 | unsigned int defcfg, caps; |
| 18769 | if (cfg->inputs[i].type != type) |
| 18770 | continue; |
| 18771 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 18772 | if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX) |
| 18773 | continue; |
| 18774 | if (location && get_defcfg_location(defcfg) != location) |
| 18775 | continue; |
| 18776 | caps = snd_hda_query_pin_caps(codec, nid); |
| 18777 | if (!(caps & AC_PINCAP_OUT)) |
| 18778 | continue; |
| 18779 | dac = alc_auto_look_for_dac(codec, nid); |
| 18780 | if (!dac) |
| 18781 | continue; |
| 18782 | spec->multi_io[num_pins].pin = nid; |
| 18783 | spec->multi_io[num_pins].dac = dac; |
| 18784 | num_pins++; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 18785 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18786 | } |
| 18787 | } |
| 18788 | spec->multiout.num_dacs = 1; |
| 18789 | if (num_pins < 2) |
| 18790 | return 0; |
| 18791 | return num_pins; |
| 18792 | } |
| 18793 | |
| 18794 | static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 18795 | struct snd_ctl_elem_info *uinfo) |
| 18796 | { |
| 18797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 18798 | struct alc_spec *spec = codec->spec; |
| 18799 | |
| 18800 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 18801 | uinfo->count = 1; |
| 18802 | uinfo->value.enumerated.items = spec->multi_ios + 1; |
| 18803 | if (uinfo->value.enumerated.item > spec->multi_ios) |
| 18804 | uinfo->value.enumerated.item = spec->multi_ios; |
| 18805 | sprintf(uinfo->value.enumerated.name, "%dch", |
| 18806 | (uinfo->value.enumerated.item + 1) * 2); |
| 18807 | return 0; |
| 18808 | } |
| 18809 | |
| 18810 | static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 18811 | struct snd_ctl_elem_value *ucontrol) |
| 18812 | { |
| 18813 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 18814 | struct alc_spec *spec = codec->spec; |
| 18815 | ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2; |
| 18816 | return 0; |
| 18817 | } |
| 18818 | |
| 18819 | static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output) |
| 18820 | { |
| 18821 | struct alc_spec *spec = codec->spec; |
| 18822 | hda_nid_t nid = spec->multi_io[idx].pin; |
| 18823 | |
| 18824 | if (!spec->multi_io[idx].ctl_in) |
| 18825 | spec->multi_io[idx].ctl_in = |
| 18826 | snd_hda_codec_read(codec, nid, 0, |
| 18827 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 18828 | if (output) { |
| 18829 | snd_hda_codec_update_cache(codec, nid, 0, |
| 18830 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 18831 | PIN_OUT); |
| 18832 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 18833 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 18834 | HDA_AMP_MUTE, 0); |
| 18835 | alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac); |
| 18836 | } else { |
| 18837 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 18838 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 18839 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 18840 | snd_hda_codec_update_cache(codec, nid, 0, |
| 18841 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 18842 | spec->multi_io[idx].ctl_in); |
| 18843 | } |
| 18844 | return 0; |
| 18845 | } |
| 18846 | |
| 18847 | static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 18848 | struct snd_ctl_elem_value *ucontrol) |
| 18849 | { |
| 18850 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 18851 | struct alc_spec *spec = codec->spec; |
| 18852 | int i, ch; |
| 18853 | |
| 18854 | ch = ucontrol->value.enumerated.item[0]; |
| 18855 | if (ch < 0 || ch > spec->multi_ios) |
| 18856 | return -EINVAL; |
| 18857 | if (ch == (spec->ext_channel_count - 1) / 2) |
| 18858 | return 0; |
| 18859 | spec->ext_channel_count = (ch + 1) * 2; |
| 18860 | for (i = 0; i < spec->multi_ios; i++) |
| 18861 | alc_set_multi_io(codec, i, i < ch); |
| 18862 | spec->multiout.max_channels = spec->ext_channel_count; |
| 18863 | return 1; |
| 18864 | } |
| 18865 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18866 | static const struct snd_kcontrol_new alc_auto_channel_mode_enum = { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18867 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 18868 | .name = "Channel Mode", |
| 18869 | .info = alc_auto_ch_mode_info, |
| 18870 | .get = alc_auto_ch_mode_get, |
| 18871 | .put = alc_auto_ch_mode_put, |
| 18872 | }; |
| 18873 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 18874 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec, |
| 18875 | int (*fill_dac)(struct hda_codec *)) |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18876 | { |
| 18877 | struct alc_spec *spec = codec->spec; |
| 18878 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 18879 | unsigned int location, defcfg; |
| 18880 | int num_pins; |
| 18881 | |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 18882 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && cfg->hp_outs == 1) { |
| 18883 | /* use HP as primary out */ |
| 18884 | cfg->speaker_outs = cfg->line_outs; |
| 18885 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 18886 | sizeof(cfg->speaker_pins)); |
| 18887 | cfg->line_outs = cfg->hp_outs; |
| 18888 | memcpy(cfg->line_out_pins, cfg->hp_pins, sizeof(cfg->hp_pins)); |
| 18889 | cfg->hp_outs = 0; |
| 18890 | memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins)); |
| 18891 | cfg->line_out_type = AUTO_PIN_HP_OUT; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 18892 | if (fill_dac) |
| 18893 | fill_dac(codec); |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 18894 | } |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18895 | if (cfg->line_outs != 1 || |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 18896 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18897 | return 0; |
| 18898 | |
| 18899 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
| 18900 | location = get_defcfg_location(defcfg); |
| 18901 | |
| 18902 | num_pins = alc_auto_fill_multi_ios(codec, location); |
| 18903 | if (num_pins > 0) { |
| 18904 | struct snd_kcontrol_new *knew; |
| 18905 | |
| 18906 | knew = alc_kcontrol_new(spec); |
| 18907 | if (!knew) |
| 18908 | return -ENOMEM; |
| 18909 | *knew = alc_auto_channel_mode_enum; |
| 18910 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); |
| 18911 | if (!knew->name) |
| 18912 | return -ENOMEM; |
| 18913 | |
| 18914 | spec->multi_ios = num_pins; |
| 18915 | spec->ext_channel_count = 2; |
| 18916 | spec->multiout.num_dacs = num_pins + 1; |
| 18917 | } |
| 18918 | return 0; |
| 18919 | } |
| 18920 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18921 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18922 | { |
| 18923 | struct alc_spec *spec = codec->spec; |
| 18924 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18925 | static const hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18926 | |
| 18927 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18928 | alc662_ignore); |
| 18929 | if (err < 0) |
| 18930 | return err; |
| 18931 | if (!spec->autocfg.line_outs) |
| 18932 | return 0; /* can't find valid BIOS pin config */ |
| 18933 | |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18934 | err = alc_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18935 | if (err < 0) |
| 18936 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18937 | err = alc_auto_add_multi_channel_mode(codec, alc_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18938 | if (err < 0) |
| 18939 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18940 | err = alc_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18941 | if (err < 0) |
| 18942 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18943 | err = alc_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18944 | spec->autocfg.speaker_pins[0], |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18945 | spec->multiout.extra_out_nid[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18946 | "Speaker"); |
| 18947 | if (err < 0) |
| 18948 | return err; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18949 | err = alc_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18950 | spec->multiout.hp_nid, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18951 | "Headphone"); |
| 18952 | if (err < 0) |
| 18953 | return err; |
Takashi Iwai | b782170 | 2011-07-06 15:12:46 +0200 | [diff] [blame] | 18954 | err = alc_auto_create_input_ctls(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18955 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18956 | return err; |
| 18957 | |
| 18958 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18959 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18960 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18961 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18962 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18963 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18964 | |
| 18965 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18966 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18967 | |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18968 | err = alc_auto_add_mic_boost(codec); |
| 18969 | if (err < 0) |
| 18970 | return err; |
| 18971 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18972 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18973 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18974 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18975 | else |
| 18976 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18977 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18978 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18979 | } |
| 18980 | |
| 18981 | /* additional initialization for auto-configuration model */ |
| 18982 | static void alc662_auto_init(struct hda_codec *codec) |
| 18983 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18984 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 343a04b | 2011-07-06 14:28:39 +0200 | [diff] [blame] | 18985 | alc_auto_init_multi_out(codec); |
| 18986 | alc_auto_init_extra_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 18987 | alc_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18988 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18989 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18990 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18991 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18992 | } |
| 18993 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 18994 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 18995 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 18996 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 18997 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 18998 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 18999 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19000 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19001 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19002 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19003 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19004 | printk(KERN_WARNING |
| 19005 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19006 | } |
| 19007 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19008 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19009 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19010 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19011 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19012 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19013 | ALC662_FIXUP_SKU_IGNORE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19014 | }; |
| 19015 | |
| 19016 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19017 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19018 | .type = ALC_FIXUP_PINS, |
| 19019 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19020 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19021 | { } |
| 19022 | } |
| 19023 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19024 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19025 | .type = ALC_FIXUP_PINS, |
| 19026 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19027 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19028 | { } |
| 19029 | } |
| 19030 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19031 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19032 | .type = ALC_FIXUP_FUNC, |
| 19033 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19034 | }, |
| 19035 | [ALC662_FIXUP_CZC_P10T] = { |
| 19036 | .type = ALC_FIXUP_VERBS, |
| 19037 | .v.verbs = (const struct hda_verb[]) { |
| 19038 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19039 | {} |
| 19040 | } |
| 19041 | }, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19042 | [ALC662_FIXUP_SKU_IGNORE] = { |
| 19043 | .type = ALC_FIXUP_SKU, |
| 19044 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19045 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19046 | }; |
| 19047 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19048 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19049 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19050 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19051 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19052 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19053 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19054 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19055 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19056 | {} |
| 19057 | }; |
| 19058 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19059 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19060 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19061 | {} |
| 19062 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19063 | |
| 19064 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19065 | static int patch_alc662(struct hda_codec *codec) |
| 19066 | { |
| 19067 | struct alc_spec *spec; |
| 19068 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19069 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19070 | |
| 19071 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19072 | if (!spec) |
| 19073 | return -ENOMEM; |
| 19074 | |
| 19075 | codec->spec = spec; |
| 19076 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 19077 | spec->mixer_nid = 0x0b; |
| 19078 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19079 | alc_auto_parse_customize_define(codec); |
| 19080 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19081 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19082 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19083 | coef = alc_read_coef_idx(codec, 0); |
| 19084 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19085 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19086 | else if (coef & (1 << 14) && |
| 19087 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19088 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19089 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19090 | else if (coef == 0x4011) |
| 19091 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19092 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19093 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19094 | alc662_models, |
| 19095 | alc662_cfg_tbl); |
| 19096 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19097 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19098 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19099 | board_config = ALC662_AUTO; |
| 19100 | } |
| 19101 | |
| 19102 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19103 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19104 | alc662_fixup_tbl, alc662_fixups); |
| 19105 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19106 | /* automatic parse from the BIOS config */ |
| 19107 | err = alc662_parse_auto_config(codec); |
| 19108 | if (err < 0) { |
| 19109 | alc_free(codec); |
| 19110 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19111 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19112 | printk(KERN_INFO |
| 19113 | "hda_codec: Cannot set up configuration " |
| 19114 | "from BIOS. Using base mode...\n"); |
| 19115 | board_config = ALC662_3ST_2ch_DIG; |
| 19116 | } |
| 19117 | } |
| 19118 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19119 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19120 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19121 | if (err < 0) { |
| 19122 | alc_free(codec); |
| 19123 | return err; |
| 19124 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19125 | } |
| 19126 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19127 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19128 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19129 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19130 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19131 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19132 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19133 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19134 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19135 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19136 | if (!spec->adc_nids) { |
| 19137 | spec->adc_nids = alc662_adc_nids; |
| 19138 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19139 | } |
| 19140 | if (!spec->capsrc_nids) |
| 19141 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19142 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19143 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19144 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19145 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19146 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19147 | switch (codec->vendor_id) { |
| 19148 | case 0x10ec0662: |
| 19149 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19150 | break; |
| 19151 | case 0x10ec0272: |
| 19152 | case 0x10ec0663: |
| 19153 | case 0x10ec0665: |
| 19154 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19155 | break; |
| 19156 | case 0x10ec0273: |
| 19157 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19158 | break; |
| 19159 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19160 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19161 | spec->vmaster_nid = 0x02; |
| 19162 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19163 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19164 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19165 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19166 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19167 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 19168 | spec->shutup = alc_eapd_shutup; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19169 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19170 | alc_init_jacks(codec); |
| 19171 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19172 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19173 | if (!spec->loopback.amplist) |
| 19174 | spec->loopback.amplist = alc662_loopbacks; |
| 19175 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19176 | |
| 19177 | return 0; |
| 19178 | } |
| 19179 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19180 | static int patch_alc888(struct hda_codec *codec) |
| 19181 | { |
| 19182 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19183 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19184 | if (codec->vendor_id == 0x10ec0887) |
| 19185 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19186 | else |
| 19187 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19188 | if (!codec->chip_name) { |
| 19189 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19190 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19191 | } |
| 19192 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19193 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19194 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19195 | } |
| 19196 | |
Kailang Yang | b478b99 | 2011-05-18 11:51:15 +0200 | [diff] [blame] | 19197 | static int patch_alc899(struct hda_codec *codec) |
| 19198 | { |
| 19199 | if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) { |
| 19200 | kfree(codec->chip_name); |
| 19201 | codec->chip_name = kstrdup("ALC898", GFP_KERNEL); |
| 19202 | } |
| 19203 | return patch_alc882(codec); |
| 19204 | } |
| 19205 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19206 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19207 | * ALC680 support |
| 19208 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19209 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19210 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19211 | #define alc680_modes alc260_modes |
| 19212 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19213 | static const hda_nid_t alc680_dac_nids[3] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19214 | /* Lout1, Lout2, hp */ |
| 19215 | 0x02, 0x03, 0x04 |
| 19216 | }; |
| 19217 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19218 | static const hda_nid_t alc680_adc_nids[3] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19219 | /* ADC0-2 */ |
| 19220 | /* DMIC, MIC, Line-in*/ |
| 19221 | 0x07, 0x08, 0x09 |
| 19222 | }; |
| 19223 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19224 | /* |
| 19225 | * Analog capture ADC cgange |
| 19226 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19227 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19228 | { |
| 19229 | struct alc_spec *spec = codec->spec; |
| 19230 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19231 | int pin_found = 0; |
| 19232 | int type_found = AUTO_PIN_LAST; |
| 19233 | hda_nid_t nid; |
| 19234 | int i; |
| 19235 | |
| 19236 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19237 | nid = cfg->inputs[i].pin; |
Takashi Iwai | 06dec22 | 2011-05-17 10:00:16 +0200 | [diff] [blame] | 19238 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19239 | continue; |
| 19240 | if (snd_hda_jack_detect(codec, nid)) { |
| 19241 | if (cfg->inputs[i].type < type_found) { |
| 19242 | type_found = cfg->inputs[i].type; |
| 19243 | pin_found = nid; |
| 19244 | } |
| 19245 | } |
| 19246 | } |
| 19247 | |
| 19248 | nid = 0x07; |
| 19249 | if (pin_found) |
| 19250 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19251 | |
| 19252 | if (nid != spec->cur_adc) |
| 19253 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19254 | spec->cur_adc = nid; |
| 19255 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19256 | spec->cur_adc_format); |
| 19257 | } |
| 19258 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19259 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19260 | struct hda_codec *codec, |
| 19261 | unsigned int stream_tag, |
| 19262 | unsigned int format, |
| 19263 | struct snd_pcm_substream *substream) |
| 19264 | { |
| 19265 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19266 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19267 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19268 | spec->cur_adc_stream_tag = stream_tag; |
| 19269 | spec->cur_adc_format = format; |
| 19270 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19271 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19272 | return 0; |
| 19273 | } |
| 19274 | |
| 19275 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19276 | struct hda_codec *codec, |
| 19277 | struct snd_pcm_substream *substream) |
| 19278 | { |
| 19279 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19280 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19281 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19282 | return 0; |
| 19283 | } |
| 19284 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19285 | static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19286 | .substreams = 1, /* can be overridden */ |
| 19287 | .channels_min = 2, |
| 19288 | .channels_max = 2, |
| 19289 | /* NID is set in alc_build_pcms */ |
| 19290 | .ops = { |
| 19291 | .prepare = alc680_capture_pcm_prepare, |
| 19292 | .cleanup = alc680_capture_pcm_cleanup |
| 19293 | }, |
| 19294 | }; |
| 19295 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19296 | static const struct snd_kcontrol_new alc680_base_mixer[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19297 | /* output mixer control */ |
| 19298 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19299 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19300 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19301 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19302 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19303 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19304 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19305 | { } |
| 19306 | }; |
| 19307 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19308 | static const struct hda_bind_ctls alc680_bind_cap_vol = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19309 | .ops = &snd_hda_bind_vol, |
| 19310 | .values = { |
| 19311 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19312 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19313 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19314 | 0 |
| 19315 | }, |
| 19316 | }; |
| 19317 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19318 | static const struct hda_bind_ctls alc680_bind_cap_switch = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19319 | .ops = &snd_hda_bind_sw, |
| 19320 | .values = { |
| 19321 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19322 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19323 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19324 | 0 |
| 19325 | }, |
| 19326 | }; |
| 19327 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19328 | static const struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19329 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19330 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19331 | { } /* end */ |
| 19332 | }; |
| 19333 | |
| 19334 | /* |
| 19335 | * generic initialization of ADC, input mixers and output mixers |
| 19336 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19337 | static const struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19338 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19339 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19340 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19341 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19342 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19343 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19344 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19345 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19346 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19348 | |
| 19349 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19350 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19351 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19352 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19353 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19354 | |
| 19355 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19356 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19357 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19358 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19359 | { } |
| 19360 | }; |
| 19361 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19362 | /* toggle speaker-output according to the hp-jack state */ |
| 19363 | static void alc680_base_setup(struct hda_codec *codec) |
| 19364 | { |
| 19365 | struct alc_spec *spec = codec->spec; |
| 19366 | |
| 19367 | spec->autocfg.hp_pins[0] = 0x16; |
| 19368 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19369 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19370 | spec->autocfg.num_inputs = 2; |
| 19371 | spec->autocfg.inputs[0].pin = 0x18; |
| 19372 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19373 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19374 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19375 | spec->automute = 1; |
| 19376 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19377 | } |
| 19378 | |
| 19379 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19380 | unsigned int res) |
| 19381 | { |
| 19382 | if ((res >> 26) == ALC880_HP_EVENT) |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19383 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19384 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19385 | alc680_rec_autoswitch(codec); |
| 19386 | } |
| 19387 | |
| 19388 | static void alc680_inithook(struct hda_codec *codec) |
| 19389 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19390 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19391 | alc680_rec_autoswitch(codec); |
| 19392 | } |
| 19393 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19394 | /* create input playback/capture controls for the given pin */ |
| 19395 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19396 | const char *ctlname, int idx) |
| 19397 | { |
| 19398 | hda_nid_t dac; |
| 19399 | int err; |
| 19400 | |
| 19401 | switch (nid) { |
| 19402 | case 0x14: |
| 19403 | dac = 0x02; |
| 19404 | break; |
| 19405 | case 0x15: |
| 19406 | dac = 0x03; |
| 19407 | break; |
| 19408 | case 0x16: |
| 19409 | dac = 0x04; |
| 19410 | break; |
| 19411 | default: |
| 19412 | return 0; |
| 19413 | } |
| 19414 | if (spec->multiout.dac_nids[0] != dac && |
| 19415 | spec->multiout.dac_nids[1] != dac) { |
| 19416 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19417 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19418 | HDA_OUTPUT)); |
| 19419 | if (err < 0) |
| 19420 | return err; |
| 19421 | |
| 19422 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19423 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19424 | |
| 19425 | if (err < 0) |
| 19426 | return err; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 19427 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19428 | } |
| 19429 | |
| 19430 | return 0; |
| 19431 | } |
| 19432 | |
| 19433 | /* add playback controls from the parsed DAC table */ |
| 19434 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19435 | const struct auto_pin_cfg *cfg) |
| 19436 | { |
| 19437 | hda_nid_t nid; |
| 19438 | int err; |
| 19439 | |
| 19440 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19441 | |
| 19442 | nid = cfg->line_out_pins[0]; |
| 19443 | if (nid) { |
| 19444 | const char *name; |
Takashi Iwai | 2e925dd | 2011-06-24 11:27:22 +0200 | [diff] [blame] | 19445 | int index; |
| 19446 | name = alc_get_line_out_pfx(spec, 0, true, &index); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19447 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19448 | if (err < 0) |
| 19449 | return err; |
| 19450 | } |
| 19451 | |
| 19452 | nid = cfg->speaker_pins[0]; |
| 19453 | if (nid) { |
| 19454 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19455 | if (err < 0) |
| 19456 | return err; |
| 19457 | } |
| 19458 | nid = cfg->hp_pins[0]; |
| 19459 | if (nid) { |
| 19460 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19461 | if (err < 0) |
| 19462 | return err; |
| 19463 | } |
| 19464 | |
| 19465 | return 0; |
| 19466 | } |
| 19467 | |
| 19468 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19469 | hda_nid_t nid, int pin_type) |
| 19470 | { |
| 19471 | alc_set_pin_output(codec, nid, pin_type); |
| 19472 | } |
| 19473 | |
| 19474 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19475 | { |
| 19476 | struct alc_spec *spec = codec->spec; |
| 19477 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19478 | if (nid) { |
| 19479 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19480 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19481 | } |
| 19482 | } |
| 19483 | |
| 19484 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19485 | { |
| 19486 | struct alc_spec *spec = codec->spec; |
| 19487 | hda_nid_t pin; |
| 19488 | |
| 19489 | pin = spec->autocfg.hp_pins[0]; |
| 19490 | if (pin) |
| 19491 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19492 | pin = spec->autocfg.speaker_pins[0]; |
| 19493 | if (pin) |
| 19494 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19495 | } |
| 19496 | |
| 19497 | /* pcm configuration: identical with ALC880 */ |
| 19498 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19499 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19500 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19501 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19502 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19503 | |
| 19504 | /* |
| 19505 | * BIOS auto configuration |
| 19506 | */ |
| 19507 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19508 | { |
| 19509 | struct alc_spec *spec = codec->spec; |
| 19510 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19511 | static const hda_nid_t alc680_ignore[] = { 0 }; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19512 | |
| 19513 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19514 | alc680_ignore); |
| 19515 | if (err < 0) |
| 19516 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19517 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19518 | if (!spec->autocfg.line_outs) { |
| 19519 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19520 | spec->multiout.max_channels = 2; |
| 19521 | spec->no_analog = 1; |
| 19522 | goto dig_only; |
| 19523 | } |
| 19524 | return 0; /* can't find valid BIOS pin config */ |
| 19525 | } |
| 19526 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19527 | if (err < 0) |
| 19528 | return err; |
| 19529 | |
| 19530 | spec->multiout.max_channels = 2; |
| 19531 | |
| 19532 | dig_only: |
| 19533 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19534 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19535 | if (spec->kctls.list) |
| 19536 | add_mixer(spec, spec->kctls.list); |
| 19537 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19538 | err = alc_auto_add_mic_boost(codec); |
| 19539 | if (err < 0) |
| 19540 | return err; |
| 19541 | |
| 19542 | return 1; |
| 19543 | } |
| 19544 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19545 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19546 | static void alc680_auto_init(struct hda_codec *codec) |
| 19547 | { |
| 19548 | struct alc_spec *spec = codec->spec; |
| 19549 | alc680_auto_init_multi_out(codec); |
| 19550 | alc680_auto_init_hp_out(codec); |
Takashi Iwai | 0a7f532 | 2011-07-06 15:15:12 +0200 | [diff] [blame^] | 19551 | alc_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19552 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19553 | if (spec->unsol_event) |
| 19554 | alc_inithook(codec); |
| 19555 | } |
| 19556 | |
| 19557 | /* |
| 19558 | * configuration and preset |
| 19559 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19560 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19561 | [ALC680_BASE] = "base", |
| 19562 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19563 | }; |
| 19564 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19565 | static const struct snd_pci_quirk alc680_cfg_tbl[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19566 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19567 | {} |
| 19568 | }; |
| 19569 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19570 | static const struct alc_config_preset alc680_presets[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19571 | [ALC680_BASE] = { |
| 19572 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19573 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19574 | .init_verbs = { alc680_init_verbs }, |
| 19575 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19576 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19577 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19578 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19579 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19580 | .unsol_event = alc680_unsol_event, |
| 19581 | .setup = alc680_base_setup, |
| 19582 | .init_hook = alc680_inithook, |
| 19583 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19584 | }, |
| 19585 | }; |
| 19586 | |
| 19587 | static int patch_alc680(struct hda_codec *codec) |
| 19588 | { |
| 19589 | struct alc_spec *spec; |
| 19590 | int board_config; |
| 19591 | int err; |
| 19592 | |
| 19593 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19594 | if (spec == NULL) |
| 19595 | return -ENOMEM; |
| 19596 | |
| 19597 | codec->spec = spec; |
| 19598 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 19599 | /* ALC680 has no aa-loopback mixer */ |
| 19600 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19601 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19602 | alc680_models, |
| 19603 | alc680_cfg_tbl); |
| 19604 | |
| 19605 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19606 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19607 | codec->chip_name); |
| 19608 | board_config = ALC680_AUTO; |
| 19609 | } |
| 19610 | |
| 19611 | if (board_config == ALC680_AUTO) { |
| 19612 | /* automatic parse from the BIOS config */ |
| 19613 | err = alc680_parse_auto_config(codec); |
| 19614 | if (err < 0) { |
| 19615 | alc_free(codec); |
| 19616 | return err; |
| 19617 | } else if (!err) { |
| 19618 | printk(KERN_INFO |
| 19619 | "hda_codec: Cannot set up configuration " |
| 19620 | "from BIOS. Using base mode...\n"); |
| 19621 | board_config = ALC680_BASE; |
| 19622 | } |
| 19623 | } |
| 19624 | |
| 19625 | if (board_config != ALC680_AUTO) |
| 19626 | setup_preset(codec, &alc680_presets[board_config]); |
| 19627 | |
| 19628 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19629 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19630 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19631 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19632 | |
| 19633 | if (!spec->adc_nids) { |
| 19634 | spec->adc_nids = alc680_adc_nids; |
| 19635 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19636 | } |
| 19637 | |
| 19638 | if (!spec->cap_mixer) |
| 19639 | set_capture_mixer(codec); |
| 19640 | |
| 19641 | spec->vmaster_nid = 0x02; |
| 19642 | |
| 19643 | codec->patch_ops = alc_patch_ops; |
| 19644 | if (board_config == ALC680_AUTO) |
| 19645 | spec->init_hook = alc680_auto_init; |
| 19646 | |
| 19647 | return 0; |
| 19648 | } |
| 19649 | |
| 19650 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19651 | * patch entries |
| 19652 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19653 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 19654 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19655 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19656 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19657 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19658 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19659 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19660 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19661 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19662 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 19663 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19664 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19665 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19666 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19667 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19668 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19669 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19670 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19671 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19672 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19673 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19674 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19675 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19676 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19677 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19678 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19679 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19680 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19681 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19682 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19683 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19684 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19685 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19686 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19687 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19688 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19689 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19690 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Kailang Yang | b478b99 | 2011-05-18 11:51:15 +0200 | [diff] [blame] | 19691 | { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19692 | {} /* terminator */ |
| 19693 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19694 | |
| 19695 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19696 | |
| 19697 | MODULE_LICENSE("GPL"); |
| 19698 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19699 | |
| 19700 | static struct hda_codec_preset_list realtek_list = { |
| 19701 | .preset = snd_hda_preset_realtek, |
| 19702 | .owner = THIS_MODULE, |
| 19703 | }; |
| 19704 | |
| 19705 | static int __init patch_realtek_init(void) |
| 19706 | { |
| 19707 | return snd_hda_add_codec_preset(&realtek_list); |
| 19708 | } |
| 19709 | |
| 19710 | static void __exit patch_realtek_exit(void) |
| 19711 | { |
| 19712 | snd_hda_delete_codec_preset(&realtek_list); |
| 19713 | } |
| 19714 | |
| 19715 | module_init(patch_realtek_init) |
| 19716 | module_exit(patch_realtek_exit) |