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 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 316 | 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 | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 318 | 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 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | struct hda_pcm_stream *stream_analog_playback; |
| 329 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 330 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 331 | 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 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | struct hda_pcm_stream *stream_digital_playback; |
| 335 | struct hda_pcm_stream *stream_digital_capture; |
| 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; |
| 348 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 349 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 350 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 352 | /* capture setup for dynamic dual-adc switch */ |
| 353 | unsigned int cur_adc_idx; |
| 354 | hda_nid_t cur_adc; |
| 355 | unsigned int cur_adc_stream_tag; |
| 356 | unsigned int cur_adc_format; |
| 357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 359 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | const struct hda_input_mux *input_mux; |
| 361 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 362 | struct alc_mic_route ext_mic; |
| 363 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | |
| 365 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 366 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 368 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 369 | int const_channel_count; |
| 370 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | |
| 372 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 373 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 374 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 375 | /* dynamic controls, init_verbs and input_mux */ |
| 376 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 377 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 378 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 379 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 380 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 381 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 382 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 383 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 384 | /* hooks */ |
| 385 | void (*init_hook)(struct hda_codec *codec); |
| 386 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 387 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 388 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 389 | #endif |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 390 | void (*shutup)(struct hda_codec *codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 391 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 392 | /* for pin sensing */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 393 | unsigned int jack_present: 1; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 394 | unsigned int line_jack_present:1; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 395 | unsigned int master_mute:1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 396 | unsigned int auto_mic:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 397 | unsigned int automute:1; /* HP automute enabled */ |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 398 | unsigned int detect_line:1; /* Line-out detection enabled */ |
| 399 | unsigned int automute_lines:1; /* automute line-out as well */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 400 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 401 | /* other flags */ |
| 402 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 403 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 404 | unsigned int single_input_src:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 405 | |
| 406 | /* auto-mute control */ |
| 407 | int automute_mode; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 408 | hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 409 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 410 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 411 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 412 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 413 | /* for virtual master */ |
| 414 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 415 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 416 | struct hda_loopback_check loopback; |
| 417 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 418 | |
| 419 | /* for PLL fix */ |
| 420 | hda_nid_t pll_nid; |
| 421 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 422 | |
| 423 | /* fix-up list */ |
| 424 | int fixup_id; |
| 425 | const struct alc_fixup *fixup_list; |
| 426 | const char *fixup_name; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 427 | |
| 428 | /* multi-io */ |
| 429 | int multi_ios; |
| 430 | struct alc_multi_io multi_io[4]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 431 | }; |
| 432 | |
| 433 | /* |
| 434 | * configuration template - to be copied to the spec instance |
| 435 | */ |
| 436 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 437 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 438 | * with spec |
| 439 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 440 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 441 | const struct hda_verb *init_verbs[5]; |
| 442 | unsigned int num_dacs; |
| 443 | hda_nid_t *dac_nids; |
| 444 | hda_nid_t dig_out_nid; /* optional */ |
| 445 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 446 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 447 | unsigned int num_adc_nids; |
| 448 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 449 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 450 | hda_nid_t dig_in_nid; |
| 451 | unsigned int num_channel_mode; |
| 452 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 453 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 454 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 455 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 456 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 457 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 458 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 459 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 460 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 461 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 462 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 463 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | }; |
| 465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | |
| 467 | /* |
| 468 | * input MUX handling |
| 469 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { |
| 473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 474 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 475 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 476 | if (mux_idx >= spec->num_mux_defs) |
| 477 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 478 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 479 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 480 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | } |
| 482 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 483 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 484 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | { |
| 486 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 487 | struct alc_spec *spec = codec->spec; |
| 488 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 489 | |
| 490 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 491 | return 0; |
| 492 | } |
| 493 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 494 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 495 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | { |
| 497 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 498 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 499 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 501 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 502 | hda_nid_t nid = spec->capsrc_nids ? |
| 503 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 504 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 506 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 507 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 508 | if (!imux->num_items && mux_idx > 0) |
| 509 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 510 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 511 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 512 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 513 | /* Matrix-mixer style (e.g. ALC882) */ |
| 514 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 515 | unsigned int i, idx; |
| 516 | |
| 517 | idx = ucontrol->value.enumerated.item[0]; |
| 518 | if (idx >= imux->num_items) |
| 519 | idx = imux->num_items - 1; |
| 520 | if (*cur_val == idx) |
| 521 | return 0; |
| 522 | for (i = 0; i < imux->num_items; i++) { |
| 523 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 524 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 525 | imux->items[i].index, |
| 526 | HDA_AMP_MUTE, v); |
| 527 | } |
| 528 | *cur_val = idx; |
| 529 | return 1; |
| 530 | } else { |
| 531 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 532 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 533 | &spec->cur_mux[adc_idx]); |
| 534 | } |
| 535 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 536 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | /* |
| 538 | * channel mode setting |
| 539 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 540 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 541 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | { |
| 543 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 544 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 545 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 546 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | } |
| 548 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 549 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 550 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | { |
| 552 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 553 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 554 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 556 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | } |
| 558 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 560 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | { |
| 562 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 563 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 564 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 565 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 566 | &spec->ext_channel_count); |
| 567 | if (err >= 0 && !spec->const_channel_count) { |
| 568 | spec->multiout.max_channels = spec->ext_channel_count; |
| 569 | if (spec->need_dac_fix) |
| 570 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 571 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 572 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | } |
| 574 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 577 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 578 | * being part of a format specifier. Maximum allowed length of a value is |
| 579 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 580 | * |
| 581 | * Note: some retasking pin complexes seem to ignore requests for input |
| 582 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 583 | * are requested. Therefore order this list so that this behaviour will not |
| 584 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 585 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 586 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 587 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 588 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 589 | "Mic 50pc bias", "Mic 80pc bias", |
| 590 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | }; |
| 592 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 593 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 594 | }; |
| 595 | /* 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] | 596 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 597 | * addition, "input" pins may or may not process the mic bias option |
| 598 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 599 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 600 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 602 | #define ALC_PIN_DIR_IN 0x00 |
| 603 | #define ALC_PIN_DIR_OUT 0x01 |
| 604 | #define ALC_PIN_DIR_INOUT 0x02 |
| 605 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 606 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 607 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 608 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | * For each direction the minimum and maximum values are given. |
| 610 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 611 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 612 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 613 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 614 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 615 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 616 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 617 | }; |
| 618 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 619 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 620 | #define alc_pin_mode_n_items(_dir) \ |
| 621 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 624 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 625 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | unsigned int item_num = uinfo->value.enumerated.item; |
| 627 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 628 | |
| 629 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 630 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 631 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 632 | |
| 633 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 634 | item_num = alc_pin_mode_min(dir); |
| 635 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 636 | return 0; |
| 637 | } |
| 638 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 639 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 641 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 642 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 644 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 645 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 646 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 647 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 648 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 649 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 650 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 651 | /* Find enumerated value for current pinctl setting */ |
| 652 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 653 | 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] | 654 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 655 | *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] | 656 | return 0; |
| 657 | } |
| 658 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 659 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 660 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 661 | { |
| 662 | signed int change; |
| 663 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 664 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 665 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 666 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 667 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 668 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 669 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 670 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 671 | 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] | 672 | val = alc_pin_mode_min(dir); |
| 673 | |
| 674 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 675 | if (change) { |
| 676 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 677 | snd_hda_codec_write_cache(codec, nid, 0, |
| 678 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 679 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 680 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 681 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 682 | * for the requested pin mode. Enum values of 2 or less are |
| 683 | * input modes. |
| 684 | * |
| 685 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 686 | * reduces noise slightly (particularly on input) so we'll |
| 687 | * do it. However, having both input and output buffers |
| 688 | * enabled simultaneously doesn't seem to be problematic if |
| 689 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 690 | */ |
| 691 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 692 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 693 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 694 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 695 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 696 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 697 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 698 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 699 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 700 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 701 | } |
| 702 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 703 | return change; |
| 704 | } |
| 705 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 706 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 707 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 708 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 709 | .info = alc_pin_mode_info, \ |
| 710 | .get = alc_pin_mode_get, \ |
| 711 | .put = alc_pin_mode_put, \ |
| 712 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 713 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 714 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 715 | * together using a mask with more than one bit set. This control is |
| 716 | * currently used only by the ALC260 test model. At this stage they are not |
| 717 | * needed for any "production" models. |
| 718 | */ |
| 719 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 720 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 721 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 723 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 724 | { |
| 725 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 726 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 727 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 728 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 729 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 730 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 731 | |
| 732 | *valp = (val & mask) != 0; |
| 733 | return 0; |
| 734 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 735 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 736 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 737 | { |
| 738 | signed int change; |
| 739 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 740 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 741 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 742 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 743 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 744 | AC_VERB_GET_GPIO_DATA, |
| 745 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 746 | |
| 747 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 748 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 749 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 750 | gpio_data &= ~mask; |
| 751 | else |
| 752 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 753 | snd_hda_codec_write_cache(codec, nid, 0, |
| 754 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 755 | |
| 756 | return change; |
| 757 | } |
| 758 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 759 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 760 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 761 | .info = alc_gpio_data_info, \ |
| 762 | .get = alc_gpio_data_get, \ |
| 763 | .put = alc_gpio_data_put, \ |
| 764 | .private_value = nid | (mask<<16) } |
| 765 | #endif /* CONFIG_SND_DEBUG */ |
| 766 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 767 | /* A switch control to allow the enabling of the digital IO pins on the |
| 768 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 769 | * to provide something in the test model allowing digital outputs to be |
| 770 | * identified if present. If models are found which can utilise these |
| 771 | * outputs a more complete mixer control can be devised for those models if |
| 772 | * necessary. |
| 773 | */ |
| 774 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 775 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 776 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 777 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 778 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 779 | { |
| 780 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 781 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 782 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 783 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 784 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 785 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 786 | |
| 787 | *valp = (val & mask) != 0; |
| 788 | return 0; |
| 789 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 790 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 791 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 792 | { |
| 793 | signed int change; |
| 794 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 795 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 796 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 797 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 798 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 799 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 800 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 801 | |
| 802 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 803 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 804 | if (val==0) |
| 805 | ctrl_data &= ~mask; |
| 806 | else |
| 807 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 808 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 809 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 810 | |
| 811 | return change; |
| 812 | } |
| 813 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 814 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 815 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 816 | .info = alc_spdif_ctrl_info, \ |
| 817 | .get = alc_spdif_ctrl_get, \ |
| 818 | .put = alc_spdif_ctrl_put, \ |
| 819 | .private_value = nid | (mask<<16) } |
| 820 | #endif /* CONFIG_SND_DEBUG */ |
| 821 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 822 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 823 | * Again, this is only used in the ALC26x test models to help identify when |
| 824 | * the EAPD line must be asserted for features to work. |
| 825 | */ |
| 826 | #ifdef CONFIG_SND_DEBUG |
| 827 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 828 | |
| 829 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 830 | struct snd_ctl_elem_value *ucontrol) |
| 831 | { |
| 832 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 833 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 834 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 835 | long *valp = ucontrol->value.integer.value; |
| 836 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 837 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 838 | |
| 839 | *valp = (val & mask) != 0; |
| 840 | return 0; |
| 841 | } |
| 842 | |
| 843 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 844 | struct snd_ctl_elem_value *ucontrol) |
| 845 | { |
| 846 | int change; |
| 847 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 848 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 849 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 850 | long val = *ucontrol->value.integer.value; |
| 851 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 852 | AC_VERB_GET_EAPD_BTLENABLE, |
| 853 | 0x00); |
| 854 | |
| 855 | /* Set/unset the masked control bit(s) as needed */ |
| 856 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 857 | if (!val) |
| 858 | ctrl_data &= ~mask; |
| 859 | else |
| 860 | ctrl_data |= mask; |
| 861 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 862 | ctrl_data); |
| 863 | |
| 864 | return change; |
| 865 | } |
| 866 | |
| 867 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 868 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 869 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 870 | .info = alc_eapd_ctrl_info, \ |
| 871 | .get = alc_eapd_ctrl_get, \ |
| 872 | .put = alc_eapd_ctrl_put, \ |
| 873 | .private_value = nid | (mask<<16) } |
| 874 | #endif /* CONFIG_SND_DEBUG */ |
| 875 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 876 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 877 | * set up the input pin config (depending on the given auto-pin type) |
| 878 | */ |
| 879 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 880 | int auto_pin_type) |
| 881 | { |
| 882 | unsigned int val = PIN_IN; |
| 883 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 884 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 885 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 886 | unsigned int oldval; |
| 887 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 888 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 889 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 890 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 891 | /* if the default pin setup is vref50, we give it priority */ |
| 892 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 893 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 894 | else if (pincap & AC_PINCAP_VREF_50) |
| 895 | val = PIN_VREF50; |
| 896 | else if (pincap & AC_PINCAP_VREF_100) |
| 897 | val = PIN_VREF100; |
| 898 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 899 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 900 | } |
| 901 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 902 | } |
| 903 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 904 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 905 | { |
| 906 | struct alc_spec *spec = codec->spec; |
| 907 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 908 | |
| 909 | if (!cfg->line_outs) { |
| 910 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 911 | cfg->line_out_pins[cfg->line_outs]) |
| 912 | cfg->line_outs++; |
| 913 | } |
| 914 | if (!cfg->speaker_outs) { |
| 915 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 916 | cfg->speaker_pins[cfg->speaker_outs]) |
| 917 | cfg->speaker_outs++; |
| 918 | } |
| 919 | if (!cfg->hp_outs) { |
| 920 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 921 | cfg->hp_pins[cfg->hp_outs]) |
| 922 | cfg->hp_outs++; |
| 923 | } |
| 924 | } |
| 925 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 926 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 927 | */ |
| 928 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 929 | { |
| 930 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 931 | return; |
| 932 | spec->mixers[spec->num_mixers++] = mix; |
| 933 | } |
| 934 | |
| 935 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 936 | { |
| 937 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 938 | return; |
| 939 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 940 | } |
| 941 | |
| 942 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 943 | * set up from the preset table |
| 944 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 945 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 946 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 947 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 948 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 949 | int i; |
| 950 | |
| 951 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 952 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 953 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 954 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 955 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 956 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 957 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 958 | spec->channel_mode = preset->channel_mode; |
| 959 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 960 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 961 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 962 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 963 | if (preset->const_channel_count) |
| 964 | spec->multiout.max_channels = preset->const_channel_count; |
| 965 | else |
| 966 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 967 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 968 | |
| 969 | spec->multiout.num_dacs = preset->num_dacs; |
| 970 | spec->multiout.dac_nids = preset->dac_nids; |
| 971 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 972 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 973 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 974 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 975 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 976 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 977 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 978 | spec->input_mux = preset->input_mux; |
| 979 | |
| 980 | spec->num_adc_nids = preset->num_adc_nids; |
| 981 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 982 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 983 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 984 | |
| 985 | spec->unsol_event = preset->unsol_event; |
| 986 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 987 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 988 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 989 | spec->loopback.amplist = preset->loopbacks; |
| 990 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 991 | |
| 992 | if (preset->setup) |
| 993 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 994 | |
| 995 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 996 | } |
| 997 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 998 | /* Enable GPIO mask and set output */ |
| 999 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 1000 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 1001 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 1002 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 1003 | { } |
| 1004 | }; |
| 1005 | |
| 1006 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 1007 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 1008 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 1009 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 1010 | { } |
| 1011 | }; |
| 1012 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1013 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 1014 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 1015 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 1016 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 1017 | { } |
| 1018 | }; |
| 1019 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 1020 | /* |
| 1021 | * Fix hardware PLL issue |
| 1022 | * On some codecs, the analog PLL gating control must be off while |
| 1023 | * the default value is 1. |
| 1024 | */ |
| 1025 | static void alc_fix_pll(struct hda_codec *codec) |
| 1026 | { |
| 1027 | struct alc_spec *spec = codec->spec; |
| 1028 | unsigned int val; |
| 1029 | |
| 1030 | if (!spec->pll_nid) |
| 1031 | return; |
| 1032 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1033 | spec->pll_coef_idx); |
| 1034 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1035 | AC_VERB_GET_PROC_COEF, 0); |
| 1036 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1037 | spec->pll_coef_idx); |
| 1038 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1039 | val & ~(1 << spec->pll_coef_bit)); |
| 1040 | } |
| 1041 | |
| 1042 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1043 | unsigned int coef_idx, unsigned int coef_bit) |
| 1044 | { |
| 1045 | struct alc_spec *spec = codec->spec; |
| 1046 | spec->pll_nid = nid; |
| 1047 | spec->pll_coef_idx = coef_idx; |
| 1048 | spec->pll_coef_bit = coef_bit; |
| 1049 | alc_fix_pll(codec); |
| 1050 | } |
| 1051 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1052 | static int alc_init_jacks(struct hda_codec *codec) |
| 1053 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1054 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1055 | struct alc_spec *spec = codec->spec; |
| 1056 | int err; |
| 1057 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1058 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1059 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1060 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1061 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1062 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1063 | if (err < 0) |
| 1064 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1065 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1066 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1067 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1068 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1069 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1070 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1071 | if (err < 0) |
| 1072 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1073 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1074 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1075 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1076 | return 0; |
| 1077 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1078 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1079 | 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] | 1080 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1081 | int i, present = 0; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1082 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1083 | for (i = 0; i < num_pins; i++) { |
| 1084 | hda_nid_t nid = pins[i]; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1085 | if (!nid) |
| 1086 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1087 | snd_hda_input_jack_report(codec, nid); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1088 | present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1089 | } |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1090 | return present; |
| 1091 | } |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1092 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1093 | 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] | 1094 | bool mute, bool hp_out) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1095 | { |
| 1096 | struct alc_spec *spec = codec->spec; |
| 1097 | unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1098 | unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1099 | int i; |
| 1100 | |
| 1101 | for (i = 0; i < num_pins; i++) { |
| 1102 | hda_nid_t nid = pins[i]; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1103 | if (!nid) |
| 1104 | break; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1105 | switch (spec->automute_mode) { |
| 1106 | case ALC_AUTOMUTE_PIN: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1107 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1108 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1109 | pin_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1110 | break; |
| 1111 | case ALC_AUTOMUTE_AMP: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1112 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1113 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1114 | break; |
| 1115 | case ALC_AUTOMUTE_MIXER: |
| 1116 | nid = spec->automute_mixer_nid[i]; |
| 1117 | if (!nid) |
| 1118 | break; |
| 1119 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1120 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1121 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1122 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1123 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1124 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1125 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | } |
| 1127 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1128 | /* Toggle internal speakers muting */ |
| 1129 | static void update_speakers(struct hda_codec *codec) |
| 1130 | { |
| 1131 | struct alc_spec *spec = codec->spec; |
| 1132 | |
| 1133 | do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), |
| 1134 | spec->autocfg.speaker_pins, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1135 | spec->jack_present | spec->line_jack_present | |
| 1136 | spec->master_mute, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1137 | |
| 1138 | /* toggle line-out mutes if needed, too */ |
| 1139 | if (!spec->automute_lines) |
| 1140 | return; |
| 1141 | do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
| 1142 | spec->autocfg.line_out_pins, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1143 | spec->jack_present | spec->master_mute, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1144 | } |
| 1145 | |
| 1146 | static void alc_hp_automute(struct hda_codec *codec) |
| 1147 | { |
| 1148 | struct alc_spec *spec = codec->spec; |
| 1149 | |
| 1150 | if (!spec->automute) |
| 1151 | return; |
| 1152 | spec->jack_present = |
| 1153 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 1154 | spec->autocfg.hp_pins); |
| 1155 | update_speakers(codec); |
| 1156 | } |
| 1157 | |
| 1158 | static void alc_line_automute(struct hda_codec *codec) |
| 1159 | { |
| 1160 | struct alc_spec *spec = codec->spec; |
| 1161 | |
| 1162 | if (!spec->automute || !spec->detect_line) |
| 1163 | return; |
| 1164 | spec->line_jack_present = |
| 1165 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
| 1166 | spec->autocfg.line_out_pins); |
| 1167 | update_speakers(codec); |
| 1168 | } |
| 1169 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1170 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1171 | hda_nid_t nid) |
| 1172 | { |
| 1173 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1174 | int i, nums; |
| 1175 | |
| 1176 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1177 | for (i = 0; i < nums; i++) |
| 1178 | if (conn[i] == nid) |
| 1179 | return i; |
| 1180 | return -1; |
| 1181 | } |
| 1182 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1183 | /* switch the current ADC according to the jack state */ |
| 1184 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1185 | { |
| 1186 | struct alc_spec *spec = codec->spec; |
| 1187 | unsigned int present; |
| 1188 | hda_nid_t new_adc; |
| 1189 | |
| 1190 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1191 | if (present) |
| 1192 | spec->cur_adc_idx = 1; |
| 1193 | else |
| 1194 | spec->cur_adc_idx = 0; |
| 1195 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1196 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1197 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1198 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1199 | spec->cur_adc = new_adc; |
| 1200 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1201 | spec->cur_adc_stream_tag, 0, |
| 1202 | spec->cur_adc_format); |
| 1203 | } |
| 1204 | } |
| 1205 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1206 | static void alc_mic_automute(struct hda_codec *codec) |
| 1207 | { |
| 1208 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1209 | struct alc_mic_route *dead, *alive; |
| 1210 | unsigned int present, type; |
| 1211 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1212 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1213 | if (!spec->auto_mic) |
| 1214 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1215 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1216 | return; |
| 1217 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1218 | return; |
| 1219 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1220 | if (spec->dual_adc_switch) { |
| 1221 | alc_dual_mic_adc_auto_switch(codec); |
| 1222 | return; |
| 1223 | } |
| 1224 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1225 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1226 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1227 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1228 | if (present) { |
| 1229 | alive = &spec->ext_mic; |
| 1230 | dead = &spec->int_mic; |
| 1231 | } else { |
| 1232 | alive = &spec->int_mic; |
| 1233 | dead = &spec->ext_mic; |
| 1234 | } |
| 1235 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1236 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1237 | if (type == AC_WID_AUD_MIX) { |
| 1238 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1239 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1240 | alive->mux_idx, |
| 1241 | HDA_AMP_MUTE, 0); |
| 1242 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1243 | dead->mux_idx, |
| 1244 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1245 | } else { |
| 1246 | /* MUX style (e.g. ALC880) */ |
| 1247 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1248 | AC_VERB_SET_CONNECT_SEL, |
| 1249 | alive->mux_idx); |
| 1250 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1251 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1252 | |
| 1253 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1254 | } |
| 1255 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1256 | /* unsolicited event for HP jack sensing */ |
| 1257 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1258 | { |
| 1259 | if (codec->vendor_id == 0x10ec0880) |
| 1260 | res >>= 28; |
| 1261 | else |
| 1262 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1263 | switch (res) { |
| 1264 | case ALC880_HP_EVENT: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1265 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1266 | break; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1267 | case ALC880_FRONT_EVENT: |
| 1268 | alc_line_automute(codec); |
| 1269 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1270 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1271 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1272 | break; |
| 1273 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1274 | } |
| 1275 | |
| 1276 | static void alc_inithook(struct hda_codec *codec) |
| 1277 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1278 | alc_hp_automute(codec); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1279 | alc_line_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1280 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1281 | } |
| 1282 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1283 | /* additional initialization for ALC888 variants */ |
| 1284 | static void alc888_coef_init(struct hda_codec *codec) |
| 1285 | { |
| 1286 | unsigned int tmp; |
| 1287 | |
| 1288 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1289 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1290 | 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] | 1291 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1292 | /* alc888S-VC */ |
| 1293 | snd_hda_codec_read(codec, 0x20, 0, |
| 1294 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1295 | else |
| 1296 | /* alc888-VB */ |
| 1297 | snd_hda_codec_read(codec, 0x20, 0, |
| 1298 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1299 | } |
| 1300 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1301 | static void alc889_coef_init(struct hda_codec *codec) |
| 1302 | { |
| 1303 | unsigned int tmp; |
| 1304 | |
| 1305 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1306 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1307 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1308 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1309 | } |
| 1310 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1311 | /* turn on/off EAPD control (only if available) */ |
| 1312 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1313 | { |
| 1314 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1315 | return; |
| 1316 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1317 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1318 | on ? 2 : 0); |
| 1319 | } |
| 1320 | |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1321 | /* turn on/off EAPD controls of the codec */ |
| 1322 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) |
| 1323 | { |
| 1324 | /* We currently only handle front, HP */ |
| 1325 | switch (codec->vendor_id) { |
| 1326 | case 0x10ec0260: |
| 1327 | set_eapd(codec, 0x0f, on); |
| 1328 | set_eapd(codec, 0x10, on); |
| 1329 | break; |
| 1330 | case 0x10ec0262: |
| 1331 | case 0x10ec0267: |
| 1332 | case 0x10ec0268: |
| 1333 | case 0x10ec0269: |
| 1334 | case 0x10ec0270: |
| 1335 | case 0x10ec0272: |
| 1336 | case 0x10ec0660: |
| 1337 | case 0x10ec0662: |
| 1338 | case 0x10ec0663: |
| 1339 | case 0x10ec0665: |
| 1340 | case 0x10ec0862: |
| 1341 | case 0x10ec0889: |
| 1342 | case 0x10ec0892: |
| 1343 | set_eapd(codec, 0x14, on); |
| 1344 | set_eapd(codec, 0x15, on); |
| 1345 | break; |
| 1346 | } |
| 1347 | } |
| 1348 | |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 1349 | /* generic shutup callback; |
| 1350 | * just turning off EPAD and a little pause for avoiding pop-noise |
| 1351 | */ |
| 1352 | static void alc_eapd_shutup(struct hda_codec *codec) |
| 1353 | { |
| 1354 | alc_auto_setup_eapd(codec, false); |
| 1355 | msleep(200); |
| 1356 | } |
| 1357 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1358 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1359 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1360 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1361 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1362 | switch (type) { |
| 1363 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1364 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1365 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1366 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1367 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1368 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1369 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1370 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1371 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1372 | case ALC_INIT_DEFAULT: |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1373 | alc_auto_setup_eapd(codec, true); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1374 | switch (codec->vendor_id) { |
| 1375 | case 0x10ec0260: |
| 1376 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1377 | AC_VERB_SET_COEF_INDEX, 7); |
| 1378 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1379 | AC_VERB_GET_PROC_COEF, 0); |
| 1380 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1381 | AC_VERB_SET_COEF_INDEX, 7); |
| 1382 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1383 | AC_VERB_SET_PROC_COEF, |
| 1384 | tmp | 0x2010); |
| 1385 | break; |
| 1386 | case 0x10ec0262: |
| 1387 | case 0x10ec0880: |
| 1388 | case 0x10ec0882: |
| 1389 | case 0x10ec0883: |
| 1390 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1391 | case 0x10ec0887: |
Takashi Iwai | 20b67dd | 2011-03-23 22:54:32 +0100 | [diff] [blame] | 1392 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1393 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1394 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1395 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1396 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1397 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1398 | #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] | 1399 | case 0x10ec0267: |
| 1400 | case 0x10ec0268: |
| 1401 | snd_hda_codec_write(codec, 0x20, 0, |
| 1402 | AC_VERB_SET_COEF_INDEX, 7); |
| 1403 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1404 | AC_VERB_GET_PROC_COEF, 0); |
| 1405 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1406 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1407 | snd_hda_codec_write(codec, 0x20, 0, |
| 1408 | AC_VERB_SET_PROC_COEF, |
| 1409 | tmp | 0x3000); |
| 1410 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1411 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1412 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1413 | break; |
| 1414 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1415 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1416 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1417 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1418 | { |
| 1419 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1420 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1421 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1422 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1423 | if (!cfg->hp_pins[0]) { |
| 1424 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1425 | return; |
| 1426 | } |
| 1427 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1428 | if (!cfg->speaker_pins[0]) { |
| 1429 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1430 | return; |
| 1431 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1432 | sizeof(cfg->speaker_pins)); |
| 1433 | cfg->speaker_outs = cfg->line_outs; |
| 1434 | } |
| 1435 | |
| 1436 | if (!cfg->hp_pins[0]) { |
| 1437 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1438 | sizeof(cfg->hp_pins)); |
| 1439 | cfg->hp_outs = cfg->line_outs; |
| 1440 | } |
| 1441 | |
| 1442 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1443 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1444 | cfg->hp_pins[i]); |
| 1445 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1446 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1447 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1448 | spec->automute = 1; |
| 1449 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1450 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1451 | spec->unsol_event = alc_sku_unsol_event; |
| 1452 | } |
| 1453 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1454 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1455 | { |
| 1456 | struct alc_spec *spec = codec->spec; |
| 1457 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1458 | hda_nid_t fixed, ext; |
| 1459 | int i; |
| 1460 | |
| 1461 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1462 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1463 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1464 | return; |
| 1465 | |
| 1466 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1467 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1468 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1469 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1470 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1471 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1472 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1473 | if (fixed) |
| 1474 | return; /* already occupied */ |
| 1475 | fixed = nid; |
| 1476 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1477 | case INPUT_PIN_ATTR_UNUSED: |
| 1478 | return; /* invalid entry */ |
| 1479 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1480 | if (ext) |
| 1481 | return; /* already occupied */ |
| 1482 | ext = nid; |
| 1483 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1484 | } |
| 1485 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1486 | if (!ext || !fixed) |
| 1487 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1488 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1489 | return; /* no unsol support */ |
| 1490 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1491 | ext, fixed); |
| 1492 | spec->ext_mic.pin = ext; |
| 1493 | spec->int_mic.pin = fixed; |
| 1494 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1495 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1496 | spec->auto_mic = 1; |
| 1497 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1498 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1499 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1500 | spec->unsol_event = alc_sku_unsol_event; |
| 1501 | } |
| 1502 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1503 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1504 | * the driver to ignore any present sku defines. |
| 1505 | */ |
| 1506 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1507 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1508 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1509 | { |
| 1510 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1511 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1512 | struct alc_spec *spec = codec->spec; |
| 1513 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1514 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1515 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1516 | if (spec->cdefine.fixup) { |
| 1517 | ass = spec->cdefine.sku_cfg; |
| 1518 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1519 | return -1; |
| 1520 | goto do_sku; |
| 1521 | } |
| 1522 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1523 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1524 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1525 | goto do_sku; |
| 1526 | |
| 1527 | nid = 0x1d; |
| 1528 | if (codec->vendor_id == 0x10ec0260) |
| 1529 | nid = 0x17; |
| 1530 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1531 | |
| 1532 | if (!(ass & 1)) { |
| 1533 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1534 | codec->chip_name, ass); |
| 1535 | return -1; |
| 1536 | } |
| 1537 | |
| 1538 | /* check sum */ |
| 1539 | tmp = 0; |
| 1540 | for (i = 1; i < 16; i++) { |
| 1541 | if ((ass >> i) & 1) |
| 1542 | tmp++; |
| 1543 | } |
| 1544 | if (((ass >> 16) & 0xf) != tmp) |
| 1545 | return -1; |
| 1546 | |
| 1547 | spec->cdefine.port_connectivity = ass >> 30; |
| 1548 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1549 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1550 | spec->cdefine.customization = ass >> 8; |
| 1551 | do_sku: |
| 1552 | spec->cdefine.sku_cfg = ass; |
| 1553 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1554 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1555 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1556 | spec->cdefine.override = ass & 0x1; |
| 1557 | |
| 1558 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1559 | nid, spec->cdefine.sku_cfg); |
| 1560 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1561 | spec->cdefine.port_connectivity); |
| 1562 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1563 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1564 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1565 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1566 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1567 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1568 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1569 | |
| 1570 | return 0; |
| 1571 | } |
| 1572 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1573 | /* check subsystem ID and set up device-specific initialization; |
| 1574 | * return 1 if initialized, 0 if invalid SSID |
| 1575 | */ |
| 1576 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1577 | * 31 ~ 16 : Manufacture ID |
| 1578 | * 15 ~ 8 : SKU ID |
| 1579 | * 7 ~ 0 : Assembly ID |
| 1580 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1581 | */ |
| 1582 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1583 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1584 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1585 | { |
| 1586 | unsigned int ass, tmp, i; |
| 1587 | unsigned nid; |
| 1588 | struct alc_spec *spec = codec->spec; |
| 1589 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1590 | if (spec->cdefine.fixup) { |
| 1591 | ass = spec->cdefine.sku_cfg; |
| 1592 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1593 | return 0; |
| 1594 | goto do_sku; |
| 1595 | } |
| 1596 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1597 | ass = codec->subsystem_id & 0xffff; |
| 1598 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1599 | goto do_sku; |
| 1600 | |
| 1601 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1602 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1603 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1604 | * 29~21 : reserve |
| 1605 | * 20 : PCBEEP input |
| 1606 | * 19~16 : Check sum (15:1) |
| 1607 | * 15~1 : Custom |
| 1608 | * 0 : override |
| 1609 | */ |
| 1610 | nid = 0x1d; |
| 1611 | if (codec->vendor_id == 0x10ec0260) |
| 1612 | nid = 0x17; |
| 1613 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1614 | snd_printd("realtek: No valid SSID, " |
| 1615 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1616 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1617 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1618 | return 0; |
| 1619 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1620 | return 0; |
| 1621 | |
| 1622 | /* check sum */ |
| 1623 | tmp = 0; |
| 1624 | for (i = 1; i < 16; i++) { |
| 1625 | if ((ass >> i) & 1) |
| 1626 | tmp++; |
| 1627 | } |
| 1628 | if (((ass >> 16) & 0xf) != tmp) |
| 1629 | return 0; |
| 1630 | do_sku: |
| 1631 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1632 | ass & 0xffff, codec->vendor_id); |
| 1633 | /* |
| 1634 | * 0 : override |
| 1635 | * 1 : Swap Jack |
| 1636 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1637 | * 3~5 : External Amplifier control |
| 1638 | * 7~6 : Reserved |
| 1639 | */ |
| 1640 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1641 | switch (tmp) { |
| 1642 | case 1: |
| 1643 | spec->init_amp = ALC_INIT_GPIO1; |
| 1644 | break; |
| 1645 | case 3: |
| 1646 | spec->init_amp = ALC_INIT_GPIO2; |
| 1647 | break; |
| 1648 | case 7: |
| 1649 | spec->init_amp = ALC_INIT_GPIO3; |
| 1650 | break; |
| 1651 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1652 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1653 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1654 | break; |
| 1655 | } |
| 1656 | |
| 1657 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1658 | * when the external headphone out jack is plugged" |
| 1659 | */ |
| 1660 | if (!(ass & 0x8000)) |
| 1661 | return 1; |
| 1662 | /* |
| 1663 | * 10~8 : Jack location |
| 1664 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1665 | * 14~13: Resvered |
| 1666 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1667 | * when the external headphone out jack is plugged" |
| 1668 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1669 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1670 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1671 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1672 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1673 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1674 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1675 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1676 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1677 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1678 | else if (tmp == 3) |
| 1679 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1680 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1681 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1682 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1683 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1684 | return 1; |
| 1685 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1686 | } |
| 1687 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1688 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1689 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1690 | return 1; |
| 1691 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1692 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1693 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1694 | hda_nid_t porta, hda_nid_t porte, |
| 1695 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1696 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1697 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1698 | struct alc_spec *spec = codec->spec; |
| 1699 | snd_printd("realtek: " |
| 1700 | "Enable default setup for auto mode as fallback\n"); |
| 1701 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1702 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1703 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1704 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1705 | } |
| 1706 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1707 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1708 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1709 | */ |
| 1710 | |
| 1711 | struct alc_pincfg { |
| 1712 | hda_nid_t nid; |
| 1713 | u32 val; |
| 1714 | }; |
| 1715 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1716 | struct alc_model_fixup { |
| 1717 | const int id; |
| 1718 | const char *name; |
| 1719 | }; |
| 1720 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1721 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1722 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1723 | bool chained; |
| 1724 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1725 | union { |
| 1726 | unsigned int sku; |
| 1727 | const struct alc_pincfg *pins; |
| 1728 | const struct hda_verb *verbs; |
| 1729 | void (*func)(struct hda_codec *codec, |
| 1730 | const struct alc_fixup *fix, |
| 1731 | int action); |
| 1732 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1733 | }; |
| 1734 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1735 | enum { |
| 1736 | ALC_FIXUP_INVALID, |
| 1737 | ALC_FIXUP_SKU, |
| 1738 | ALC_FIXUP_PINS, |
| 1739 | ALC_FIXUP_VERBS, |
| 1740 | ALC_FIXUP_FUNC, |
| 1741 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1742 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1743 | enum { |
| 1744 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1745 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1746 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1747 | }; |
| 1748 | |
| 1749 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1750 | { |
| 1751 | struct alc_spec *spec = codec->spec; |
| 1752 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1753 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1754 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1755 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1756 | int depth = 0; |
| 1757 | |
| 1758 | if (!spec->fixup_list) |
| 1759 | return; |
| 1760 | |
| 1761 | while (id >= 0) { |
| 1762 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1763 | const struct alc_pincfg *cfg; |
| 1764 | |
| 1765 | switch (fix->type) { |
| 1766 | case ALC_FIXUP_SKU: |
| 1767 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1768 | break;; |
| 1769 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1770 | "Apply sku override for %s\n", |
| 1771 | codec->chip_name, modelname); |
| 1772 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1773 | spec->cdefine.fixup = 1; |
| 1774 | break; |
| 1775 | case ALC_FIXUP_PINS: |
| 1776 | cfg = fix->v.pins; |
| 1777 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1778 | break; |
| 1779 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1780 | "Apply pincfg for %s\n", |
| 1781 | codec->chip_name, modelname); |
| 1782 | for (; cfg->nid; cfg++) |
| 1783 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1784 | cfg->val); |
| 1785 | break; |
| 1786 | case ALC_FIXUP_VERBS: |
| 1787 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1788 | break; |
| 1789 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1790 | "Apply fix-verbs for %s\n", |
| 1791 | codec->chip_name, modelname); |
| 1792 | add_verb(codec->spec, fix->v.verbs); |
| 1793 | break; |
| 1794 | case ALC_FIXUP_FUNC: |
| 1795 | if (!fix->v.func) |
| 1796 | break; |
| 1797 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1798 | "Apply fix-func for %s\n", |
| 1799 | codec->chip_name, modelname); |
| 1800 | fix->v.func(codec, fix, action); |
| 1801 | break; |
| 1802 | default: |
| 1803 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1804 | "Invalid fixup type %d\n", |
| 1805 | codec->chip_name, fix->type); |
| 1806 | break; |
| 1807 | } |
| 1808 | if (!fix[id].chained) |
| 1809 | break; |
| 1810 | if (++depth > 10) |
| 1811 | break; |
| 1812 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1813 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1814 | } |
| 1815 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1816 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1817 | const struct alc_model_fixup *models, |
| 1818 | const struct snd_pci_quirk *quirk, |
| 1819 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1820 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1821 | struct alc_spec *spec = codec->spec; |
| 1822 | int id = -1; |
| 1823 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1824 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1825 | if (codec->modelname && models) { |
| 1826 | while (models->name) { |
| 1827 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1828 | id = models->id; |
| 1829 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1830 | break; |
| 1831 | } |
| 1832 | models++; |
| 1833 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1834 | } |
| 1835 | if (id < 0) { |
| 1836 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1837 | if (quirk) { |
| 1838 | id = quirk->value; |
| 1839 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1840 | name = quirk->name; |
| 1841 | #endif |
| 1842 | } |
| 1843 | } |
| 1844 | |
| 1845 | spec->fixup_id = id; |
| 1846 | if (id >= 0) { |
| 1847 | spec->fixup_list = fixlist; |
| 1848 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1849 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1850 | } |
| 1851 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1852 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1853 | unsigned int coef_idx) |
| 1854 | { |
| 1855 | unsigned int val; |
| 1856 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1857 | coef_idx); |
| 1858 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1859 | AC_VERB_GET_PROC_COEF, 0); |
| 1860 | return val; |
| 1861 | } |
| 1862 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1863 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1864 | unsigned int coef_val) |
| 1865 | { |
| 1866 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1867 | coef_idx); |
| 1868 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1869 | coef_val); |
| 1870 | } |
| 1871 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1872 | /* set right pin controls for digital I/O */ |
| 1873 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1874 | { |
| 1875 | struct alc_spec *spec = codec->spec; |
| 1876 | int i; |
| 1877 | hda_nid_t pin; |
| 1878 | |
| 1879 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1880 | pin = spec->autocfg.dig_out_pins[i]; |
| 1881 | if (pin) { |
| 1882 | snd_hda_codec_write(codec, pin, 0, |
| 1883 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1884 | PIN_OUT); |
| 1885 | } |
| 1886 | } |
| 1887 | pin = spec->autocfg.dig_in_pin; |
| 1888 | if (pin) |
| 1889 | snd_hda_codec_write(codec, pin, 0, |
| 1890 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1891 | PIN_IN); |
| 1892 | } |
| 1893 | |
| 1894 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1895 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1896 | { |
| 1897 | struct alc_spec *spec = codec->spec; |
| 1898 | int i, err; |
| 1899 | hda_nid_t dig_nid; |
| 1900 | |
| 1901 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1902 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1903 | err = snd_hda_get_connections(codec, |
| 1904 | spec->autocfg.dig_out_pins[i], |
| 1905 | &dig_nid, 1); |
| 1906 | if (err < 0) |
| 1907 | continue; |
| 1908 | if (!i) { |
| 1909 | spec->multiout.dig_out_nid = dig_nid; |
| 1910 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1911 | } else { |
| 1912 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1913 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1914 | break; |
| 1915 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1916 | } |
| 1917 | } |
| 1918 | |
| 1919 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1920 | dig_nid = codec->start_nid; |
| 1921 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1922 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1923 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1924 | continue; |
| 1925 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1926 | continue; |
| 1927 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1928 | continue; |
| 1929 | err = get_connection_index(codec, dig_nid, |
| 1930 | spec->autocfg.dig_in_pin); |
| 1931 | if (err >= 0) { |
| 1932 | spec->dig_in_nid = dig_nid; |
| 1933 | break; |
| 1934 | } |
| 1935 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1936 | } |
| 1937 | } |
| 1938 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1939 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1940 | * ALC888 |
| 1941 | */ |
| 1942 | |
| 1943 | /* |
| 1944 | * 2ch mode |
| 1945 | */ |
| 1946 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1947 | /* Mic-in jack as mic in */ |
| 1948 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1949 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1950 | /* Line-in jack as Line in */ |
| 1951 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1952 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1953 | /* Line-Out as Front */ |
| 1954 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1955 | { } /* end */ |
| 1956 | }; |
| 1957 | |
| 1958 | /* |
| 1959 | * 4ch mode |
| 1960 | */ |
| 1961 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1962 | /* Mic-in jack as mic in */ |
| 1963 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1964 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1965 | /* Line-in jack as Surround */ |
| 1966 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1967 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1968 | /* Line-Out as Front */ |
| 1969 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1970 | { } /* end */ |
| 1971 | }; |
| 1972 | |
| 1973 | /* |
| 1974 | * 6ch mode |
| 1975 | */ |
| 1976 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1977 | /* Mic-in jack as CLFE */ |
| 1978 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1979 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1980 | /* Line-in jack as Surround */ |
| 1981 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1982 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1983 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1984 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1985 | { } /* end */ |
| 1986 | }; |
| 1987 | |
| 1988 | /* |
| 1989 | * 8ch mode |
| 1990 | */ |
| 1991 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1992 | /* Mic-in jack as CLFE */ |
| 1993 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1994 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1995 | /* Line-in jack as Surround */ |
| 1996 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1997 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1998 | /* Line-Out as Side */ |
| 1999 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2000 | { } /* end */ |
| 2001 | }; |
| 2002 | |
| 2003 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 2004 | { 2, alc888_4ST_ch2_intel_init }, |
| 2005 | { 4, alc888_4ST_ch4_intel_init }, |
| 2006 | { 6, alc888_4ST_ch6_intel_init }, |
| 2007 | { 8, alc888_4ST_ch8_intel_init }, |
| 2008 | }; |
| 2009 | |
| 2010 | /* |
| 2011 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 2012 | */ |
| 2013 | |
| 2014 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 2015 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2016 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2017 | /* Connect Internal HP to Front */ |
| 2018 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2019 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2020 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2021 | /* Connect Bass HP to Front */ |
| 2022 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2023 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2024 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2025 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 2026 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2027 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2028 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2029 | /* Connect Mic jack to CLFE */ |
| 2030 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2031 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2032 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2033 | /* Connect Line-in jack to Surround */ |
| 2034 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2035 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2036 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2037 | /* Connect HP out jack to Front */ |
| 2038 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2039 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2040 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2041 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2042 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2043 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2044 | {} |
| 2045 | }; |
| 2046 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2047 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2048 | { |
| 2049 | struct alc_spec *spec = codec->spec; |
| 2050 | |
| 2051 | spec->autocfg.hp_pins[0] = 0x15; |
| 2052 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2053 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2054 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2055 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2056 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2057 | spec->automute = 1; |
| 2058 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2059 | } |
| 2060 | |
| 2061 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2062 | { |
| 2063 | alc889_coef_init(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2064 | alc_hp_automute(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2065 | } |
| 2066 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2067 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2068 | { |
| 2069 | struct alc_spec *spec = codec->spec; |
| 2070 | |
| 2071 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2072 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2073 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2074 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2075 | spec->automute = 1; |
| 2076 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2077 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2078 | |
| 2079 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2080 | * ALC888 Acer Aspire 4930G model |
| 2081 | */ |
| 2082 | |
| 2083 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2084 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2085 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2086 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2088 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2089 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2090 | /* Connect Internal HP to front */ |
| 2091 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2092 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2093 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2094 | /* Connect HP out to front */ |
| 2095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2096 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2097 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2098 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2099 | { } |
| 2100 | }; |
| 2101 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2102 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2103 | * ALC888 Acer Aspire 6530G model |
| 2104 | */ |
| 2105 | |
| 2106 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2107 | /* Route to built-in subwoofer as well as speakers */ |
| 2108 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2109 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2110 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2111 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2112 | /* Bias voltage on for external mic port */ |
| 2113 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2114 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2115 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2116 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2118 | /* Enable unsolicited event for HP jack */ |
| 2119 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2120 | /* Enable speaker output */ |
| 2121 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2122 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2123 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2124 | /* Enable headphone output */ |
| 2125 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2126 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2127 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2128 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2129 | { } |
| 2130 | }; |
| 2131 | |
| 2132 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2133 | *ALC888 Acer Aspire 7730G model |
| 2134 | */ |
| 2135 | |
| 2136 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2137 | /* Bias voltage on for external mic port */ |
| 2138 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2139 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2140 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2141 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2142 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2143 | /* Enable unsolicited event for HP jack */ |
| 2144 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2145 | /* Enable speaker output */ |
| 2146 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2147 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2148 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2149 | /* Enable headphone output */ |
| 2150 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2151 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2152 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2153 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2154 | /*Enable internal subwoofer */ |
| 2155 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2156 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2157 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2158 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2159 | { } |
| 2160 | }; |
| 2161 | |
| 2162 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2163 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2164 | */ |
| 2165 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2166 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2167 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2168 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2169 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2170 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2171 | /* Enable unsolicited event for HP jack */ |
| 2172 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2173 | /* Connect Internal Front to Front */ |
| 2174 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2175 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2176 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2177 | /* Connect Internal Rear to Rear */ |
| 2178 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2179 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2180 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2181 | /* Connect Internal CLFE to CLFE */ |
| 2182 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2183 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2184 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2185 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2186 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2188 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2189 | /* Enable all DACs */ |
| 2190 | /* DAC DISABLE/MUTE 1? */ |
| 2191 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2192 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2193 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2194 | /* DAC DISABLE/MUTE 2? */ |
| 2195 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2196 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2197 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2198 | /* DMIC fix |
| 2199 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2200 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2201 | * makes the signal become a difference/sum signal instead of standard |
| 2202 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2203 | * codec replicate the sum signal to both channels, turning it into a |
| 2204 | * normal mono mic. |
| 2205 | */ |
| 2206 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2207 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2208 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2209 | { } |
| 2210 | }; |
| 2211 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2212 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2213 | /* Front mic only available on one ADC */ |
| 2214 | { |
| 2215 | .num_items = 4, |
| 2216 | .items = { |
| 2217 | { "Mic", 0x0 }, |
| 2218 | { "Line", 0x2 }, |
| 2219 | { "CD", 0x4 }, |
| 2220 | { "Front Mic", 0xb }, |
| 2221 | }, |
| 2222 | }, |
| 2223 | { |
| 2224 | .num_items = 3, |
| 2225 | .items = { |
| 2226 | { "Mic", 0x0 }, |
| 2227 | { "Line", 0x2 }, |
| 2228 | { "CD", 0x4 }, |
| 2229 | }, |
| 2230 | } |
| 2231 | }; |
| 2232 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2233 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2234 | /* Interal mic only available on one ADC */ |
| 2235 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2236 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2237 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2238 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2239 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2240 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2241 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2242 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2243 | }, |
| 2244 | }, |
| 2245 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2246 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2247 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2248 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2249 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2250 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2251 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2252 | }, |
| 2253 | } |
| 2254 | }; |
| 2255 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2256 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2257 | /* Digital mic only available on first "ADC" */ |
| 2258 | { |
| 2259 | .num_items = 5, |
| 2260 | .items = { |
| 2261 | { "Mic", 0x0 }, |
| 2262 | { "Line", 0x2 }, |
| 2263 | { "CD", 0x4 }, |
| 2264 | { "Front Mic", 0xb }, |
| 2265 | { "Input Mix", 0xa }, |
| 2266 | }, |
| 2267 | }, |
| 2268 | { |
| 2269 | .num_items = 4, |
| 2270 | .items = { |
| 2271 | { "Mic", 0x0 }, |
| 2272 | { "Line", 0x2 }, |
| 2273 | { "CD", 0x4 }, |
| 2274 | { "Input Mix", 0xa }, |
| 2275 | }, |
| 2276 | }, |
| 2277 | { |
| 2278 | .num_items = 4, |
| 2279 | .items = { |
| 2280 | { "Mic", 0x0 }, |
| 2281 | { "Line", 0x2 }, |
| 2282 | { "CD", 0x4 }, |
| 2283 | { "Input Mix", 0xa }, |
| 2284 | }, |
| 2285 | } |
| 2286 | }; |
| 2287 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2288 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2289 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2290 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2291 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2292 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2293 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2294 | HDA_OUTPUT), |
| 2295 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2296 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2297 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2298 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2299 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2300 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2301 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2302 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2303 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2305 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2306 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2307 | { } /* end */ |
| 2308 | }; |
| 2309 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2310 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2311 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2312 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2313 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2314 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2315 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2316 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2317 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2318 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2319 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2320 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2321 | 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] | 2322 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2323 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2324 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2325 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2326 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2327 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2328 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2329 | { } /* end */ |
| 2330 | }; |
| 2331 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2332 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2333 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2334 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2335 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2336 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2337 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2338 | HDA_OUTPUT), |
| 2339 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2340 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2341 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2342 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2343 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2344 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2345 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2346 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2347 | { } /* end */ |
| 2348 | }; |
| 2349 | |
| 2350 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2351 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2352 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2353 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2354 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2355 | spec->autocfg.hp_pins[0] = 0x15; |
| 2356 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2357 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2358 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2359 | spec->automute = 1; |
| 2360 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2361 | } |
| 2362 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2363 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2364 | { |
| 2365 | struct alc_spec *spec = codec->spec; |
| 2366 | |
| 2367 | spec->autocfg.hp_pins[0] = 0x15; |
| 2368 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2369 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2370 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2371 | spec->automute = 1; |
| 2372 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2373 | } |
| 2374 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2375 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2376 | { |
| 2377 | struct alc_spec *spec = codec->spec; |
| 2378 | |
| 2379 | spec->autocfg.hp_pins[0] = 0x15; |
| 2380 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2381 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2382 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2383 | spec->automute = 1; |
| 2384 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2385 | } |
| 2386 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2387 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2388 | { |
| 2389 | struct alc_spec *spec = codec->spec; |
| 2390 | |
| 2391 | spec->autocfg.hp_pins[0] = 0x15; |
| 2392 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2393 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2394 | spec->autocfg.speaker_pins[2] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2395 | spec->automute = 1; |
| 2396 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2397 | } |
| 2398 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2399 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2400 | * ALC880 3-stack model |
| 2401 | * |
| 2402 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2403 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2404 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2405 | */ |
| 2406 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2407 | static hda_nid_t alc880_dac_nids[4] = { |
| 2408 | /* front, rear, clfe, rear_surr */ |
| 2409 | 0x02, 0x05, 0x04, 0x03 |
| 2410 | }; |
| 2411 | |
| 2412 | static hda_nid_t alc880_adc_nids[3] = { |
| 2413 | /* ADC0-2 */ |
| 2414 | 0x07, 0x08, 0x09, |
| 2415 | }; |
| 2416 | |
| 2417 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2418 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2419 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2420 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2421 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2422 | /* ADC1-2 */ |
| 2423 | 0x08, 0x09, |
| 2424 | }; |
| 2425 | |
| 2426 | #define ALC880_DIGOUT_NID 0x06 |
| 2427 | #define ALC880_DIGIN_NID 0x0a |
| 2428 | |
| 2429 | static struct hda_input_mux alc880_capture_source = { |
| 2430 | .num_items = 4, |
| 2431 | .items = { |
| 2432 | { "Mic", 0x0 }, |
| 2433 | { "Front Mic", 0x3 }, |
| 2434 | { "Line", 0x2 }, |
| 2435 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2436 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2437 | }; |
| 2438 | |
| 2439 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2440 | /* 2ch mode */ |
| 2441 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2442 | /* set line-in to input, mute it */ |
| 2443 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2444 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2445 | /* set mic-in to input vref 80%, mute it */ |
| 2446 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2447 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2448 | { } /* end */ |
| 2449 | }; |
| 2450 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2451 | /* 6ch mode */ |
| 2452 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2453 | /* set line-in to output, unmute it */ |
| 2454 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2455 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2456 | /* set mic-in to output, unmute it */ |
| 2457 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2458 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2459 | { } /* end */ |
| 2460 | }; |
| 2461 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2462 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2463 | { 2, alc880_threestack_ch2_init }, |
| 2464 | { 6, alc880_threestack_ch6_init }, |
| 2465 | }; |
| 2466 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2467 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2468 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2469 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2470 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2471 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2472 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2473 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2474 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2475 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2476 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2477 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2478 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2479 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2480 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2481 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2482 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2483 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2485 | { |
| 2486 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2487 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2488 | .info = alc_ch_mode_info, |
| 2489 | .get = alc_ch_mode_get, |
| 2490 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2491 | }, |
| 2492 | { } /* end */ |
| 2493 | }; |
| 2494 | |
| 2495 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2496 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2497 | struct snd_ctl_elem_info *uinfo) |
| 2498 | { |
| 2499 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2500 | struct alc_spec *spec = codec->spec; |
| 2501 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2502 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2503 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2504 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2505 | HDA_INPUT); |
| 2506 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2507 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2508 | return err; |
| 2509 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2510 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2511 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2512 | unsigned int size, unsigned int __user *tlv) |
| 2513 | { |
| 2514 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2515 | struct alc_spec *spec = codec->spec; |
| 2516 | int err; |
| 2517 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2518 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2519 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2520 | HDA_INPUT); |
| 2521 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2522 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2523 | return err; |
| 2524 | } |
| 2525 | |
| 2526 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2527 | struct snd_ctl_elem_value *ucontrol); |
| 2528 | |
| 2529 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2530 | struct snd_ctl_elem_value *ucontrol, |
| 2531 | getput_call_t func) |
| 2532 | { |
| 2533 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2534 | struct alc_spec *spec = codec->spec; |
| 2535 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2536 | int err; |
| 2537 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2538 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2539 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2540 | 3, 0, HDA_INPUT); |
| 2541 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2542 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2543 | return err; |
| 2544 | } |
| 2545 | |
| 2546 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2547 | struct snd_ctl_elem_value *ucontrol) |
| 2548 | { |
| 2549 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2550 | snd_hda_mixer_amp_volume_get); |
| 2551 | } |
| 2552 | |
| 2553 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2554 | struct snd_ctl_elem_value *ucontrol) |
| 2555 | { |
| 2556 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2557 | snd_hda_mixer_amp_volume_put); |
| 2558 | } |
| 2559 | |
| 2560 | /* capture mixer elements */ |
| 2561 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2562 | |
| 2563 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2564 | struct snd_ctl_elem_value *ucontrol) |
| 2565 | { |
| 2566 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2567 | snd_hda_mixer_amp_switch_get); |
| 2568 | } |
| 2569 | |
| 2570 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2571 | struct snd_ctl_elem_value *ucontrol) |
| 2572 | { |
| 2573 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2574 | snd_hda_mixer_amp_switch_put); |
| 2575 | } |
| 2576 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2577 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2578 | { \ |
| 2579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2580 | .name = "Capture Switch", \ |
| 2581 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2582 | .count = num, \ |
| 2583 | .info = alc_cap_sw_info, \ |
| 2584 | .get = alc_cap_sw_get, \ |
| 2585 | .put = alc_cap_sw_put, \ |
| 2586 | }, \ |
| 2587 | { \ |
| 2588 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2589 | .name = "Capture Volume", \ |
| 2590 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2591 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2592 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2593 | .count = num, \ |
| 2594 | .info = alc_cap_vol_info, \ |
| 2595 | .get = alc_cap_vol_get, \ |
| 2596 | .put = alc_cap_vol_put, \ |
| 2597 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2598 | } |
| 2599 | |
| 2600 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2601 | { \ |
| 2602 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2603 | /* .name = "Capture Source", */ \ |
| 2604 | .name = "Input Source", \ |
| 2605 | .count = num, \ |
| 2606 | .info = alc_mux_enum_info, \ |
| 2607 | .get = alc_mux_enum_get, \ |
| 2608 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2609 | } |
| 2610 | |
| 2611 | #define DEFINE_CAPMIX(num) \ |
| 2612 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2613 | _DEFINE_CAPMIX(num), \ |
| 2614 | _DEFINE_CAPSRC(num), \ |
| 2615 | { } /* end */ \ |
| 2616 | } |
| 2617 | |
| 2618 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2619 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2620 | _DEFINE_CAPMIX(num), \ |
| 2621 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2622 | } |
| 2623 | |
| 2624 | /* up to three ADCs */ |
| 2625 | DEFINE_CAPMIX(1); |
| 2626 | DEFINE_CAPMIX(2); |
| 2627 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2628 | DEFINE_CAPMIX_NOSRC(1); |
| 2629 | DEFINE_CAPMIX_NOSRC(2); |
| 2630 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2631 | |
| 2632 | /* |
| 2633 | * ALC880 5-stack model |
| 2634 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2635 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2636 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2637 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2638 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2639 | */ |
| 2640 | |
| 2641 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2642 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2643 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2644 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2645 | { } /* end */ |
| 2646 | }; |
| 2647 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2648 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2649 | /* 6ch mode */ |
| 2650 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2651 | /* set line-in to input, mute it */ |
| 2652 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2653 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2654 | { } /* end */ |
| 2655 | }; |
| 2656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2657 | /* 8ch mode */ |
| 2658 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2659 | /* set line-in to output, unmute it */ |
| 2660 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2661 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2662 | { } /* end */ |
| 2663 | }; |
| 2664 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2665 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2666 | { 6, alc880_fivestack_ch6_init }, |
| 2667 | { 8, alc880_fivestack_ch8_init }, |
| 2668 | }; |
| 2669 | |
| 2670 | |
| 2671 | /* |
| 2672 | * ALC880 6-stack model |
| 2673 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2674 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2675 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2676 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2677 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2678 | */ |
| 2679 | |
| 2680 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2681 | /* front, rear, clfe, rear_surr */ |
| 2682 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2683 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2684 | |
| 2685 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2686 | .num_items = 4, |
| 2687 | .items = { |
| 2688 | { "Mic", 0x0 }, |
| 2689 | { "Front Mic", 0x1 }, |
| 2690 | { "Line", 0x2 }, |
| 2691 | { "CD", 0x4 }, |
| 2692 | }, |
| 2693 | }; |
| 2694 | |
| 2695 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2696 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2697 | { 8, NULL }, |
| 2698 | }; |
| 2699 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2700 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2701 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2702 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2703 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2704 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2705 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2706 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2707 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2708 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2709 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2710 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2711 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2712 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2713 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2714 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2715 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2716 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2717 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2718 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2719 | { |
| 2720 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2721 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2722 | .info = alc_ch_mode_info, |
| 2723 | .get = alc_ch_mode_get, |
| 2724 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2725 | }, |
| 2726 | { } /* end */ |
| 2727 | }; |
| 2728 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2729 | |
| 2730 | /* |
| 2731 | * ALC880 W810 model |
| 2732 | * |
| 2733 | * W810 has rear IO for: |
| 2734 | * Front (DAC 02) |
| 2735 | * Surround (DAC 03) |
| 2736 | * Center/LFE (DAC 04) |
| 2737 | * Digital out (06) |
| 2738 | * |
| 2739 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2740 | * 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] | 2741 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2742 | * There is a variable resistor to control the speaker or headphone |
| 2743 | * volume. This is a hardware-only device without a software API. |
| 2744 | * |
| 2745 | * Plugging headphones in will disable the internal speakers. This is |
| 2746 | * implemented in hardware, not via the driver using jack sense. In |
| 2747 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2748 | * disable both the speakers and headphones. |
| 2749 | * |
| 2750 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2751 | * These may not do anything useful with this driver yet, because I |
| 2752 | * haven't setup any initialization verbs for these yet... |
| 2753 | */ |
| 2754 | |
| 2755 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2756 | /* front, rear/surround, clfe */ |
| 2757 | 0x02, 0x03, 0x04 |
| 2758 | }; |
| 2759 | |
| 2760 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2761 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2762 | { 6, NULL } |
| 2763 | }; |
| 2764 | |
| 2765 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2766 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2767 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2768 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2769 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2770 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2771 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2772 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2773 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2774 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2775 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2776 | { } /* end */ |
| 2777 | }; |
| 2778 | |
| 2779 | |
| 2780 | /* |
| 2781 | * Z710V model |
| 2782 | * |
| 2783 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2784 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2785 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2786 | */ |
| 2787 | |
| 2788 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2789 | 0x02 |
| 2790 | }; |
| 2791 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2792 | |
| 2793 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2794 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2795 | { 2, NULL } |
| 2796 | }; |
| 2797 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2798 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2799 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2800 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2801 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2802 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2803 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2804 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2807 | { } /* end */ |
| 2808 | }; |
| 2809 | |
| 2810 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2811 | /* |
| 2812 | * ALC880 F1734 model |
| 2813 | * |
| 2814 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2815 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2816 | */ |
| 2817 | |
| 2818 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2819 | 0x03 |
| 2820 | }; |
| 2821 | #define ALC880_F1734_HP_DAC 0x02 |
| 2822 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2823 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2824 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2825 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2826 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2827 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2828 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2829 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2830 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2831 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2832 | { } /* end */ |
| 2833 | }; |
| 2834 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2835 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2836 | .num_items = 2, |
| 2837 | .items = { |
| 2838 | { "Mic", 0x1 }, |
| 2839 | { "CD", 0x4 }, |
| 2840 | }, |
| 2841 | }; |
| 2842 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2843 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2844 | /* |
| 2845 | * ALC880 ASUS model |
| 2846 | * |
| 2847 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2848 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2849 | * Mic = 0x18, Line = 0x1a |
| 2850 | */ |
| 2851 | |
| 2852 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2853 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2854 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2855 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2856 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2857 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2858 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2859 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2860 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2861 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2862 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2863 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2864 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2865 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2866 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2867 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2868 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2869 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2870 | { |
| 2871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2872 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2873 | .info = alc_ch_mode_info, |
| 2874 | .get = alc_ch_mode_get, |
| 2875 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2876 | }, |
| 2877 | { } /* end */ |
| 2878 | }; |
| 2879 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2880 | /* |
| 2881 | * ALC880 ASUS W1V model |
| 2882 | * |
| 2883 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2884 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2885 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2886 | */ |
| 2887 | |
| 2888 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2889 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2890 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2891 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2892 | { } /* end */ |
| 2893 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2894 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2895 | /* TCL S700 */ |
| 2896 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2897 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2898 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2899 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2900 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2901 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2904 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2905 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2906 | { } /* end */ |
| 2907 | }; |
| 2908 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2909 | /* Uniwill */ |
| 2910 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2911 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2912 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2913 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2914 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2915 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2916 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2917 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2918 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2919 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2920 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2921 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2922 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2924 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2925 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2926 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2927 | { |
| 2928 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2929 | .name = "Channel Mode", |
| 2930 | .info = alc_ch_mode_info, |
| 2931 | .get = alc_ch_mode_get, |
| 2932 | .put = alc_ch_mode_put, |
| 2933 | }, |
| 2934 | { } /* end */ |
| 2935 | }; |
| 2936 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2937 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2938 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2939 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2940 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2941 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2942 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2943 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2946 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2947 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2948 | { } /* end */ |
| 2949 | }; |
| 2950 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2951 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2952 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2953 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2954 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2955 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2958 | { } /* end */ |
| 2959 | }; |
| 2960 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2961 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2962 | * virtual master controls |
| 2963 | */ |
| 2964 | |
| 2965 | /* |
| 2966 | * slave controls for virtual master |
| 2967 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2968 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2969 | "Front Playback Volume", |
| 2970 | "Surround Playback Volume", |
| 2971 | "Center Playback Volume", |
| 2972 | "LFE Playback Volume", |
| 2973 | "Side Playback Volume", |
| 2974 | "Headphone Playback Volume", |
| 2975 | "Speaker Playback Volume", |
| 2976 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2977 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2978 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2979 | NULL, |
| 2980 | }; |
| 2981 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2982 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2983 | "Front Playback Switch", |
| 2984 | "Surround Playback Switch", |
| 2985 | "Center Playback Switch", |
| 2986 | "LFE Playback Switch", |
| 2987 | "Side Playback Switch", |
| 2988 | "Headphone Playback Switch", |
| 2989 | "Speaker Playback Switch", |
| 2990 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2991 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2992 | "Line-Out Playback Switch", |
| 2993 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2994 | NULL, |
| 2995 | }; |
| 2996 | |
| 2997 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2998 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2999 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3000 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3001 | #define NID_MAPPING (-1) |
| 3002 | |
| 3003 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 3004 | #define SUBDEV_HP_ (1 << 6) |
| 3005 | #define SUBDEV_LINE_ (2 << 6) |
| 3006 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 3007 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 3008 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 3009 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3010 | static void alc_free_kctls(struct hda_codec *codec); |
| 3011 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3012 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3013 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 3014 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 3015 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3016 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3017 | { } /* end */ |
| 3018 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3019 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3020 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3021 | static int alc_build_controls(struct hda_codec *codec) |
| 3022 | { |
| 3023 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 3024 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3025 | struct snd_kcontrol_new *knew; |
| 3026 | int i, j, err; |
| 3027 | unsigned int u; |
| 3028 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3029 | |
| 3030 | for (i = 0; i < spec->num_mixers; i++) { |
| 3031 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3032 | if (err < 0) |
| 3033 | return err; |
| 3034 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3035 | if (spec->cap_mixer) { |
| 3036 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3037 | if (err < 0) |
| 3038 | return err; |
| 3039 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3040 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3041 | err = snd_hda_create_spdif_out_ctls(codec, |
| 3042 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3043 | if (err < 0) |
| 3044 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3045 | if (!spec->no_analog) { |
| 3046 | err = snd_hda_create_spdif_share_sw(codec, |
| 3047 | &spec->multiout); |
| 3048 | if (err < 0) |
| 3049 | return err; |
| 3050 | spec->multiout.share_spdif = 1; |
| 3051 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3052 | } |
| 3053 | if (spec->dig_in_nid) { |
| 3054 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3055 | if (err < 0) |
| 3056 | return err; |
| 3057 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3058 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3059 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3060 | /* create beep controls if needed */ |
| 3061 | if (spec->beep_amp) { |
| 3062 | struct snd_kcontrol_new *knew; |
| 3063 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3064 | struct snd_kcontrol *kctl; |
| 3065 | kctl = snd_ctl_new1(knew, codec); |
| 3066 | if (!kctl) |
| 3067 | return -ENOMEM; |
| 3068 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3069 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3070 | if (err < 0) |
| 3071 | return err; |
| 3072 | } |
| 3073 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3074 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3075 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3076 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3077 | if (!spec->no_analog && |
| 3078 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3079 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3080 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3081 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3082 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3083 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3084 | if (err < 0) |
| 3085 | return err; |
| 3086 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3087 | if (!spec->no_analog && |
| 3088 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3089 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3090 | NULL, alc_slave_sws); |
| 3091 | if (err < 0) |
| 3092 | return err; |
| 3093 | } |
| 3094 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3095 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3096 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3097 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3098 | if (!kctl) |
| 3099 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3100 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3101 | hda_nid_t *nids = spec->capsrc_nids; |
| 3102 | if (!nids) |
| 3103 | nids = spec->adc_nids; |
| 3104 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3105 | if (err < 0) |
| 3106 | return err; |
| 3107 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3108 | } |
| 3109 | if (spec->cap_mixer) { |
| 3110 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3111 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3112 | if (kname && strcmp(knew->name, kname) == 0) |
| 3113 | continue; |
| 3114 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3115 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3116 | err = snd_hda_add_nid(codec, kctl, i, |
| 3117 | spec->adc_nids[i]); |
| 3118 | if (err < 0) |
| 3119 | return err; |
| 3120 | } |
| 3121 | } |
| 3122 | } |
| 3123 | |
| 3124 | /* other nid->control mapping */ |
| 3125 | for (i = 0; i < spec->num_mixers; i++) { |
| 3126 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3127 | if (knew->iface != NID_MAPPING) |
| 3128 | continue; |
| 3129 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3130 | if (kctl == NULL) |
| 3131 | continue; |
| 3132 | u = knew->subdevice; |
| 3133 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3134 | nid = u & 0x3f; |
| 3135 | if (nid == 0) |
| 3136 | continue; |
| 3137 | switch (u & 0xc0) { |
| 3138 | case SUBDEV_SPEAKER_: |
| 3139 | nid = spec->autocfg.speaker_pins[nid]; |
| 3140 | break; |
| 3141 | case SUBDEV_LINE_: |
| 3142 | nid = spec->autocfg.line_out_pins[nid]; |
| 3143 | break; |
| 3144 | case SUBDEV_HP_: |
| 3145 | nid = spec->autocfg.hp_pins[nid]; |
| 3146 | break; |
| 3147 | default: |
| 3148 | continue; |
| 3149 | } |
| 3150 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3151 | if (err < 0) |
| 3152 | return err; |
| 3153 | } |
| 3154 | u = knew->private_value; |
| 3155 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3156 | nid = u & 0xff; |
| 3157 | if (nid == 0) |
| 3158 | continue; |
| 3159 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3160 | if (err < 0) |
| 3161 | return err; |
| 3162 | } |
| 3163 | } |
| 3164 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3165 | |
| 3166 | alc_free_kctls(codec); /* no longer needed */ |
| 3167 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3168 | return 0; |
| 3169 | } |
| 3170 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3171 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3172 | /* |
| 3173 | * initialize the codec volumes, etc |
| 3174 | */ |
| 3175 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3176 | /* |
| 3177 | * generic initialization of ADC, input mixers and output mixers |
| 3178 | */ |
| 3179 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3180 | /* |
| 3181 | * Unmute ADC0-2 and set the default input to mic-in |
| 3182 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3183 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3184 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3185 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3186 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3187 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3188 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3189 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3190 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3191 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3192 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3193 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3194 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3195 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3196 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3197 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3198 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3200 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3203 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3204 | /* |
| 3205 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3206 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3207 | /* set vol=0 to output mixers */ |
| 3208 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3209 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3211 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3212 | /* set up input amps for analog loopback */ |
| 3213 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3214 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3216 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3217 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3218 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3219 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3220 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3221 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3222 | |
| 3223 | { } |
| 3224 | }; |
| 3225 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3226 | /* |
| 3227 | * 3-stack pin configuration: |
| 3228 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3229 | */ |
| 3230 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3231 | /* |
| 3232 | * preset connection lists of input pins |
| 3233 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3234 | */ |
| 3235 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3236 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3237 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3238 | |
| 3239 | /* |
| 3240 | * Set pin mode and muting |
| 3241 | */ |
| 3242 | /* set front pin widgets 0x14 for output */ |
| 3243 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3244 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3245 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3246 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3247 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3248 | /* Mic2 (as headphone out) for HP output */ |
| 3249 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3250 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3251 | /* Line In pin widget for input */ |
| 3252 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3253 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3254 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3255 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3256 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3257 | /* CD pin widget for input */ |
| 3258 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3259 | |
| 3260 | { } |
| 3261 | }; |
| 3262 | |
| 3263 | /* |
| 3264 | * 5-stack pin configuration: |
| 3265 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3266 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3267 | */ |
| 3268 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3269 | /* |
| 3270 | * preset connection lists of input pins |
| 3271 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3272 | */ |
| 3273 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3274 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3275 | |
| 3276 | /* |
| 3277 | * Set pin mode and muting |
| 3278 | */ |
| 3279 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3280 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3281 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3282 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3283 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3284 | /* unmute pins for output (no gain on this amp) */ |
| 3285 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3286 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3287 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3288 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3289 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3290 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3291 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3292 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3293 | /* Mic2 (as headphone out) for HP output */ |
| 3294 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3295 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3296 | /* Line In pin widget for input */ |
| 3297 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3298 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3299 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3300 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3301 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3302 | /* CD pin widget for input */ |
| 3303 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3304 | |
| 3305 | { } |
| 3306 | }; |
| 3307 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3308 | /* |
| 3309 | * W810 pin configuration: |
| 3310 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3311 | */ |
| 3312 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | /* hphone/speaker input selector: front DAC */ |
| 3314 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3315 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3316 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3317 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3318 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3319 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3320 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3321 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3322 | |
| 3323 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3324 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3325 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3326 | { } |
| 3327 | }; |
| 3328 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3329 | /* |
| 3330 | * Z71V pin configuration: |
| 3331 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3332 | */ |
| 3333 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3334 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3335 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3338 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3339 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3340 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3341 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3342 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3343 | |
| 3344 | { } |
| 3345 | }; |
| 3346 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3347 | /* |
| 3348 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3349 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3350 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3351 | */ |
| 3352 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3353 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3354 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3356 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3357 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3358 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3359 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3360 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3361 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3363 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3364 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3365 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3366 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3367 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3368 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3369 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3370 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3371 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3372 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3374 | { } |
| 3375 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3376 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3377 | /* |
| 3378 | * Uniwill pin configuration: |
| 3379 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3380 | * line = 0x1a |
| 3381 | */ |
| 3382 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3383 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3384 | |
| 3385 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3386 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3387 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3388 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3389 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3390 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3391 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3392 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3393 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3395 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3396 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3397 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3399 | |
| 3400 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3401 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3402 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3403 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3404 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3405 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3406 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3407 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3408 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3409 | |
| 3410 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3411 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3412 | |
| 3413 | { } |
| 3414 | }; |
| 3415 | |
| 3416 | /* |
| 3417 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3418 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3419 | */ |
| 3420 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3421 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3422 | |
| 3423 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3424 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3425 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3427 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3428 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3429 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3431 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3432 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3433 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3435 | |
| 3436 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3437 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3438 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3439 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3441 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3442 | |
| 3443 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3444 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3445 | |
| 3446 | { } |
| 3447 | }; |
| 3448 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3449 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3450 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3451 | { } |
| 3452 | }; |
| 3453 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3454 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3455 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3456 | { |
| 3457 | unsigned int present; |
| 3458 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3459 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3460 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3461 | bits = present ? HDA_AMP_MUTE : 0; |
| 3462 | 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] | 3463 | } |
| 3464 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3465 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3466 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3467 | struct alc_spec *spec = codec->spec; |
| 3468 | |
| 3469 | spec->autocfg.hp_pins[0] = 0x14; |
| 3470 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3471 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3472 | spec->automute = 1; |
| 3473 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3474 | } |
| 3475 | |
| 3476 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3477 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3478 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3479 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3480 | } |
| 3481 | |
| 3482 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3483 | unsigned int res) |
| 3484 | { |
| 3485 | /* Looks like the unsol event is incompatible with the standard |
| 3486 | * definition. 4bit tag is placed at 28 bit! |
| 3487 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3488 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3489 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3490 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3491 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3492 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3493 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3494 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3495 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3496 | } |
| 3497 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3498 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3499 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3500 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3501 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3502 | spec->autocfg.hp_pins[0] = 0x14; |
| 3503 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3504 | spec->automute = 1; |
| 3505 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3506 | } |
| 3507 | |
| 3508 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3509 | { |
| 3510 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3511 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3512 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3513 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3514 | present &= HDA_AMP_VOLMASK; |
| 3515 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3516 | HDA_AMP_VOLMASK, present); |
| 3517 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3518 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3519 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3520 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3521 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3522 | unsigned int res) |
| 3523 | { |
| 3524 | /* Looks like the unsol event is incompatible with the standard |
| 3525 | * definition. 4bit tag is placed at 28 bit! |
| 3526 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3527 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3528 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3529 | else |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3530 | alc_sku_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3531 | } |
| 3532 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3533 | /* |
| 3534 | * F1734 pin configuration: |
| 3535 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3536 | */ |
| 3537 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3538 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3539 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3540 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3541 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3542 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3543 | |
| 3544 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3545 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3546 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3547 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3548 | |
| 3549 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3550 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3551 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3552 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3553 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3554 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3555 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3556 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3557 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3558 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3559 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3560 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3561 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3562 | { } |
| 3563 | }; |
| 3564 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3565 | /* |
| 3566 | * ASUS pin configuration: |
| 3567 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3568 | */ |
| 3569 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3570 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3571 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3572 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3573 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3574 | |
| 3575 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3577 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3578 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3579 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3580 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3581 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3583 | |
| 3584 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3585 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3586 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3587 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3588 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3589 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3590 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3591 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3592 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3593 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3594 | { } |
| 3595 | }; |
| 3596 | |
| 3597 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3598 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3599 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3600 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3601 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3602 | /* Clevo m520g init */ |
| 3603 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3604 | /* headphone output */ |
| 3605 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3606 | /* line-out */ |
| 3607 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3608 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3609 | /* Line-in */ |
| 3610 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3611 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3612 | /* CD */ |
| 3613 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3614 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3615 | /* Mic1 (rear panel) */ |
| 3616 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3617 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3618 | /* Mic2 (front panel) */ |
| 3619 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3620 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3621 | /* headphone */ |
| 3622 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3623 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3624 | /* change to EAPD mode */ |
| 3625 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3626 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3627 | |
| 3628 | { } |
| 3629 | }; |
| 3630 | |
| 3631 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3632 | /* change to EAPD mode */ |
| 3633 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3634 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3636 | /* Headphone output */ |
| 3637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3638 | /* Front output*/ |
| 3639 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3640 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3641 | |
| 3642 | /* Line In pin widget for input */ |
| 3643 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3644 | /* CD pin widget for input */ |
| 3645 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3646 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3647 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3648 | |
| 3649 | /* change to EAPD mode */ |
| 3650 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3651 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3652 | |
| 3653 | { } |
| 3654 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3655 | |
| 3656 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3657 | * LG m1 express dual |
| 3658 | * |
| 3659 | * Pin assignment: |
| 3660 | * Rear Line-In/Out (blue): 0x14 |
| 3661 | * Build-in Mic-In: 0x15 |
| 3662 | * Speaker-out: 0x17 |
| 3663 | * HP-Out (green): 0x1b |
| 3664 | * Mic-In/Out (red): 0x19 |
| 3665 | * SPDIF-Out: 0x1e |
| 3666 | */ |
| 3667 | |
| 3668 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3669 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3670 | 0x05, 0x02, 0x03 |
| 3671 | }; |
| 3672 | |
| 3673 | /* seems analog CD is not working */ |
| 3674 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3675 | .num_items = 3, |
| 3676 | .items = { |
| 3677 | { "Mic", 0x1 }, |
| 3678 | { "Line", 0x5 }, |
| 3679 | { "Internal Mic", 0x6 }, |
| 3680 | }, |
| 3681 | }; |
| 3682 | |
| 3683 | /* 2,4,6 channel modes */ |
| 3684 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3685 | /* set line-in and mic-in to input */ |
| 3686 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3687 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3688 | { } |
| 3689 | }; |
| 3690 | |
| 3691 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3692 | /* set line-in to out and mic-in to input */ |
| 3693 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3694 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3695 | { } |
| 3696 | }; |
| 3697 | |
| 3698 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3699 | /* set line-in and mic-in to output */ |
| 3700 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3701 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3702 | { } |
| 3703 | }; |
| 3704 | |
| 3705 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3706 | { 2, alc880_lg_ch2_init }, |
| 3707 | { 4, alc880_lg_ch4_init }, |
| 3708 | { 6, alc880_lg_ch6_init }, |
| 3709 | }; |
| 3710 | |
| 3711 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3712 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3713 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3714 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3715 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3716 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3717 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3718 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3719 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3720 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3721 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3722 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3723 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3724 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3725 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3726 | { |
| 3727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3728 | .name = "Channel Mode", |
| 3729 | .info = alc_ch_mode_info, |
| 3730 | .get = alc_ch_mode_get, |
| 3731 | .put = alc_ch_mode_put, |
| 3732 | }, |
| 3733 | { } /* end */ |
| 3734 | }; |
| 3735 | |
| 3736 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3737 | /* set capture source to mic-in */ |
| 3738 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3739 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3740 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3741 | /* mute all amp mixer inputs */ |
| 3742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3745 | /* line-in to input */ |
| 3746 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3747 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3748 | /* built-in mic */ |
| 3749 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3751 | /* speaker-out */ |
| 3752 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3753 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3754 | /* mic-in to input */ |
| 3755 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3756 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3757 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3758 | /* HP-out */ |
| 3759 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3762 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3763 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3764 | { } |
| 3765 | }; |
| 3766 | |
| 3767 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3768 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3769 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3770 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3771 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3772 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3773 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3774 | spec->automute = 1; |
| 3775 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3776 | } |
| 3777 | |
| 3778 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3779 | * LG LW20 |
| 3780 | * |
| 3781 | * Pin assignment: |
| 3782 | * Speaker-out: 0x14 |
| 3783 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3784 | * Built-in Mic-In: 0x19 |
| 3785 | * Line-In: 0x1b |
| 3786 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3787 | * SPDIF-Out: 0x1e |
| 3788 | */ |
| 3789 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3790 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3791 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3792 | .items = { |
| 3793 | { "Mic", 0x0 }, |
| 3794 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3795 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3796 | }, |
| 3797 | }; |
| 3798 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3799 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3800 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3801 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3802 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3803 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3804 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3805 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3806 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3807 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3808 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3809 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3810 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3811 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3814 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3815 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3816 | { |
| 3817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3818 | .name = "Channel Mode", |
| 3819 | .info = alc_ch_mode_info, |
| 3820 | .get = alc_ch_mode_get, |
| 3821 | .put = alc_ch_mode_put, |
| 3822 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3823 | { } /* end */ |
| 3824 | }; |
| 3825 | |
| 3826 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3827 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3828 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3829 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3830 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3831 | /* set capture source to mic-in */ |
| 3832 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3833 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3834 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3836 | /* speaker-out */ |
| 3837 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3838 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3839 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3840 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3841 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3842 | /* mic-in to input */ |
| 3843 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3844 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3845 | /* built-in mic */ |
| 3846 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3847 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3848 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3849 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3850 | { } |
| 3851 | }; |
| 3852 | |
| 3853 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3854 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3855 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3856 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3857 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3858 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3859 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3860 | spec->automute = 1; |
| 3861 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3862 | } |
| 3863 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3864 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3865 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3866 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3869 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3870 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3871 | { } /* end */ |
| 3872 | }; |
| 3873 | |
| 3874 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3875 | .num_items = 2, |
| 3876 | .items = { |
| 3877 | { "Mic", 0x0 }, |
| 3878 | { "Internal Mic", 0x1 }, |
| 3879 | }, |
| 3880 | }; |
| 3881 | |
| 3882 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3883 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3884 | |
| 3885 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3886 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3887 | |
| 3888 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3889 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3890 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3891 | /* Mic2 (as headphone out) for HP output */ |
| 3892 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3893 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3894 | /* Internal Speaker */ |
| 3895 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3896 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3897 | |
| 3898 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3899 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3900 | |
| 3901 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3902 | { } |
| 3903 | }; |
| 3904 | |
| 3905 | /* toggle speaker-output according to the hp-jack state */ |
| 3906 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3907 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3908 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3909 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3910 | /* toggle EAPD */ |
| 3911 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3912 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3913 | else |
| 3914 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3915 | } |
| 3916 | |
| 3917 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3918 | unsigned int res) |
| 3919 | { |
| 3920 | /* Looks like the unsol event is incompatible with the standard |
| 3921 | * definition. 4bit tag is placed at 28 bit! |
| 3922 | */ |
| 3923 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3924 | alc880_medion_rim_automute(codec); |
| 3925 | } |
| 3926 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3927 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3928 | { |
| 3929 | struct alc_spec *spec = codec->spec; |
| 3930 | |
| 3931 | spec->autocfg.hp_pins[0] = 0x14; |
| 3932 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3933 | spec->automute = 1; |
| 3934 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3935 | } |
| 3936 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3937 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3938 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3939 | { 0x0b, HDA_INPUT, 0 }, |
| 3940 | { 0x0b, HDA_INPUT, 1 }, |
| 3941 | { 0x0b, HDA_INPUT, 2 }, |
| 3942 | { 0x0b, HDA_INPUT, 3 }, |
| 3943 | { 0x0b, HDA_INPUT, 4 }, |
| 3944 | { } /* end */ |
| 3945 | }; |
| 3946 | |
| 3947 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3948 | { 0x0b, HDA_INPUT, 1 }, |
| 3949 | { 0x0b, HDA_INPUT, 6 }, |
| 3950 | { 0x0b, HDA_INPUT, 7 }, |
| 3951 | { } /* end */ |
| 3952 | }; |
| 3953 | #endif |
| 3954 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3955 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3956 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3957 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3958 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3959 | static void alc_init_special_input_src(struct hda_codec *codec); |
| 3960 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3961 | static int alc_init(struct hda_codec *codec) |
| 3962 | { |
| 3963 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3964 | unsigned int i; |
| 3965 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3966 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3967 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3968 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3969 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3970 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3971 | alc_init_special_input_src(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3972 | |
| 3973 | if (spec->init_hook) |
| 3974 | spec->init_hook(codec); |
| 3975 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3976 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3977 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3978 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3979 | return 0; |
| 3980 | } |
| 3981 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3982 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3983 | { |
| 3984 | struct alc_spec *spec = codec->spec; |
| 3985 | |
| 3986 | if (spec->unsol_event) |
| 3987 | spec->unsol_event(codec, res); |
| 3988 | } |
| 3989 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3990 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3991 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3992 | { |
| 3993 | struct alc_spec *spec = codec->spec; |
| 3994 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3995 | } |
| 3996 | #endif |
| 3997 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3998 | /* |
| 3999 | * Analog playback callbacks |
| 4000 | */ |
| 4001 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4002 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4003 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4004 | { |
| 4005 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 4006 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 4007 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4008 | } |
| 4009 | |
| 4010 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4011 | struct hda_codec *codec, |
| 4012 | unsigned int stream_tag, |
| 4013 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4014 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4015 | { |
| 4016 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4017 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 4018 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4019 | } |
| 4020 | |
| 4021 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4022 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4023 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4024 | { |
| 4025 | struct alc_spec *spec = codec->spec; |
| 4026 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 4027 | } |
| 4028 | |
| 4029 | /* |
| 4030 | * Digital out |
| 4031 | */ |
| 4032 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4033 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4034 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4035 | { |
| 4036 | struct alc_spec *spec = codec->spec; |
| 4037 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 4038 | } |
| 4039 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4040 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4041 | struct hda_codec *codec, |
| 4042 | unsigned int stream_tag, |
| 4043 | unsigned int format, |
| 4044 | struct snd_pcm_substream *substream) |
| 4045 | { |
| 4046 | struct alc_spec *spec = codec->spec; |
| 4047 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 4048 | stream_tag, format, substream); |
| 4049 | } |
| 4050 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4051 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4052 | struct hda_codec *codec, |
| 4053 | struct snd_pcm_substream *substream) |
| 4054 | { |
| 4055 | struct alc_spec *spec = codec->spec; |
| 4056 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 4057 | } |
| 4058 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4059 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 4060 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4061 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4062 | { |
| 4063 | struct alc_spec *spec = codec->spec; |
| 4064 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4065 | } |
| 4066 | |
| 4067 | /* |
| 4068 | * Analog capture |
| 4069 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4070 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4071 | struct hda_codec *codec, |
| 4072 | unsigned int stream_tag, |
| 4073 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4074 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4075 | { |
| 4076 | struct alc_spec *spec = codec->spec; |
| 4077 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4078 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4079 | stream_tag, 0, format); |
| 4080 | return 0; |
| 4081 | } |
| 4082 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4083 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4084 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4085 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4086 | { |
| 4087 | struct alc_spec *spec = codec->spec; |
| 4088 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4089 | snd_hda_codec_cleanup_stream(codec, |
| 4090 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4091 | return 0; |
| 4092 | } |
| 4093 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4094 | /* analog capture with dynamic dual-adc changes */ |
| 4095 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4096 | struct hda_codec *codec, |
| 4097 | unsigned int stream_tag, |
| 4098 | unsigned int format, |
| 4099 | struct snd_pcm_substream *substream) |
| 4100 | { |
| 4101 | struct alc_spec *spec = codec->spec; |
| 4102 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4103 | spec->cur_adc_stream_tag = stream_tag; |
| 4104 | spec->cur_adc_format = format; |
| 4105 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4106 | return 0; |
| 4107 | } |
| 4108 | |
| 4109 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4110 | struct hda_codec *codec, |
| 4111 | struct snd_pcm_substream *substream) |
| 4112 | { |
| 4113 | struct alc_spec *spec = codec->spec; |
| 4114 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4115 | spec->cur_adc = 0; |
| 4116 | return 0; |
| 4117 | } |
| 4118 | |
| 4119 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4120 | .substreams = 1, |
| 4121 | .channels_min = 2, |
| 4122 | .channels_max = 2, |
| 4123 | .nid = 0, /* fill later */ |
| 4124 | .ops = { |
| 4125 | .prepare = dualmic_capture_pcm_prepare, |
| 4126 | .cleanup = dualmic_capture_pcm_cleanup |
| 4127 | }, |
| 4128 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4129 | |
| 4130 | /* |
| 4131 | */ |
| 4132 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4133 | .substreams = 1, |
| 4134 | .channels_min = 2, |
| 4135 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4136 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4137 | .ops = { |
| 4138 | .open = alc880_playback_pcm_open, |
| 4139 | .prepare = alc880_playback_pcm_prepare, |
| 4140 | .cleanup = alc880_playback_pcm_cleanup |
| 4141 | }, |
| 4142 | }; |
| 4143 | |
| 4144 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4145 | .substreams = 1, |
| 4146 | .channels_min = 2, |
| 4147 | .channels_max = 2, |
| 4148 | /* NID is set in alc_build_pcms */ |
| 4149 | }; |
| 4150 | |
| 4151 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4152 | .substreams = 1, |
| 4153 | .channels_min = 2, |
| 4154 | .channels_max = 2, |
| 4155 | /* NID is set in alc_build_pcms */ |
| 4156 | }; |
| 4157 | |
| 4158 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4159 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4160 | .channels_min = 2, |
| 4161 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4162 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4163 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4164 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4165 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4166 | }, |
| 4167 | }; |
| 4168 | |
| 4169 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4170 | .substreams = 1, |
| 4171 | .channels_min = 2, |
| 4172 | .channels_max = 2, |
| 4173 | /* NID is set in alc_build_pcms */ |
| 4174 | .ops = { |
| 4175 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4176 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4177 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4178 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4179 | }, |
| 4180 | }; |
| 4181 | |
| 4182 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4183 | .substreams = 1, |
| 4184 | .channels_min = 2, |
| 4185 | .channels_max = 2, |
| 4186 | /* NID is set in alc_build_pcms */ |
| 4187 | }; |
| 4188 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4189 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4190 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4191 | .substreams = 0, |
| 4192 | .channels_min = 0, |
| 4193 | .channels_max = 0, |
| 4194 | }; |
| 4195 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4196 | static int alc_build_pcms(struct hda_codec *codec) |
| 4197 | { |
| 4198 | struct alc_spec *spec = codec->spec; |
| 4199 | struct hda_pcm *info = spec->pcm_rec; |
| 4200 | int i; |
| 4201 | |
| 4202 | codec->num_pcms = 1; |
| 4203 | codec->pcm_info = info; |
| 4204 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4205 | if (spec->no_analog) |
| 4206 | goto skip_analog; |
| 4207 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4208 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4209 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4210 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4211 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4212 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4213 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4214 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4215 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4216 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4217 | } |
| 4218 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4219 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4220 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4221 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4222 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4223 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4224 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4225 | if (spec->channel_mode) { |
| 4226 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4227 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4228 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4229 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4230 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4231 | } |
| 4232 | } |
| 4233 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4234 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4235 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4236 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4237 | snprintf(spec->stream_name_digital, |
| 4238 | sizeof(spec->stream_name_digital), |
| 4239 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4240 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4241 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4242 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4243 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4244 | if (spec->dig_out_type) |
| 4245 | info->pcm_type = spec->dig_out_type; |
| 4246 | else |
| 4247 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4248 | if (spec->multiout.dig_out_nid && |
| 4249 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4250 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4251 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4252 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4253 | if (spec->dig_in_nid && |
| 4254 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4255 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4256 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4257 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4258 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4259 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4260 | } |
| 4261 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4262 | if (spec->no_analog) |
| 4263 | return 0; |
| 4264 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4265 | /* If the use of more than one ADC is requested for the current |
| 4266 | * model, configure a second analog capture-only PCM. |
| 4267 | */ |
| 4268 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4269 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4270 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4271 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4272 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4273 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4274 | if (spec->alt_dac_nid) { |
| 4275 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4276 | *spec->stream_analog_alt_playback; |
| 4277 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4278 | spec->alt_dac_nid; |
| 4279 | } else { |
| 4280 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4281 | alc_pcm_null_stream; |
| 4282 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4283 | } |
| 4284 | if (spec->num_adc_nids > 1) { |
| 4285 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4286 | *spec->stream_analog_alt_capture; |
| 4287 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4288 | spec->adc_nids[1]; |
| 4289 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4290 | spec->num_adc_nids - 1; |
| 4291 | } else { |
| 4292 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4293 | alc_pcm_null_stream; |
| 4294 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4295 | } |
| 4296 | } |
| 4297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4298 | return 0; |
| 4299 | } |
| 4300 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4301 | static inline void alc_shutup(struct hda_codec *codec) |
| 4302 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4303 | struct alc_spec *spec = codec->spec; |
| 4304 | |
| 4305 | if (spec && spec->shutup) |
| 4306 | spec->shutup(codec); |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4307 | snd_hda_shutup_pins(codec); |
| 4308 | } |
| 4309 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4310 | static void alc_free_kctls(struct hda_codec *codec) |
| 4311 | { |
| 4312 | struct alc_spec *spec = codec->spec; |
| 4313 | |
| 4314 | if (spec->kctls.list) { |
| 4315 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4316 | int i; |
| 4317 | for (i = 0; i < spec->kctls.used; i++) |
| 4318 | kfree(kctl[i].name); |
| 4319 | } |
| 4320 | snd_array_free(&spec->kctls); |
| 4321 | } |
| 4322 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4323 | static void alc_free(struct hda_codec *codec) |
| 4324 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4325 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4326 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4327 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4328 | return; |
| 4329 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4330 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4331 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4332 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4333 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4334 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4335 | } |
| 4336 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4337 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4338 | static void alc_power_eapd(struct hda_codec *codec) |
| 4339 | { |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 4340 | alc_auto_setup_eapd(codec, false); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4341 | } |
| 4342 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4343 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4344 | { |
| 4345 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4346 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4347 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4348 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4349 | return 0; |
| 4350 | } |
| 4351 | #endif |
| 4352 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4353 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4354 | static int alc_resume(struct hda_codec *codec) |
| 4355 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4356 | msleep(150); /* to avoid pop noise */ |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4357 | codec->patch_ops.init(codec); |
| 4358 | snd_hda_codec_resume_amp(codec); |
| 4359 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4360 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4361 | return 0; |
| 4362 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4363 | #endif |
| 4364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4365 | /* |
| 4366 | */ |
| 4367 | static struct hda_codec_ops alc_patch_ops = { |
| 4368 | .build_controls = alc_build_controls, |
| 4369 | .build_pcms = alc_build_pcms, |
| 4370 | .init = alc_init, |
| 4371 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4372 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4373 | #ifdef SND_HDA_NEEDS_RESUME |
| 4374 | .resume = alc_resume, |
| 4375 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4376 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4377 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4378 | .check_power_status = alc_check_power_status, |
| 4379 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4380 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4381 | }; |
| 4382 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4383 | /* replace the codec chip_name with the given string */ |
| 4384 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4385 | { |
| 4386 | kfree(codec->chip_name); |
| 4387 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4388 | if (!codec->chip_name) { |
| 4389 | alc_free(codec); |
| 4390 | return -ENOMEM; |
| 4391 | } |
| 4392 | return 0; |
| 4393 | } |
| 4394 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4395 | /* |
| 4396 | * Test configuration for debugging |
| 4397 | * |
| 4398 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4399 | * enum controls. |
| 4400 | */ |
| 4401 | #ifdef CONFIG_SND_DEBUG |
| 4402 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4403 | 0x02, 0x03, 0x04, 0x05 |
| 4404 | }; |
| 4405 | |
| 4406 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4407 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4408 | .items = { |
| 4409 | { "In-1", 0x0 }, |
| 4410 | { "In-2", 0x1 }, |
| 4411 | { "In-3", 0x2 }, |
| 4412 | { "In-4", 0x3 }, |
| 4413 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4414 | { "Front", 0x5 }, |
| 4415 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4416 | }, |
| 4417 | }; |
| 4418 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4419 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4420 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4421 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4422 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4423 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4424 | }; |
| 4425 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4426 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4427 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4428 | { |
| 4429 | static char *texts[] = { |
| 4430 | "N/A", "Line Out", "HP Out", |
| 4431 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4432 | }; |
| 4433 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4434 | uinfo->count = 1; |
| 4435 | uinfo->value.enumerated.items = 8; |
| 4436 | if (uinfo->value.enumerated.item >= 8) |
| 4437 | uinfo->value.enumerated.item = 7; |
| 4438 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4439 | return 0; |
| 4440 | } |
| 4441 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4442 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4443 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4444 | { |
| 4445 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4446 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4447 | unsigned int pin_ctl, item = 0; |
| 4448 | |
| 4449 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4450 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4451 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4452 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4453 | item = 2; |
| 4454 | else |
| 4455 | item = 1; |
| 4456 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4457 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4458 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4459 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4460 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4461 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4462 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4463 | } |
| 4464 | } |
| 4465 | ucontrol->value.enumerated.item[0] = item; |
| 4466 | return 0; |
| 4467 | } |
| 4468 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4469 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4470 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4471 | { |
| 4472 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4473 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4474 | static unsigned int ctls[] = { |
| 4475 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4476 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4477 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4478 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4479 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4480 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4481 | }; |
| 4482 | unsigned int old_ctl, new_ctl; |
| 4483 | |
| 4484 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4485 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4486 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4487 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4488 | int val; |
| 4489 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4490 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4491 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4492 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4493 | HDA_AMP_MUTE : 0; |
| 4494 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4495 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4496 | return 1; |
| 4497 | } |
| 4498 | return 0; |
| 4499 | } |
| 4500 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4501 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4502 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4503 | { |
| 4504 | static char *texts[] = { |
| 4505 | "Front", "Surround", "CLFE", "Side" |
| 4506 | }; |
| 4507 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4508 | uinfo->count = 1; |
| 4509 | uinfo->value.enumerated.items = 4; |
| 4510 | if (uinfo->value.enumerated.item >= 4) |
| 4511 | uinfo->value.enumerated.item = 3; |
| 4512 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4513 | return 0; |
| 4514 | } |
| 4515 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4516 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4517 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4518 | { |
| 4519 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4520 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4521 | unsigned int sel; |
| 4522 | |
| 4523 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4524 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4525 | return 0; |
| 4526 | } |
| 4527 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4528 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4529 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4530 | { |
| 4531 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4532 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4533 | unsigned int sel; |
| 4534 | |
| 4535 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4536 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4537 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4538 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4539 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4540 | return 1; |
| 4541 | } |
| 4542 | return 0; |
| 4543 | } |
| 4544 | |
| 4545 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4546 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4547 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4548 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4549 | .info = alc_test_pin_ctl_info, \ |
| 4550 | .get = alc_test_pin_ctl_get, \ |
| 4551 | .put = alc_test_pin_ctl_put, \ |
| 4552 | .private_value = nid \ |
| 4553 | } |
| 4554 | |
| 4555 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4556 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4557 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4558 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4559 | .info = alc_test_pin_src_info, \ |
| 4560 | .get = alc_test_pin_src_get, \ |
| 4561 | .put = alc_test_pin_src_put, \ |
| 4562 | .private_value = nid \ |
| 4563 | } |
| 4564 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4565 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4566 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4567 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4568 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4569 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4570 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4571 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4572 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4573 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4574 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4575 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4576 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4577 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4578 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4579 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4580 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4581 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4582 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4583 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4584 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4585 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4586 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4587 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4588 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4589 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4590 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4591 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4592 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4593 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4595 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4596 | { |
| 4597 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4598 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4599 | .info = alc_ch_mode_info, |
| 4600 | .get = alc_ch_mode_get, |
| 4601 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4602 | }, |
| 4603 | { } /* end */ |
| 4604 | }; |
| 4605 | |
| 4606 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4607 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4608 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4610 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4611 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4612 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4613 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4614 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4615 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4616 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4618 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4619 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4620 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4621 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4622 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4623 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4624 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4625 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4626 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4629 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4630 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4631 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4632 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4633 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4634 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4635 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4636 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4637 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4638 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4639 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4641 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4642 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4644 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4645 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4646 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4647 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4648 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4649 | /* Analog input/passthru */ |
| 4650 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4653 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4655 | { } |
| 4656 | }; |
| 4657 | #endif |
| 4658 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4659 | /* |
| 4660 | */ |
| 4661 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4662 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4663 | [ALC880_3ST] = "3stack", |
| 4664 | [ALC880_TCL_S700] = "tcl", |
| 4665 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4666 | [ALC880_CLEVO] = "clevo", |
| 4667 | [ALC880_5ST] = "5stack", |
| 4668 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4669 | [ALC880_W810] = "w810", |
| 4670 | [ALC880_Z71V] = "z71v", |
| 4671 | [ALC880_6ST] = "6stack", |
| 4672 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4673 | [ALC880_ASUS] = "asus", |
| 4674 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4675 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4676 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4677 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4678 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4679 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4680 | [ALC880_F1734] = "F1734", |
| 4681 | [ALC880_LG] = "lg", |
| 4682 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4683 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4684 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4685 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4686 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4687 | [ALC880_AUTO] = "auto", |
| 4688 | }; |
| 4689 | |
| 4690 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4691 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4692 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4693 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4694 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4695 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4696 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4697 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4698 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4699 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4700 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4701 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4702 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4703 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4704 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4705 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4706 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4707 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4708 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4709 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4710 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4711 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4712 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4713 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4714 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4715 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4716 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4717 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4718 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4719 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4720 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4721 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4722 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4723 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4724 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4725 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4726 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4727 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4728 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4729 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4730 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Justin P. Mattock | a2e2bc2 | 2011-02-24 22:16:02 -0800 | [diff] [blame] | 4731 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4732 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4733 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4734 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4735 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4736 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4737 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4738 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4739 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4740 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4741 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4742 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4743 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4744 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4745 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4746 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4747 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4748 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4749 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4750 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4751 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4752 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4753 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4754 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4755 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4756 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4757 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4758 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4759 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4760 | /* default Intel */ |
| 4761 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4762 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4763 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4764 | {} |
| 4765 | }; |
| 4766 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4767 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4768 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4769 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4770 | static struct alc_config_preset alc880_presets[] = { |
| 4771 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4772 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4773 | .init_verbs = { alc880_volume_init_verbs, |
| 4774 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4775 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4776 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4777 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4778 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4779 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4780 | .input_mux = &alc880_capture_source, |
| 4781 | }, |
| 4782 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4783 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4784 | .init_verbs = { alc880_volume_init_verbs, |
| 4785 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4786 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4787 | .dac_nids = alc880_dac_nids, |
| 4788 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4789 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4790 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4791 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4792 | .input_mux = &alc880_capture_source, |
| 4793 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4794 | [ALC880_TCL_S700] = { |
| 4795 | .mixers = { alc880_tcl_s700_mixer }, |
| 4796 | .init_verbs = { alc880_volume_init_verbs, |
| 4797 | alc880_pin_tcl_S700_init_verbs, |
| 4798 | alc880_gpio2_init_verbs }, |
| 4799 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4800 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4801 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4802 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4803 | .hp_nid = 0x03, |
| 4804 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4805 | .channel_mode = alc880_2_jack_modes, |
| 4806 | .input_mux = &alc880_capture_source, |
| 4807 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4808 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4809 | .mixers = { alc880_three_stack_mixer, |
| 4810 | alc880_five_stack_mixer}, |
| 4811 | .init_verbs = { alc880_volume_init_verbs, |
| 4812 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4813 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4814 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4815 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4816 | .channel_mode = alc880_fivestack_modes, |
| 4817 | .input_mux = &alc880_capture_source, |
| 4818 | }, |
| 4819 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4820 | .mixers = { alc880_three_stack_mixer, |
| 4821 | alc880_five_stack_mixer }, |
| 4822 | .init_verbs = { alc880_volume_init_verbs, |
| 4823 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4824 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4825 | .dac_nids = alc880_dac_nids, |
| 4826 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4827 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4828 | .channel_mode = alc880_fivestack_modes, |
| 4829 | .input_mux = &alc880_capture_source, |
| 4830 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4831 | [ALC880_6ST] = { |
| 4832 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4833 | .init_verbs = { alc880_volume_init_verbs, |
| 4834 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4835 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4836 | .dac_nids = alc880_6st_dac_nids, |
| 4837 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4838 | .channel_mode = alc880_sixstack_modes, |
| 4839 | .input_mux = &alc880_6stack_capture_source, |
| 4840 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4841 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4842 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4843 | .init_verbs = { alc880_volume_init_verbs, |
| 4844 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4845 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4846 | .dac_nids = alc880_6st_dac_nids, |
| 4847 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4848 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4849 | .channel_mode = alc880_sixstack_modes, |
| 4850 | .input_mux = &alc880_6stack_capture_source, |
| 4851 | }, |
| 4852 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4853 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4854 | .init_verbs = { alc880_volume_init_verbs, |
| 4855 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4856 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4857 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4858 | .dac_nids = alc880_w810_dac_nids, |
| 4859 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4860 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4861 | .channel_mode = alc880_w810_modes, |
| 4862 | .input_mux = &alc880_capture_source, |
| 4863 | }, |
| 4864 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4865 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4866 | .init_verbs = { alc880_volume_init_verbs, |
| 4867 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4868 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4869 | .dac_nids = alc880_z71v_dac_nids, |
| 4870 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4871 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4872 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4873 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4874 | .input_mux = &alc880_capture_source, |
| 4875 | }, |
| 4876 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4877 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4878 | .init_verbs = { alc880_volume_init_verbs, |
| 4879 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4880 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4881 | .dac_nids = alc880_f1734_dac_nids, |
| 4882 | .hp_nid = 0x02, |
| 4883 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4884 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4885 | .input_mux = &alc880_f1734_capture_source, |
| 4886 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4887 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4888 | .init_hook = alc_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4889 | }, |
| 4890 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4891 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4892 | .init_verbs = { alc880_volume_init_verbs, |
| 4893 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4894 | alc880_gpio1_init_verbs }, |
| 4895 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4896 | .dac_nids = alc880_asus_dac_nids, |
| 4897 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4898 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4899 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4900 | .input_mux = &alc880_capture_source, |
| 4901 | }, |
| 4902 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4903 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4904 | .init_verbs = { alc880_volume_init_verbs, |
| 4905 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4906 | alc880_gpio1_init_verbs }, |
| 4907 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4908 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4909 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4910 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4911 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4912 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4913 | .input_mux = &alc880_capture_source, |
| 4914 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4915 | [ALC880_ASUS_DIG2] = { |
| 4916 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4917 | .init_verbs = { alc880_volume_init_verbs, |
| 4918 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4919 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4920 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4921 | .dac_nids = alc880_asus_dac_nids, |
| 4922 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4923 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4924 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4925 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4926 | .input_mux = &alc880_capture_source, |
| 4927 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4928 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4929 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4930 | .init_verbs = { alc880_volume_init_verbs, |
| 4931 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4932 | alc880_gpio1_init_verbs }, |
| 4933 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4934 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4935 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4936 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4937 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4938 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4939 | .input_mux = &alc880_capture_source, |
| 4940 | }, |
| 4941 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4942 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4943 | .init_verbs = { alc880_volume_init_verbs, |
| 4944 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4945 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4946 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4947 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4948 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4949 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4950 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4951 | .input_mux = &alc880_capture_source, |
| 4952 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4953 | [ALC880_UNIWILL] = { |
| 4954 | .mixers = { alc880_uniwill_mixer }, |
| 4955 | .init_verbs = { alc880_volume_init_verbs, |
| 4956 | alc880_uniwill_init_verbs }, |
| 4957 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4958 | .dac_nids = alc880_asus_dac_nids, |
| 4959 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4960 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4961 | .channel_mode = alc880_threestack_modes, |
| 4962 | .need_dac_fix = 1, |
| 4963 | .input_mux = &alc880_capture_source, |
| 4964 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4965 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4966 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4967 | }, |
| 4968 | [ALC880_UNIWILL_P53] = { |
| 4969 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4970 | .init_verbs = { alc880_volume_init_verbs, |
| 4971 | alc880_uniwill_p53_init_verbs }, |
| 4972 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4973 | .dac_nids = alc880_asus_dac_nids, |
| 4974 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4975 | .channel_mode = alc880_threestack_modes, |
| 4976 | .input_mux = &alc880_capture_source, |
| 4977 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4978 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4979 | .init_hook = alc_hp_automute, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4980 | }, |
| 4981 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4982 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4983 | .init_verbs = { alc880_volume_init_verbs, |
| 4984 | alc880_uniwill_p53_init_verbs, |
| 4985 | alc880_beep_init_verbs }, |
| 4986 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4987 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4988 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4989 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4990 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4991 | .input_mux = &alc880_capture_source, |
| 4992 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4993 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4994 | .init_hook = alc_hp_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4995 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4996 | [ALC880_CLEVO] = { |
| 4997 | .mixers = { alc880_three_stack_mixer }, |
| 4998 | .init_verbs = { alc880_volume_init_verbs, |
| 4999 | alc880_pin_clevo_init_verbs }, |
| 5000 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5001 | .dac_nids = alc880_dac_nids, |
| 5002 | .hp_nid = 0x03, |
| 5003 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5004 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5005 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5006 | .input_mux = &alc880_capture_source, |
| 5007 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5008 | [ALC880_LG] = { |
| 5009 | .mixers = { alc880_lg_mixer }, |
| 5010 | .init_verbs = { alc880_volume_init_verbs, |
| 5011 | alc880_lg_init_verbs }, |
| 5012 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 5013 | .dac_nids = alc880_lg_dac_nids, |
| 5014 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5015 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 5016 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5017 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5018 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5019 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5020 | .setup = alc880_lg_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5021 | .init_hook = alc_hp_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5022 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5023 | .loopbacks = alc880_lg_loopbacks, |
| 5024 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5025 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5026 | [ALC880_LG_LW] = { |
| 5027 | .mixers = { alc880_lg_lw_mixer }, |
| 5028 | .init_verbs = { alc880_volume_init_verbs, |
| 5029 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5030 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5031 | .dac_nids = alc880_dac_nids, |
| 5032 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5033 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5034 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5035 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5036 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5037 | .setup = alc880_lg_lw_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5038 | .init_hook = alc_hp_automute, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5039 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5040 | [ALC880_MEDION_RIM] = { |
| 5041 | .mixers = { alc880_medion_rim_mixer }, |
| 5042 | .init_verbs = { alc880_volume_init_verbs, |
| 5043 | alc880_medion_rim_init_verbs, |
| 5044 | alc_gpio2_init_verbs }, |
| 5045 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5046 | .dac_nids = alc880_dac_nids, |
| 5047 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5048 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5049 | .channel_mode = alc880_2_jack_modes, |
| 5050 | .input_mux = &alc880_medion_rim_capture_source, |
| 5051 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5052 | .setup = alc880_medion_rim_setup, |
| 5053 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5054 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5055 | #ifdef CONFIG_SND_DEBUG |
| 5056 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5057 | .mixers = { alc880_test_mixer }, |
| 5058 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5059 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5060 | .dac_nids = alc880_test_dac_nids, |
| 5061 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5062 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5063 | .channel_mode = alc880_test_modes, |
| 5064 | .input_mux = &alc880_test_capture_source, |
| 5065 | }, |
| 5066 | #endif |
| 5067 | }; |
| 5068 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5069 | /* |
| 5070 | * Automatic parse of I/O pins from the BIOS configuration |
| 5071 | */ |
| 5072 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5073 | enum { |
| 5074 | ALC_CTL_WIDGET_VOL, |
| 5075 | ALC_CTL_WIDGET_MUTE, |
| 5076 | ALC_CTL_BIND_MUTE, |
| 5077 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5078 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5079 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5080 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5081 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5082 | }; |
| 5083 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5084 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) |
| 5085 | { |
| 5086 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
| 5087 | return snd_array_new(&spec->kctls); |
| 5088 | } |
| 5089 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5090 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5091 | 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] | 5092 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5093 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5094 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5095 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5096 | knew = alc_kcontrol_new(spec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5097 | if (!knew) |
| 5098 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5099 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5100 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5101 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5102 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5103 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5104 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5105 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5106 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5107 | return 0; |
| 5108 | } |
| 5109 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5110 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5111 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5112 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5113 | { |
| 5114 | char name[32]; |
| 5115 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5116 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5117 | } |
| 5118 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5119 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5120 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5121 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5122 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5123 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5124 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5125 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5126 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5127 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5128 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5129 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5130 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5131 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5132 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5133 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5134 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5135 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5136 | #define ALC880_PIN_CD_NID 0x1c |
| 5137 | |
| 5138 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5139 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5140 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5141 | { |
| 5142 | hda_nid_t nid; |
| 5143 | int assigned[4]; |
| 5144 | int i, j; |
| 5145 | |
| 5146 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5147 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5148 | |
| 5149 | /* check the pins hardwired to audio widget */ |
| 5150 | for (i = 0; i < cfg->line_outs; i++) { |
| 5151 | nid = cfg->line_out_pins[i]; |
| 5152 | if (alc880_is_fixed_pin(nid)) { |
| 5153 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5154 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5155 | assigned[idx] = 1; |
| 5156 | } |
| 5157 | } |
| 5158 | /* left pins can be connect to any audio widget */ |
| 5159 | for (i = 0; i < cfg->line_outs; i++) { |
| 5160 | nid = cfg->line_out_pins[i]; |
| 5161 | if (alc880_is_fixed_pin(nid)) |
| 5162 | continue; |
| 5163 | /* search for an empty channel */ |
| 5164 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5165 | if (!assigned[j]) { |
| 5166 | spec->multiout.dac_nids[i] = |
| 5167 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5168 | assigned[j] = 1; |
| 5169 | break; |
| 5170 | } |
| 5171 | } |
| 5172 | } |
| 5173 | spec->multiout.num_dacs = cfg->line_outs; |
| 5174 | return 0; |
| 5175 | } |
| 5176 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5177 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5178 | bool can_be_master) |
| 5179 | { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5180 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 5181 | |
| 5182 | if (cfg->line_outs == 1 && !spec->multi_ios && |
| 5183 | !cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5184 | return "Master"; |
| 5185 | |
| 5186 | switch (cfg->line_out_type) { |
| 5187 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5188 | if (cfg->line_outs == 1) |
| 5189 | return "Speaker"; |
| 5190 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5191 | case AUTO_PIN_HP_OUT: |
| 5192 | return "Headphone"; |
| 5193 | default: |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5194 | if (cfg->line_outs == 1 && !spec->multi_ios) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5195 | return "PCM"; |
| 5196 | break; |
| 5197 | } |
| 5198 | return NULL; |
| 5199 | } |
| 5200 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5201 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5202 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5203 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5204 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5205 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5206 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5207 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5208 | const char *pfx = alc_get_line_out_pfx(spec, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5209 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5210 | int i, err, noutputs; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5211 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5212 | noutputs = cfg->line_outs; |
| 5213 | if (spec->multi_ios > 0) |
| 5214 | noutputs += spec->multi_ios; |
| 5215 | |
| 5216 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5217 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5218 | continue; |
| 5219 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5220 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5221 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5222 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5223 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5224 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5225 | HDA_OUTPUT)); |
| 5226 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5227 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5228 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5229 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5230 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5231 | HDA_OUTPUT)); |
| 5232 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5233 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5234 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5235 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5236 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5237 | HDA_INPUT)); |
| 5238 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5239 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5240 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5241 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5242 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5243 | HDA_INPUT)); |
| 5244 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5245 | return err; |
| 5246 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5247 | const char *name = pfx; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5248 | int index = i; |
| 5249 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5250 | name = chname[i]; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5251 | index = 0; |
| 5252 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5253 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5254 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5255 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5256 | HDA_OUTPUT)); |
| 5257 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5258 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5259 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5260 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5261 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5262 | HDA_INPUT)); |
| 5263 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5264 | return err; |
| 5265 | } |
| 5266 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5267 | return 0; |
| 5268 | } |
| 5269 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5270 | /* add playback controls for speaker and HP outputs */ |
| 5271 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5272 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5273 | { |
| 5274 | hda_nid_t nid; |
| 5275 | int err; |
| 5276 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5277 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5278 | return 0; |
| 5279 | |
| 5280 | if (alc880_is_fixed_pin(pin)) { |
| 5281 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5282 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5283 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5284 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5285 | else |
| 5286 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5287 | /* control HP volume/switch on the output mixer amp */ |
| 5288 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5289 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5290 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5291 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5292 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5293 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5294 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5295 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5296 | return err; |
| 5297 | } else if (alc880_is_multi_pin(pin)) { |
| 5298 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5299 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5300 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5301 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5302 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5303 | return err; |
| 5304 | } |
| 5305 | return 0; |
| 5306 | } |
| 5307 | |
| 5308 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5309 | 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] | 5310 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5311 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5312 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5313 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5314 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5315 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5316 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5317 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5318 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5319 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5320 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5321 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5322 | return err; |
| 5323 | return 0; |
| 5324 | } |
| 5325 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5326 | 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] | 5327 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5328 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5329 | return (pincap & AC_PINCAP_IN) != 0; |
| 5330 | } |
| 5331 | |
| 5332 | /* create playback/capture controls for input pins */ |
| 5333 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5334 | const struct auto_pin_cfg *cfg, |
| 5335 | hda_nid_t mixer, |
| 5336 | hda_nid_t cap1, hda_nid_t cap2) |
| 5337 | { |
| 5338 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5339 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5340 | int i, err, idx, type_idx = 0; |
| 5341 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5342 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5343 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5344 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5345 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5346 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5347 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5348 | if (!alc_is_input_pin(codec, pin)) |
| 5349 | continue; |
| 5350 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5351 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5352 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5353 | type_idx++; |
| 5354 | else |
| 5355 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5356 | prev_label = label; |
| 5357 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5358 | if (mixer) { |
| 5359 | idx = get_connection_index(codec, mixer, pin); |
| 5360 | if (idx >= 0) { |
| 5361 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5362 | label, type_idx, |
| 5363 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5364 | if (err < 0) |
| 5365 | return err; |
| 5366 | } |
| 5367 | } |
| 5368 | |
| 5369 | if (!cap1) |
| 5370 | continue; |
| 5371 | idx = get_connection_index(codec, cap1, pin); |
| 5372 | if (idx < 0 && cap2) |
| 5373 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5374 | if (idx >= 0) |
| 5375 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5376 | } |
| 5377 | return 0; |
| 5378 | } |
| 5379 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5380 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5381 | const struct auto_pin_cfg *cfg) |
| 5382 | { |
| 5383 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5384 | } |
| 5385 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5386 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5387 | unsigned int pin_type) |
| 5388 | { |
| 5389 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5390 | pin_type); |
| 5391 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5392 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5393 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5394 | } |
| 5395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5396 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5397 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5398 | int dac_idx) |
| 5399 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5400 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5401 | /* need the manual connection? */ |
| 5402 | if (alc880_is_multi_pin(nid)) { |
| 5403 | struct alc_spec *spec = codec->spec; |
| 5404 | int idx = alc880_multi_pin_idx(nid); |
| 5405 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5406 | AC_VERB_SET_CONNECT_SEL, |
| 5407 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5408 | } |
| 5409 | } |
| 5410 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5411 | static int get_pin_type(int line_out_type) |
| 5412 | { |
| 5413 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5414 | return PIN_HP; |
| 5415 | else |
| 5416 | return PIN_OUT; |
| 5417 | } |
| 5418 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5419 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5420 | { |
| 5421 | struct alc_spec *spec = codec->spec; |
| 5422 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5423 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5424 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5425 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5426 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5427 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5428 | } |
| 5429 | } |
| 5430 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5431 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5432 | { |
| 5433 | struct alc_spec *spec = codec->spec; |
| 5434 | hda_nid_t pin; |
| 5435 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5436 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5437 | if (pin) /* connect to front */ |
| 5438 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5439 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5440 | if (pin) /* connect to front */ |
| 5441 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5442 | } |
| 5443 | |
| 5444 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5445 | { |
| 5446 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5447 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5448 | int i; |
| 5449 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5450 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5451 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5452 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5453 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5454 | if (nid != ALC880_PIN_CD_NID && |
| 5455 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5456 | snd_hda_codec_write(codec, nid, 0, |
| 5457 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5458 | AMP_OUT_MUTE); |
| 5459 | } |
| 5460 | } |
| 5461 | } |
| 5462 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5463 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5464 | { |
| 5465 | struct alc_spec *spec = codec->spec; |
| 5466 | int c; |
| 5467 | |
| 5468 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5469 | unsigned int mux_idx; |
| 5470 | const struct hda_input_mux *imux; |
| 5471 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5472 | imux = &spec->input_mux[mux_idx]; |
| 5473 | if (!imux->num_items && mux_idx > 0) |
| 5474 | imux = &spec->input_mux[0]; |
| 5475 | if (imux) |
| 5476 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5477 | AC_VERB_SET_CONNECT_SEL, |
| 5478 | imux->items[0].index); |
| 5479 | } |
| 5480 | } |
| 5481 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5482 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec); |
| 5483 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5484 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5485 | /* return 1 if successful, 0 if the proper config is not found, |
| 5486 | * or a negative error code |
| 5487 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5488 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5489 | { |
| 5490 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5491 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5492 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5493 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5494 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5495 | alc880_ignore); |
| 5496 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5497 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5498 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5499 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5500 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5501 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5502 | if (err < 0) |
| 5503 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5504 | err = alc_auto_add_multi_channel_mode(codec); |
| 5505 | if (err < 0) |
| 5506 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5507 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5508 | if (err < 0) |
| 5509 | return err; |
| 5510 | err = alc880_auto_create_extra_out(spec, |
| 5511 | spec->autocfg.speaker_pins[0], |
| 5512 | "Speaker"); |
| 5513 | if (err < 0) |
| 5514 | return err; |
| 5515 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5516 | "Headphone"); |
| 5517 | if (err < 0) |
| 5518 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5519 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5520 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5521 | return err; |
| 5522 | |
| 5523 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5524 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5525 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5526 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5527 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5528 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5529 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5530 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5531 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5532 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5533 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5534 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5535 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5536 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5537 | return 1; |
| 5538 | } |
| 5539 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5540 | /* additional initialization for auto-configuration model */ |
| 5541 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5542 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5543 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5544 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5545 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5546 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5547 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5548 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5549 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5550 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5551 | } |
| 5552 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5553 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5554 | * one of two digital mic pins, e.g. on ALC272 |
| 5555 | */ |
| 5556 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5557 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5558 | struct alc_spec *spec = codec->spec; |
| 5559 | int i; |
| 5560 | |
| 5561 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5562 | hda_nid_t cap = spec->capsrc_nids ? |
| 5563 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5564 | int iidx, eidx; |
| 5565 | |
| 5566 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5567 | if (iidx < 0) |
| 5568 | continue; |
| 5569 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5570 | if (eidx < 0) |
| 5571 | continue; |
| 5572 | spec->int_mic.mux_idx = iidx; |
| 5573 | spec->ext_mic.mux_idx = eidx; |
| 5574 | if (spec->capsrc_nids) |
| 5575 | spec->capsrc_nids += i; |
| 5576 | spec->adc_nids += i; |
| 5577 | spec->num_adc_nids = 1; |
| 5578 | return; |
| 5579 | } |
| 5580 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5581 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5582 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5583 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5584 | } |
| 5585 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5586 | /* select or unmute the given capsrc route */ |
| 5587 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5588 | int idx) |
| 5589 | { |
| 5590 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5591 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5592 | HDA_AMP_MUTE, 0); |
| 5593 | } else { |
| 5594 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5595 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5596 | } |
| 5597 | } |
| 5598 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5599 | /* set the default connection to that pin */ |
| 5600 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5601 | { |
| 5602 | struct alc_spec *spec = codec->spec; |
| 5603 | int i; |
| 5604 | |
| 5605 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5606 | hda_nid_t cap = spec->capsrc_nids ? |
| 5607 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5608 | int idx; |
| 5609 | |
| 5610 | idx = get_connection_index(codec, cap, pin); |
| 5611 | if (idx < 0) |
| 5612 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5613 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5614 | return i; /* return the found index */ |
| 5615 | } |
| 5616 | return -1; /* not found */ |
| 5617 | } |
| 5618 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5619 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5620 | static void fixup_single_adc(struct hda_codec *codec) |
| 5621 | { |
| 5622 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5623 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5624 | int i; |
| 5625 | |
| 5626 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5627 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5628 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5629 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5630 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5631 | /* use only this ADC */ |
| 5632 | if (spec->capsrc_nids) |
| 5633 | spec->capsrc_nids += i; |
| 5634 | spec->adc_nids += i; |
| 5635 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5636 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5637 | } |
| 5638 | } |
| 5639 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5640 | /* initialize dual adcs */ |
| 5641 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5642 | { |
| 5643 | struct alc_spec *spec = codec->spec; |
| 5644 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5645 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5646 | } |
| 5647 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5648 | /* initialize some special cases for input sources */ |
| 5649 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5650 | { |
| 5651 | struct alc_spec *spec = codec->spec; |
| 5652 | if (spec->dual_adc_switch) |
| 5653 | fixup_dual_adc_switch(codec); |
| 5654 | else if (spec->single_input_src) |
| 5655 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5656 | } |
| 5657 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5658 | static void set_capture_mixer(struct hda_codec *codec) |
| 5659 | { |
| 5660 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5661 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5662 | { alc_capture_mixer_nosrc1, |
| 5663 | alc_capture_mixer_nosrc2, |
| 5664 | alc_capture_mixer_nosrc3 }, |
| 5665 | { alc_capture_mixer1, |
| 5666 | alc_capture_mixer2, |
| 5667 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5668 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5669 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5670 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5671 | int num_adcs = spec->num_adc_nids; |
| 5672 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5673 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5674 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5675 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5676 | else if (spec->input_mux) { |
| 5677 | if (spec->input_mux->num_items > 1) |
| 5678 | mux = 1; |
| 5679 | else if (spec->input_mux->num_items == 1) |
| 5680 | fixup_single_adc(codec); |
| 5681 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5682 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5683 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5684 | } |
| 5685 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5686 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5687 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5688 | int num_nids) |
| 5689 | { |
| 5690 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5691 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5692 | int n; |
| 5693 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5694 | |
| 5695 | for (n = 0; n < num_nids; n++) { |
| 5696 | hda_nid_t adc, cap; |
| 5697 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5698 | int nconns, i, j; |
| 5699 | |
| 5700 | adc = nids[n]; |
| 5701 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5702 | continue; |
| 5703 | cap = adc; |
| 5704 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5705 | ARRAY_SIZE(conn)); |
| 5706 | if (nconns == 1) { |
| 5707 | cap = conn[0]; |
| 5708 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5709 | ARRAY_SIZE(conn)); |
| 5710 | } |
| 5711 | if (nconns <= 0) |
| 5712 | continue; |
| 5713 | if (!fallback_adc) { |
| 5714 | fallback_adc = adc; |
| 5715 | fallback_cap = cap; |
| 5716 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5717 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5718 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5719 | for (j = 0; j < nconns; j++) { |
| 5720 | if (conn[j] == nid) |
| 5721 | break; |
| 5722 | } |
| 5723 | if (j >= nconns) |
| 5724 | break; |
| 5725 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5726 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5727 | int num_adcs = spec->num_adc_nids; |
| 5728 | spec->private_adc_nids[num_adcs] = adc; |
| 5729 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5730 | spec->num_adc_nids++; |
| 5731 | spec->adc_nids = spec->private_adc_nids; |
| 5732 | if (adc != cap) |
| 5733 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5734 | } |
| 5735 | } |
| 5736 | if (!spec->num_adc_nids) { |
| 5737 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5738 | " using fallback 0x%x\n", |
| 5739 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5740 | spec->private_adc_nids[0] = fallback_adc; |
| 5741 | spec->adc_nids = spec->private_adc_nids; |
| 5742 | if (fallback_adc != fallback_cap) { |
| 5743 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5744 | spec->capsrc_nids = spec->private_adc_nids; |
| 5745 | } |
| 5746 | } |
| 5747 | } |
| 5748 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5749 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5750 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5751 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5752 | |
| 5753 | static struct snd_pci_quirk beep_white_list[] = { |
| 5754 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5755 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5756 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5757 | {} |
| 5758 | }; |
| 5759 | |
| 5760 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5761 | { |
| 5762 | struct alc_spec *spec = codec->spec; |
| 5763 | const struct snd_pci_quirk *q; |
| 5764 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5765 | if (q) |
| 5766 | return q->value; |
| 5767 | return spec->cdefine.enable_pcbeep; |
| 5768 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5769 | #else |
| 5770 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5771 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5772 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5773 | |
| 5774 | /* |
| 5775 | * OK, here we have finally the patch for ALC880 |
| 5776 | */ |
| 5777 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5778 | static int patch_alc880(struct hda_codec *codec) |
| 5779 | { |
| 5780 | struct alc_spec *spec; |
| 5781 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5782 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5783 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5784 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5785 | if (spec == NULL) |
| 5786 | return -ENOMEM; |
| 5787 | |
| 5788 | codec->spec = spec; |
| 5789 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5790 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5791 | alc880_models, |
| 5792 | alc880_cfg_tbl); |
| 5793 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5794 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5795 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5796 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5797 | } |
| 5798 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5799 | if (board_config == ALC880_AUTO) { |
| 5800 | /* automatic parse from the BIOS config */ |
| 5801 | err = alc880_parse_auto_config(codec); |
| 5802 | if (err < 0) { |
| 5803 | alc_free(codec); |
| 5804 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5805 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5806 | printk(KERN_INFO |
| 5807 | "hda_codec: Cannot set up configuration " |
| 5808 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5809 | board_config = ALC880_3ST; |
| 5810 | } |
| 5811 | } |
| 5812 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5813 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5814 | if (err < 0) { |
| 5815 | alc_free(codec); |
| 5816 | return err; |
| 5817 | } |
| 5818 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5819 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5820 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5821 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5822 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5823 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5824 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5825 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5826 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5827 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5828 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5829 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5830 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5831 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5832 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5833 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5834 | if (wcap != AC_WID_AUD_IN) { |
| 5835 | spec->adc_nids = alc880_adc_nids_alt; |
| 5836 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5837 | } else { |
| 5838 | spec->adc_nids = alc880_adc_nids; |
| 5839 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5840 | } |
| 5841 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5842 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5843 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5844 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5845 | spec->vmaster_nid = 0x0c; |
| 5846 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5847 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5848 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5849 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5850 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5851 | if (!spec->loopback.amplist) |
| 5852 | spec->loopback.amplist = alc880_loopbacks; |
| 5853 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5854 | |
| 5855 | return 0; |
| 5856 | } |
| 5857 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5858 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5859 | /* |
| 5860 | * ALC260 support |
| 5861 | */ |
| 5862 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5863 | static hda_nid_t alc260_dac_nids[1] = { |
| 5864 | /* front */ |
| 5865 | 0x02, |
| 5866 | }; |
| 5867 | |
| 5868 | static hda_nid_t alc260_adc_nids[1] = { |
| 5869 | /* ADC0 */ |
| 5870 | 0x04, |
| 5871 | }; |
| 5872 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5873 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5874 | /* ADC1 */ |
| 5875 | 0x05, |
| 5876 | }; |
| 5877 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5878 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5879 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5880 | */ |
| 5881 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5882 | /* ADC0, ADC1 */ |
| 5883 | 0x04, 0x05 |
| 5884 | }; |
| 5885 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5886 | #define ALC260_DIGOUT_NID 0x03 |
| 5887 | #define ALC260_DIGIN_NID 0x06 |
| 5888 | |
| 5889 | static struct hda_input_mux alc260_capture_source = { |
| 5890 | .num_items = 4, |
| 5891 | .items = { |
| 5892 | { "Mic", 0x0 }, |
| 5893 | { "Front Mic", 0x1 }, |
| 5894 | { "Line", 0x2 }, |
| 5895 | { "CD", 0x4 }, |
| 5896 | }, |
| 5897 | }; |
| 5898 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5899 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5900 | * headphone jack and the internal CD lines since these are the only pins at |
| 5901 | * which audio can appear. For flexibility, also allow the option of |
| 5902 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5903 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5904 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5905 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5906 | { |
| 5907 | .num_items = 3, |
| 5908 | .items = { |
| 5909 | { "Mic/Line", 0x0 }, |
| 5910 | { "CD", 0x4 }, |
| 5911 | { "Headphone", 0x2 }, |
| 5912 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5913 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5914 | { |
| 5915 | .num_items = 4, |
| 5916 | .items = { |
| 5917 | { "Mic/Line", 0x0 }, |
| 5918 | { "CD", 0x4 }, |
| 5919 | { "Headphone", 0x2 }, |
| 5920 | { "Mixer", 0x5 }, |
| 5921 | }, |
| 5922 | }, |
| 5923 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5924 | }; |
| 5925 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5926 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5927 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5928 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5929 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5930 | { |
| 5931 | .num_items = 4, |
| 5932 | .items = { |
| 5933 | { "Mic", 0x0 }, |
| 5934 | { "Line", 0x2 }, |
| 5935 | { "CD", 0x4 }, |
| 5936 | { "Headphone", 0x5 }, |
| 5937 | }, |
| 5938 | }, |
| 5939 | { |
| 5940 | .num_items = 5, |
| 5941 | .items = { |
| 5942 | { "Mic", 0x0 }, |
| 5943 | { "Line", 0x2 }, |
| 5944 | { "CD", 0x4 }, |
| 5945 | { "Headphone", 0x6 }, |
| 5946 | { "Mixer", 0x5 }, |
| 5947 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5948 | }, |
| 5949 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5950 | |
| 5951 | /* Maxdata Favorit 100XS */ |
| 5952 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5953 | { |
| 5954 | .num_items = 2, |
| 5955 | .items = { |
| 5956 | { "Line/Mic", 0x0 }, |
| 5957 | { "CD", 0x4 }, |
| 5958 | }, |
| 5959 | }, |
| 5960 | { |
| 5961 | .num_items = 3, |
| 5962 | .items = { |
| 5963 | { "Line/Mic", 0x0 }, |
| 5964 | { "CD", 0x4 }, |
| 5965 | { "Mixer", 0x5 }, |
| 5966 | }, |
| 5967 | }, |
| 5968 | }; |
| 5969 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5970 | /* |
| 5971 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5972 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5973 | * element which allows changing the channel mode, so the verb list is |
| 5974 | * never used. |
| 5975 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5976 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5977 | { 2, NULL }, |
| 5978 | }; |
| 5979 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5980 | |
| 5981 | /* Mixer combinations |
| 5982 | * |
| 5983 | * basic: base_output + input + pc_beep + capture |
| 5984 | * HP: base_output + input + capture_alt |
| 5985 | * HP_3013: hp_3013 + input + capture |
| 5986 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5987 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5988 | */ |
| 5989 | |
| 5990 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5991 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5992 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5993 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5994 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5995 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5996 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5997 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5998 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5999 | |
| 6000 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6001 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6002 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6003 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6004 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6005 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6006 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6007 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6008 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6009 | { } /* end */ |
| 6010 | }; |
| 6011 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6012 | /* update HP, line and mono out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6013 | static void alc260_hp_master_update(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6014 | { |
| 6015 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6016 | |
| 6017 | /* change HP pins */ |
| 6018 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 6019 | spec->autocfg.hp_pins, spec->master_mute, true); |
| 6020 | update_speakers(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6021 | } |
| 6022 | |
| 6023 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 6024 | struct snd_ctl_elem_value *ucontrol) |
| 6025 | { |
| 6026 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6027 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6028 | *ucontrol->value.integer.value = !spec->master_mute; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6029 | return 0; |
| 6030 | } |
| 6031 | |
| 6032 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6033 | struct snd_ctl_elem_value *ucontrol) |
| 6034 | { |
| 6035 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6036 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6037 | int val = !*ucontrol->value.integer.value; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6038 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6039 | if (val == spec->master_mute) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6040 | return 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6041 | spec->master_mute = val; |
| 6042 | alc260_hp_master_update(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6043 | return 1; |
| 6044 | } |
| 6045 | |
| 6046 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 6047 | { |
| 6048 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6049 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6050 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6051 | .info = snd_ctl_boolean_mono_info, |
| 6052 | .get = alc260_hp_master_sw_get, |
| 6053 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6054 | }, |
| 6055 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6056 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6057 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6058 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6059 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6060 | HDA_OUTPUT), |
| 6061 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6062 | { } /* end */ |
| 6063 | }; |
| 6064 | |
| 6065 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 6066 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6067 | {}, |
| 6068 | }; |
| 6069 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6070 | static void alc260_hp_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6071 | { |
| 6072 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6073 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6074 | spec->autocfg.hp_pins[0] = 0x0f; |
| 6075 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6076 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6077 | spec->automute = 1; |
| 6078 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6079 | } |
| 6080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6081 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6082 | { |
| 6083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6084 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6085 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6086 | .info = snd_ctl_boolean_mono_info, |
| 6087 | .get = alc260_hp_master_sw_get, |
| 6088 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6089 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6090 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6091 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6092 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6093 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6094 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6095 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6096 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6097 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6098 | { } /* end */ |
| 6099 | }; |
| 6100 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6101 | static void alc260_hp_3013_setup(struct hda_codec *codec) |
| 6102 | { |
| 6103 | struct alc_spec *spec = codec->spec; |
| 6104 | |
| 6105 | spec->autocfg.hp_pins[0] = 0x15; |
| 6106 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6107 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6108 | spec->automute = 1; |
| 6109 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 6110 | } |
| 6111 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6112 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6113 | .ops = &snd_hda_bind_vol, |
| 6114 | .values = { |
| 6115 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6116 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6117 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6118 | 0 |
| 6119 | }, |
| 6120 | }; |
| 6121 | |
| 6122 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6123 | .ops = &snd_hda_bind_sw, |
| 6124 | .values = { |
| 6125 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6126 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6127 | 0 |
| 6128 | }, |
| 6129 | }; |
| 6130 | |
| 6131 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6132 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6133 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6134 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6135 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6136 | { } /* end */ |
| 6137 | }; |
| 6138 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6139 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6140 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6141 | {}, |
| 6142 | }; |
| 6143 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6144 | static void alc260_hp_3012_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6145 | { |
| 6146 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6147 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6148 | spec->autocfg.hp_pins[0] = 0x10; |
| 6149 | spec->autocfg.speaker_pins[0] = 0x0f; |
| 6150 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6151 | spec->autocfg.speaker_pins[2] = 0x15; |
| 6152 | spec->automute = 1; |
| 6153 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6154 | } |
| 6155 | |
| 6156 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6157 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6158 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6159 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6160 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6161 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6162 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6163 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6164 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6165 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6166 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6167 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6168 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6169 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6170 | { } /* end */ |
| 6171 | }; |
| 6172 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6173 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6174 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6175 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6176 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6177 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6178 | * revisions available in early 2006. Therefore for now allow the |
| 6179 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6180 | * that the lack of mic bias for this NID is intentional we could change the |
| 6181 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6182 | * |
| 6183 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6184 | * don't appear to make the mic bias available from the "line" jack, even |
| 6185 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6186 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6187 | * and the output jack. If this turns out to be the case for all such |
| 6188 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6189 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6190 | * |
| 6191 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6192 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6193 | * controls for such models. On models without a "mono speaker" the control |
| 6194 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6195 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6196 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6197 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6198 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6199 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6200 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6201 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6202 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6203 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6204 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6205 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6208 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6209 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6210 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6211 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6212 | { } /* end */ |
| 6213 | }; |
| 6214 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6215 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6216 | */ |
| 6217 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6218 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6219 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6220 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6221 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6222 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6223 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6224 | { } /* end */ |
| 6225 | }; |
| 6226 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6227 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6228 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6229 | */ |
| 6230 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6231 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6232 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6233 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6234 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6235 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6237 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6238 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6240 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6241 | { } /* end */ |
| 6242 | }; |
| 6243 | |
| 6244 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6245 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6246 | */ |
| 6247 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6248 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6249 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6250 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6251 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6252 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6253 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6254 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6255 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6256 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6257 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6258 | { } /* end */ |
| 6259 | }; |
| 6260 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6261 | /* |
| 6262 | * initialization verbs |
| 6263 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6264 | static struct hda_verb alc260_init_verbs[] = { |
| 6265 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6267 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6268 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6269 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6270 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6271 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6272 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6273 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6274 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6275 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6276 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6277 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6278 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6279 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6280 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6281 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6282 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6283 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6284 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6285 | /* set connection select to line in (default select for this ADC) */ |
| 6286 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6287 | /* mute capture amp left and right */ |
| 6288 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6289 | /* set connection select to line in (default select for this ADC) */ |
| 6290 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6291 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6292 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6293 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6294 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6295 | /* set vol=0 HP mixer amp left and right */ |
| 6296 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6297 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6298 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6299 | /* set vol=0 Mono mixer amp left and right */ |
| 6300 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6301 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6302 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6303 | /* unmute LINE-2 out pin */ |
| 6304 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6305 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6306 | * Line In 2 = 0x03 |
| 6307 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6308 | /* mute analog inputs */ |
| 6309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6314 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6315 | /* mute Front out path */ |
| 6316 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6317 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6318 | /* mute Headphone out path */ |
| 6319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6320 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6321 | /* mute Mono out path */ |
| 6322 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6323 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6324 | { } |
| 6325 | }; |
| 6326 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6327 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6328 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6329 | /* Headphone and output */ |
| 6330 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6331 | /* mono output */ |
| 6332 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6333 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6334 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6335 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6336 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6337 | /* Line In pin widget for input */ |
| 6338 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6339 | /* Line-2 pin widget for output */ |
| 6340 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6341 | /* CD pin widget for input */ |
| 6342 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6343 | /* unmute amp left and right */ |
| 6344 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6345 | /* set connection select to line in (default select for this ADC) */ |
| 6346 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6347 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6348 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6349 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6350 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6351 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6352 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6353 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6354 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6355 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6356 | * Line In 2 = 0x03 |
| 6357 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6358 | /* mute analog inputs */ |
| 6359 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6360 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6361 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6363 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6364 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6365 | /* Unmute Front out path */ |
| 6366 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6367 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6368 | /* Unmute Headphone out path */ |
| 6369 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6370 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6371 | /* Unmute Mono out path */ |
| 6372 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6373 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6374 | { } |
| 6375 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6376 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6377 | |
| 6378 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6379 | /* Line out and output */ |
| 6380 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6381 | /* mono output */ |
| 6382 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6383 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6384 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6385 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6386 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6387 | /* Line In pin widget for input */ |
| 6388 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6389 | /* Headphone pin widget for output */ |
| 6390 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6391 | /* CD pin widget for input */ |
| 6392 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6393 | /* unmute amp left and right */ |
| 6394 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6395 | /* set connection select to line in (default select for this ADC) */ |
| 6396 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6397 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6398 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6399 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6400 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6401 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6402 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6403 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6404 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6405 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6406 | * Line In 2 = 0x03 |
| 6407 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6408 | /* mute analog inputs */ |
| 6409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6412 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6413 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6414 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6415 | /* Unmute Front out path */ |
| 6416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6418 | /* Unmute Headphone out path */ |
| 6419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6420 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6421 | /* Unmute Mono out path */ |
| 6422 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6423 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6424 | { } |
| 6425 | }; |
| 6426 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6427 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6428 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6429 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6430 | */ |
| 6431 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6432 | /* Disable all GPIOs */ |
| 6433 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6434 | /* Internal speaker is connected to headphone pin */ |
| 6435 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6436 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6437 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6438 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6439 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6440 | /* Ensure all other unused pins are disabled and muted. */ |
| 6441 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6442 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6443 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6444 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6445 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6446 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6449 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6450 | /* Disable digital (SPDIF) pins */ |
| 6451 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6452 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6453 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6454 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6455 | * when acting as an output. |
| 6456 | */ |
| 6457 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6458 | |
| 6459 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6460 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6461 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6463 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6464 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6466 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6467 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6468 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6469 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6470 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6471 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6472 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6473 | * If the pin mode is changed by the user the pin mode control will |
| 6474 | * take care of enabling the pin's input/output buffers as needed. |
| 6475 | * Therefore there's no need to enable the input buffer at this |
| 6476 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6477 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6478 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6479 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6480 | * mixer ctrl) |
| 6481 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6482 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6483 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6484 | /* Mute capture amp left and right */ |
| 6485 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6486 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6487 | * in (on mic1 pin) |
| 6488 | */ |
| 6489 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6490 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6491 | /* Do the same for the second ADC: mute capture input amp and |
| 6492 | * set ADC connection to line in (on mic1 pin) |
| 6493 | */ |
| 6494 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6495 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6496 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6497 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6505 | {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] | 6506 | |
| 6507 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6508 | }; |
| 6509 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6510 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6511 | * similar laptops (adapted from Fujitsu init verbs). |
| 6512 | */ |
| 6513 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6514 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6515 | * the headphone jack. Turn this on and rely on the standard mute |
| 6516 | * methods whenever the user wants to turn these outputs off. |
| 6517 | */ |
| 6518 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6519 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6520 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6521 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6522 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6523 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6524 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6525 | /* Line In jack is connected to Line1 pin */ |
| 6526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6527 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6528 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6529 | /* Ensure all other unused pins are disabled and muted. */ |
| 6530 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6531 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6532 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6533 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6534 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6535 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6536 | /* Disable digital (SPDIF) pins */ |
| 6537 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6538 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6539 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6540 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6541 | * bus when acting as outputs. |
| 6542 | */ |
| 6543 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6544 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6545 | |
| 6546 | /* Start with output sum widgets muted and their output gains at min */ |
| 6547 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6548 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6551 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6552 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6553 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6554 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6555 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6556 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6557 | /* Unmute Line-out pin widget amp left and right |
| 6558 | * (no equiv mixer ctrl) |
| 6559 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6560 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6561 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6562 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6563 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6564 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6565 | * will take care of enabling the pin's input/output buffers as needed. |
| 6566 | * Therefore there's no need to enable the input buffer at this |
| 6567 | * stage. |
| 6568 | */ |
| 6569 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6570 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6571 | |
| 6572 | /* Mute capture amp left and right */ |
| 6573 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6574 | /* Set ADC connection select to match default mixer setting - mic |
| 6575 | * (on mic1 pin) |
| 6576 | */ |
| 6577 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6578 | |
| 6579 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6580 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6581 | */ |
| 6582 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6583 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6584 | |
| 6585 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6586 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6587 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6588 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6592 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6593 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6594 | |
| 6595 | { } |
| 6596 | }; |
| 6597 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6598 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6599 | * (adapted from Acer init verbs). |
| 6600 | */ |
| 6601 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6602 | /* GPIO 0 enables the output jack. |
| 6603 | * Turn this on and rely on the standard mute |
| 6604 | * methods whenever the user wants to turn these outputs off. |
| 6605 | */ |
| 6606 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6607 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6608 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6609 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6610 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6611 | /* Ensure all other unused pins are disabled and muted. */ |
| 6612 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6613 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6614 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6615 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6616 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6617 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6618 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6619 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6620 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6621 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6622 | /* Disable digital (SPDIF) pins */ |
| 6623 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6624 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6625 | |
| 6626 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6627 | * bus when acting as outputs. |
| 6628 | */ |
| 6629 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6630 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6631 | |
| 6632 | /* Start with output sum widgets muted and their output gains at min */ |
| 6633 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6634 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6635 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6636 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6637 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6639 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6640 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6641 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6642 | |
| 6643 | /* Unmute Line-out pin widget amp left and right |
| 6644 | * (no equiv mixer ctrl) |
| 6645 | */ |
| 6646 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6647 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6648 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6649 | * will take care of enabling the pin's input/output buffers as needed. |
| 6650 | * Therefore there's no need to enable the input buffer at this |
| 6651 | * stage. |
| 6652 | */ |
| 6653 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6654 | |
| 6655 | /* Mute capture amp left and right */ |
| 6656 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6657 | /* Set ADC connection select to match default mixer setting - mic |
| 6658 | * (on mic1 pin) |
| 6659 | */ |
| 6660 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6661 | |
| 6662 | /* Do similar with the second ADC: mute capture input amp and |
| 6663 | * set ADC connection to mic to match ALSA's default state. |
| 6664 | */ |
| 6665 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6666 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6667 | |
| 6668 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6669 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6670 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6671 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6674 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6676 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6677 | |
| 6678 | { } |
| 6679 | }; |
| 6680 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6681 | static struct hda_verb alc260_will_verbs[] = { |
| 6682 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6683 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6684 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6685 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6686 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6687 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6688 | {} |
| 6689 | }; |
| 6690 | |
| 6691 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6692 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6693 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6694 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6695 | |
| 6696 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6697 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6698 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6699 | |
| 6700 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6701 | {} |
| 6702 | }; |
| 6703 | |
| 6704 | /* toggle speaker-output according to the hp-jack state */ |
| 6705 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6706 | { |
| 6707 | unsigned int present; |
| 6708 | |
| 6709 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6710 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6711 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6712 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6713 | AC_VERB_SET_GPIO_DATA, 1); |
| 6714 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6715 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6716 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6717 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6718 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6719 | AC_VERB_SET_GPIO_DATA, 0); |
| 6720 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6721 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6722 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6723 | } |
| 6724 | } |
| 6725 | |
| 6726 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6727 | unsigned int res) |
| 6728 | { |
| 6729 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6730 | alc260_replacer_672v_automute(codec); |
| 6731 | } |
| 6732 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6733 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6734 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6735 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6736 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6737 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6738 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6739 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6740 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6741 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6742 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6743 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6744 | {} |
| 6745 | }; |
| 6746 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6747 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6748 | * configuration. |
| 6749 | */ |
| 6750 | #ifdef CONFIG_SND_DEBUG |
| 6751 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6752 | 0x02, |
| 6753 | }; |
| 6754 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6755 | 0x04, 0x05, |
| 6756 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6757 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6758 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6759 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6760 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6761 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6762 | { |
| 6763 | .num_items = 7, |
| 6764 | .items = { |
| 6765 | { "MIC1 pin", 0x0 }, |
| 6766 | { "MIC2 pin", 0x1 }, |
| 6767 | { "LINE1 pin", 0x2 }, |
| 6768 | { "LINE2 pin", 0x3 }, |
| 6769 | { "CD pin", 0x4 }, |
| 6770 | { "LINE-OUT pin", 0x5 }, |
| 6771 | { "HP-OUT pin", 0x6 }, |
| 6772 | }, |
| 6773 | }, |
| 6774 | { |
| 6775 | .num_items = 8, |
| 6776 | .items = { |
| 6777 | { "MIC1 pin", 0x0 }, |
| 6778 | { "MIC2 pin", 0x1 }, |
| 6779 | { "LINE1 pin", 0x2 }, |
| 6780 | { "LINE2 pin", 0x3 }, |
| 6781 | { "CD pin", 0x4 }, |
| 6782 | { "Mixer", 0x5 }, |
| 6783 | { "LINE-OUT pin", 0x6 }, |
| 6784 | { "HP-OUT pin", 0x7 }, |
| 6785 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6786 | }, |
| 6787 | }; |
| 6788 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6789 | /* Output driver widgets */ |
| 6790 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6791 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6792 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6793 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6794 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6795 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6796 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6797 | /* Modes for retasking pin widgets |
| 6798 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6799 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6800 | * mention this restriction. At this stage it's not clear whether |
| 6801 | * this behaviour is intentional or is a hardware bug in chip |
| 6802 | * revisions available at least up until early 2006. Therefore for |
| 6803 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6804 | * choices, but if it turns out that the lack of mic bias for these |
| 6805 | * NIDs is intentional we could change their modes from |
| 6806 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6807 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6808 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6809 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6810 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6811 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6812 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6813 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6814 | |
| 6815 | /* Loopback mixer controls */ |
| 6816 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6817 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6818 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6819 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6820 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6821 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6822 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6823 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6824 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6825 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6826 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6827 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6828 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6829 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6830 | |
| 6831 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6832 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6833 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6834 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6835 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6836 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6837 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6838 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6839 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6840 | */ |
| 6841 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6842 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6843 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6844 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6845 | * this output to turn on an external amplifier. |
| 6846 | */ |
| 6847 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6848 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6849 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6850 | { } /* end */ |
| 6851 | }; |
| 6852 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6853 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6854 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6855 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6856 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6857 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6858 | /* Enable retasking pins as output, initially without power amp */ |
| 6859 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6860 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6861 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6862 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6863 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6864 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6865 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6866 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6867 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6868 | * payload also sets the generation to 0, output to be in "consumer" |
| 6869 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6870 | * control. |
| 6871 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6872 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6873 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6874 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6875 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6876 | * OUT1 sum bus when acting as an output. |
| 6877 | */ |
| 6878 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6879 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6880 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6881 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6882 | |
| 6883 | /* Start with output sum widgets muted and their output gains at min */ |
| 6884 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6885 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6886 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6887 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6888 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6890 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6891 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6892 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6893 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6894 | /* Unmute retasking pin widget output buffers since the default |
| 6895 | * state appears to be output. As the pin mode is changed by the |
| 6896 | * user the pin mode control will take care of enabling the pin's |
| 6897 | * input/output buffers as needed. |
| 6898 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6899 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6900 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6902 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6903 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6904 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6905 | /* Also unmute the mono-out pin widget */ |
| 6906 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6907 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6908 | /* Mute capture amp left and right */ |
| 6909 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6910 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6911 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6912 | */ |
| 6913 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6914 | |
| 6915 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6916 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6917 | */ |
| 6918 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6919 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6920 | |
| 6921 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6922 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6923 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6924 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6925 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6926 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6927 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6930 | |
| 6931 | { } |
| 6932 | }; |
| 6933 | #endif |
| 6934 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6935 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6936 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6937 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6938 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6939 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6940 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6941 | /* |
| 6942 | * for BIOS auto-configuration |
| 6943 | */ |
| 6944 | |
| 6945 | 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] | 6946 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6947 | { |
| 6948 | hda_nid_t nid_vol; |
| 6949 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6950 | int err; |
| 6951 | |
| 6952 | if (nid >= 0x0f && nid < 0x11) { |
| 6953 | nid_vol = nid - 0x7; |
| 6954 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6955 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6956 | } else if (nid == 0x11) { |
| 6957 | nid_vol = nid - 0x7; |
| 6958 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6959 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6960 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6961 | nid_vol = 0x08; |
| 6962 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6963 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6964 | } else |
| 6965 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6966 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6967 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6968 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6969 | 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] | 6970 | if (err < 0) |
| 6971 | return err; |
| 6972 | *vol_bits |= (1 << nid_vol); |
| 6973 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6974 | 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] | 6975 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6976 | return err; |
| 6977 | return 1; |
| 6978 | } |
| 6979 | |
| 6980 | /* add playback controls from the parsed DAC table */ |
| 6981 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6982 | const struct auto_pin_cfg *cfg) |
| 6983 | { |
| 6984 | hda_nid_t nid; |
| 6985 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6986 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6987 | |
| 6988 | spec->multiout.num_dacs = 1; |
| 6989 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6990 | spec->multiout.dac_nids[0] = 0x02; |
| 6991 | |
| 6992 | nid = cfg->line_out_pins[0]; |
| 6993 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6994 | const char *pfx; |
| 6995 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6996 | pfx = "Master"; |
| 6997 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6998 | pfx = "Speaker"; |
| 6999 | else |
| 7000 | pfx = "Front"; |
| 7001 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7002 | if (err < 0) |
| 7003 | return err; |
| 7004 | } |
| 7005 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7006 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7007 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7008 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7009 | if (err < 0) |
| 7010 | return err; |
| 7011 | } |
| 7012 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7013 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7014 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7015 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 7016 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7017 | if (err < 0) |
| 7018 | return err; |
| 7019 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7020 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7021 | } |
| 7022 | |
| 7023 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7024 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7025 | const struct auto_pin_cfg *cfg) |
| 7026 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7027 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7028 | } |
| 7029 | |
| 7030 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7031 | hda_nid_t nid, int pin_type, |
| 7032 | int sel_idx) |
| 7033 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7034 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7035 | /* need the manual connection? */ |
| 7036 | if (nid >= 0x12) { |
| 7037 | int idx = nid - 0x12; |
| 7038 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7039 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7040 | } |
| 7041 | } |
| 7042 | |
| 7043 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7044 | { |
| 7045 | struct alc_spec *spec = codec->spec; |
| 7046 | hda_nid_t nid; |
| 7047 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7048 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7049 | if (nid) { |
| 7050 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7051 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7052 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7053 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7054 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7055 | if (nid) |
| 7056 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7057 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7058 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7059 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7060 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7061 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7062 | |
| 7063 | #define ALC260_PIN_CD_NID 0x16 |
| 7064 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 7065 | { |
| 7066 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7067 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7068 | int i; |
| 7069 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7070 | for (i = 0; i < cfg->num_inputs; i++) { |
| 7071 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7072 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 7073 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 7074 | if (nid != ALC260_PIN_CD_NID && |
| 7075 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7076 | snd_hda_codec_write(codec, nid, 0, |
| 7077 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7078 | AMP_OUT_MUTE); |
| 7079 | } |
| 7080 | } |
| 7081 | } |
| 7082 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7083 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7084 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7085 | /* |
| 7086 | * generic initialization of ADC, input mixers and output mixers |
| 7087 | */ |
| 7088 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7089 | /* |
| 7090 | * Unmute ADC0-1 and set the default input to mic-in |
| 7091 | */ |
| 7092 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7093 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7094 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7095 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7096 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7097 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7098 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7099 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7100 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7101 | */ |
| 7102 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7103 | /* mute analog inputs */ |
| 7104 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7106 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7109 | |
| 7110 | /* |
| 7111 | * Set up output mixers (0x08 - 0x0a) |
| 7112 | */ |
| 7113 | /* set vol=0 to output mixers */ |
| 7114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7115 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7116 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7117 | /* set up input amps for analog loopback */ |
| 7118 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7119 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7120 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7121 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7122 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7123 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7124 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7125 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7126 | { } |
| 7127 | }; |
| 7128 | |
| 7129 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7130 | { |
| 7131 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7132 | int err; |
| 7133 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7134 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7135 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7136 | alc260_ignore); |
| 7137 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7138 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7139 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7140 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7141 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7142 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7143 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7144 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7145 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7146 | return err; |
| 7147 | |
| 7148 | spec->multiout.max_channels = 2; |
| 7149 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7150 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7151 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7152 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7153 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7154 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7155 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7156 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7157 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7158 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7159 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7160 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7161 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7162 | return 1; |
| 7163 | } |
| 7164 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7165 | /* additional initialization for auto-configuration model */ |
| 7166 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7167 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7168 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7169 | alc260_auto_init_multi_out(codec); |
| 7170 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7171 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7172 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7173 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7174 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7175 | } |
| 7176 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7177 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7178 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7179 | { 0x07, HDA_INPUT, 0 }, |
| 7180 | { 0x07, HDA_INPUT, 1 }, |
| 7181 | { 0x07, HDA_INPUT, 2 }, |
| 7182 | { 0x07, HDA_INPUT, 3 }, |
| 7183 | { 0x07, HDA_INPUT, 4 }, |
| 7184 | { } /* end */ |
| 7185 | }; |
| 7186 | #endif |
| 7187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7188 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7189 | * Pin config fixes |
| 7190 | */ |
| 7191 | enum { |
| 7192 | PINFIX_HP_DC5750, |
| 7193 | }; |
| 7194 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7195 | static const struct alc_fixup alc260_fixups[] = { |
| 7196 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7197 | .type = ALC_FIXUP_PINS, |
| 7198 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7199 | { 0x11, 0x90130110 }, /* speaker */ |
| 7200 | { } |
| 7201 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7202 | }, |
| 7203 | }; |
| 7204 | |
| 7205 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7206 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7207 | {} |
| 7208 | }; |
| 7209 | |
| 7210 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7211 | * ALC260 configurations |
| 7212 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7213 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7214 | [ALC260_BASIC] = "basic", |
| 7215 | [ALC260_HP] = "hp", |
| 7216 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7217 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7218 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7219 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7220 | [ALC260_WILL] = "will", |
| 7221 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7222 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7223 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7224 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7225 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7226 | [ALC260_AUTO] = "auto", |
| 7227 | }; |
| 7228 | |
| 7229 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7230 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7231 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7232 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7233 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7234 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7235 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7236 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7237 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7238 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7239 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7240 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7241 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7242 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7243 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7244 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7245 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7246 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7247 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7248 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7249 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7250 | {} |
| 7251 | }; |
| 7252 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7253 | static struct alc_config_preset alc260_presets[] = { |
| 7254 | [ALC260_BASIC] = { |
| 7255 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7256 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7257 | .init_verbs = { alc260_init_verbs }, |
| 7258 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7259 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7260 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7261 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7262 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7263 | .channel_mode = alc260_modes, |
| 7264 | .input_mux = &alc260_capture_source, |
| 7265 | }, |
| 7266 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7267 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7268 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7269 | .init_verbs = { alc260_init_verbs, |
| 7270 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7271 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7272 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7273 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7274 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7275 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7276 | .channel_mode = alc260_modes, |
| 7277 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7278 | .unsol_event = alc_sku_unsol_event, |
| 7279 | .setup = alc260_hp_setup, |
| 7280 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7281 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7282 | [ALC260_HP_DC7600] = { |
| 7283 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7284 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7285 | .init_verbs = { alc260_init_verbs, |
| 7286 | alc260_hp_dc7600_verbs }, |
| 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 | 3f87830 | 2008-08-26 13:02:23 +0200 | [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_3012_setup, |
| 7296 | .init_hook = alc_inithook, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7297 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7298 | [ALC260_HP_3013] = { |
| 7299 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7300 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7301 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7302 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 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 | df694da | 2005-12-05 19:42:22 +0100 | [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_3013_setup, |
| 7312 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7313 | }, |
| 7314 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7315 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7316 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7317 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7318 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7319 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7320 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7321 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7322 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7323 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7324 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7325 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7326 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7327 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7328 | .init_verbs = { alc260_acer_init_verbs }, |
| 7329 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7330 | .dac_nids = alc260_dac_nids, |
| 7331 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7332 | .adc_nids = alc260_dual_adc_nids, |
| 7333 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7334 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7335 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7336 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7337 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7338 | [ALC260_FAVORIT100] = { |
| 7339 | .mixers = { alc260_favorit100_mixer }, |
| 7340 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7341 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7342 | .dac_nids = alc260_dac_nids, |
| 7343 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7344 | .adc_nids = alc260_dual_adc_nids, |
| 7345 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7346 | .channel_mode = alc260_modes, |
| 7347 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7348 | .input_mux = alc260_favorit100_capture_sources, |
| 7349 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7350 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7351 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7352 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7353 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7354 | .dac_nids = alc260_dac_nids, |
| 7355 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7356 | .adc_nids = alc260_adc_nids, |
| 7357 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7358 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7359 | .channel_mode = alc260_modes, |
| 7360 | .input_mux = &alc260_capture_source, |
| 7361 | }, |
| 7362 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7363 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7364 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7365 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7366 | .dac_nids = alc260_dac_nids, |
| 7367 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7368 | .adc_nids = alc260_adc_nids, |
| 7369 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7370 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7371 | .channel_mode = alc260_modes, |
| 7372 | .input_mux = &alc260_capture_source, |
| 7373 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7374 | .init_hook = alc260_replacer_672v_automute, |
| 7375 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7376 | #ifdef CONFIG_SND_DEBUG |
| 7377 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7378 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7379 | .init_verbs = { alc260_test_init_verbs }, |
| 7380 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7381 | .dac_nids = alc260_test_dac_nids, |
| 7382 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7383 | .adc_nids = alc260_test_adc_nids, |
| 7384 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7385 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7386 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7387 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7388 | }, |
| 7389 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7390 | }; |
| 7391 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7392 | static int patch_alc260(struct hda_codec *codec) |
| 7393 | { |
| 7394 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7395 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7396 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7397 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7398 | if (spec == NULL) |
| 7399 | return -ENOMEM; |
| 7400 | |
| 7401 | codec->spec = spec; |
| 7402 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7403 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7404 | alc260_models, |
| 7405 | alc260_cfg_tbl); |
| 7406 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7407 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7408 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7409 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7410 | } |
| 7411 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7412 | if (board_config == ALC260_AUTO) { |
| 7413 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7414 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7415 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7416 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7417 | if (board_config == ALC260_AUTO) { |
| 7418 | /* automatic parse from the BIOS config */ |
| 7419 | err = alc260_parse_auto_config(codec); |
| 7420 | if (err < 0) { |
| 7421 | alc_free(codec); |
| 7422 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7423 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7424 | printk(KERN_INFO |
| 7425 | "hda_codec: Cannot set up configuration " |
| 7426 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7427 | board_config = ALC260_BASIC; |
| 7428 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7429 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7430 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7431 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7432 | if (err < 0) { |
| 7433 | alc_free(codec); |
| 7434 | return err; |
| 7435 | } |
| 7436 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7437 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7438 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7439 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7440 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7441 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7442 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7443 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7444 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7445 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7446 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7447 | if (!spec->adc_nids && spec->input_mux) { |
| 7448 | /* check whether NID 0x04 is valid */ |
| 7449 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7450 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7451 | /* get type */ |
| 7452 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7453 | spec->adc_nids = alc260_adc_nids_alt; |
| 7454 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7455 | } else { |
| 7456 | spec->adc_nids = alc260_adc_nids; |
| 7457 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7458 | } |
| 7459 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7460 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7461 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7462 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7463 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7464 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7465 | spec->vmaster_nid = 0x08; |
| 7466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7467 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7468 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7469 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 7470 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7471 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7472 | if (!spec->loopback.amplist) |
| 7473 | spec->loopback.amplist = alc260_loopbacks; |
| 7474 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7475 | |
| 7476 | return 0; |
| 7477 | } |
| 7478 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7479 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7480 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7481 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7482 | * |
| 7483 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7484 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7485 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7486 | * 6-channel independent captures. |
| 7487 | * |
| 7488 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7489 | * driver yet). |
| 7490 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7491 | #define ALC882_DIGOUT_NID 0x06 |
| 7492 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7493 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7494 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7495 | #define ALC1200_DIGOUT_NID 0x10 |
| 7496 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7497 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7498 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7499 | { 8, NULL } |
| 7500 | }; |
| 7501 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7502 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7503 | static hda_nid_t alc882_dac_nids[4] = { |
| 7504 | /* front, rear, clfe, rear_surr */ |
| 7505 | 0x02, 0x03, 0x04, 0x05 |
| 7506 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7507 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7508 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7509 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7510 | #define alc882_adc_nids alc880_adc_nids |
| 7511 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7512 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7513 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7514 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7515 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7516 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7517 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7518 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7519 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7520 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7521 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7522 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7523 | /* input MUX */ |
| 7524 | /* FIXME: should be a matrix-type input source selection */ |
| 7525 | |
| 7526 | static struct hda_input_mux alc882_capture_source = { |
| 7527 | .num_items = 4, |
| 7528 | .items = { |
| 7529 | { "Mic", 0x0 }, |
| 7530 | { "Front Mic", 0x1 }, |
| 7531 | { "Line", 0x2 }, |
| 7532 | { "CD", 0x4 }, |
| 7533 | }, |
| 7534 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7535 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7536 | #define alc883_capture_source alc882_capture_source |
| 7537 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7538 | static struct hda_input_mux alc889_capture_source = { |
| 7539 | .num_items = 3, |
| 7540 | .items = { |
| 7541 | { "Front Mic", 0x0 }, |
| 7542 | { "Mic", 0x3 }, |
| 7543 | { "Line", 0x2 }, |
| 7544 | }, |
| 7545 | }; |
| 7546 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7547 | static struct hda_input_mux mb5_capture_source = { |
| 7548 | .num_items = 3, |
| 7549 | .items = { |
| 7550 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7551 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7552 | { "CD", 0x4 }, |
| 7553 | }, |
| 7554 | }; |
| 7555 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7556 | static struct hda_input_mux macmini3_capture_source = { |
| 7557 | .num_items = 2, |
| 7558 | .items = { |
| 7559 | { "Line", 0x2 }, |
| 7560 | { "CD", 0x4 }, |
| 7561 | }, |
| 7562 | }; |
| 7563 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7564 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7565 | .num_items = 4, |
| 7566 | .items = { |
| 7567 | { "Mic", 0x1 }, |
| 7568 | { "Front Mic", 0x0 }, |
| 7569 | { "Line", 0x2 }, |
| 7570 | { "CD", 0x4 }, |
| 7571 | }, |
| 7572 | }; |
| 7573 | |
| 7574 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7575 | .num_items = 2, |
| 7576 | .items = { |
| 7577 | { "Mic", 0x1 }, |
| 7578 | { "Line", 0x2 }, |
| 7579 | }, |
| 7580 | }; |
| 7581 | |
| 7582 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7583 | .num_items = 4, |
| 7584 | .items = { |
| 7585 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7586 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7587 | { "Line", 0x2 }, |
| 7588 | { "CD", 0x4 }, |
| 7589 | }, |
| 7590 | }; |
| 7591 | |
| 7592 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7593 | .num_items = 2, |
| 7594 | .items = { |
| 7595 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7596 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7597 | }, |
| 7598 | }; |
| 7599 | |
| 7600 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7601 | .num_items = 3, |
| 7602 | .items = { |
| 7603 | { "Mic", 0x0 }, |
| 7604 | { "Front Mic", 0x1 }, |
| 7605 | { "Line", 0x4 }, |
| 7606 | }, |
| 7607 | }; |
| 7608 | |
| 7609 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7610 | .num_items = 2, |
| 7611 | .items = { |
| 7612 | { "Mic", 0x0 }, |
| 7613 | { "Line", 0x2 }, |
| 7614 | }, |
| 7615 | }; |
| 7616 | |
| 7617 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7618 | .num_items = 2, |
| 7619 | .items = { |
| 7620 | { "Mic", 0x0 }, |
| 7621 | /* Front Mic (0x01) unused */ |
| 7622 | { "Line", 0x2 }, |
| 7623 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7624 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7625 | }, |
| 7626 | }; |
| 7627 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7628 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7629 | .num_items = 2, |
| 7630 | .items = { |
| 7631 | { "Mic", 0x01 }, |
| 7632 | { "Line", 0x2 }, /* Not sure! */ |
| 7633 | }, |
| 7634 | }; |
| 7635 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7636 | /* |
| 7637 | * 2ch mode |
| 7638 | */ |
| 7639 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7640 | { 2, NULL } |
| 7641 | }; |
| 7642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7643 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7644 | * 2ch mode |
| 7645 | */ |
| 7646 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7647 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7648 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7649 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7650 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7651 | { } /* end */ |
| 7652 | }; |
| 7653 | |
| 7654 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7655 | * 4ch mode |
| 7656 | */ |
| 7657 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7658 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7659 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7660 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7661 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7662 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7663 | { } /* end */ |
| 7664 | }; |
| 7665 | |
| 7666 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7667 | * 6ch mode |
| 7668 | */ |
| 7669 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7670 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7671 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7672 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7673 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7674 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7675 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7676 | { } /* end */ |
| 7677 | }; |
| 7678 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7679 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7680 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7681 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7682 | { 6, alc882_3ST_ch6_init }, |
| 7683 | }; |
| 7684 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7685 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7686 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7687 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7688 | * 2ch mode |
| 7689 | */ |
| 7690 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7691 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7692 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7693 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7694 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7695 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7696 | { } /* end */ |
| 7697 | }; |
| 7698 | |
| 7699 | /* |
| 7700 | * 4ch mode |
| 7701 | */ |
| 7702 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7703 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7704 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7705 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7706 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7707 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7708 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7709 | { } /* end */ |
| 7710 | }; |
| 7711 | |
| 7712 | /* |
| 7713 | * 6ch mode |
| 7714 | */ |
| 7715 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7716 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7717 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7718 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7719 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7720 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7721 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7722 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7723 | { } /* end */ |
| 7724 | }; |
| 7725 | |
| 7726 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7727 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7728 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7729 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7730 | }; |
| 7731 | |
| 7732 | |
| 7733 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7734 | * 6ch mode |
| 7735 | */ |
| 7736 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7737 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7738 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7739 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7740 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7741 | { } /* end */ |
| 7742 | }; |
| 7743 | |
| 7744 | /* |
| 7745 | * 8ch mode |
| 7746 | */ |
| 7747 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7748 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7749 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7750 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7751 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7752 | { } /* end */ |
| 7753 | }; |
| 7754 | |
| 7755 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7756 | { 6, alc882_sixstack_ch6_init }, |
| 7757 | { 8, alc882_sixstack_ch8_init }, |
| 7758 | }; |
| 7759 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7760 | |
| 7761 | /* Macbook Air 2,1 */ |
| 7762 | |
| 7763 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7764 | { 2, NULL }, |
| 7765 | }; |
| 7766 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7767 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7768 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7769 | */ |
| 7770 | |
| 7771 | /* |
| 7772 | * 2ch mode |
| 7773 | */ |
| 7774 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7775 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7776 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7777 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7778 | { } /* end */ |
| 7779 | }; |
| 7780 | |
| 7781 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7782 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7783 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7784 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7785 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7786 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7787 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7788 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7789 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7790 | { } /* end */ |
| 7791 | }; |
| 7792 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7793 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7794 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7795 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7796 | }; |
| 7797 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7798 | /* |
| 7799 | * 2ch |
| 7800 | * Speakers/Woofer/HP = Front |
| 7801 | * LineIn = Input |
| 7802 | */ |
| 7803 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7805 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7806 | { } /* end */ |
| 7807 | }; |
| 7808 | |
| 7809 | /* |
| 7810 | * 6ch mode |
| 7811 | * Speakers/HP = Front |
| 7812 | * Woofer = LFE |
| 7813 | * LineIn = Surround |
| 7814 | */ |
| 7815 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7818 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7819 | { } /* end */ |
| 7820 | }; |
| 7821 | |
| 7822 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7823 | { 2, alc885_mb5_ch2_init }, |
| 7824 | { 6, alc885_mb5_ch6_init }, |
| 7825 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7826 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7827 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7828 | |
| 7829 | /* |
| 7830 | * 2ch mode |
| 7831 | */ |
| 7832 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7833 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7834 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7835 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7836 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7837 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7838 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7839 | { } /* end */ |
| 7840 | }; |
| 7841 | |
| 7842 | /* |
| 7843 | * 4ch mode |
| 7844 | */ |
| 7845 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7846 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7847 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7848 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7849 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7850 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7851 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7852 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7853 | { } /* end */ |
| 7854 | }; |
| 7855 | |
| 7856 | /* |
| 7857 | * 6ch mode |
| 7858 | */ |
| 7859 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7860 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7861 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7862 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7863 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7864 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7865 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7866 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7867 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7868 | { } /* end */ |
| 7869 | }; |
| 7870 | |
| 7871 | /* |
| 7872 | * 8ch mode |
| 7873 | */ |
| 7874 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7875 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7876 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7877 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7878 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7879 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7880 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7881 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7882 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7883 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7884 | { } /* end */ |
| 7885 | }; |
| 7886 | |
| 7887 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7888 | { 2, alc883_4ST_ch2_init }, |
| 7889 | { 4, alc883_4ST_ch4_init }, |
| 7890 | { 6, alc883_4ST_ch6_init }, |
| 7891 | { 8, alc883_4ST_ch8_init }, |
| 7892 | }; |
| 7893 | |
| 7894 | |
| 7895 | /* |
| 7896 | * 2ch mode |
| 7897 | */ |
| 7898 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7899 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7900 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7901 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7902 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7903 | { } /* end */ |
| 7904 | }; |
| 7905 | |
| 7906 | /* |
| 7907 | * 4ch mode |
| 7908 | */ |
| 7909 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7910 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7911 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7912 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7913 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7914 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7915 | { } /* end */ |
| 7916 | }; |
| 7917 | |
| 7918 | /* |
| 7919 | * 6ch mode |
| 7920 | */ |
| 7921 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7922 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7923 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7924 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7925 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7926 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7927 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7928 | { } /* end */ |
| 7929 | }; |
| 7930 | |
| 7931 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7932 | { 2, alc883_3ST_ch2_intel_init }, |
| 7933 | { 4, alc883_3ST_ch4_intel_init }, |
| 7934 | { 6, alc883_3ST_ch6_intel_init }, |
| 7935 | }; |
| 7936 | |
| 7937 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7938 | * 2ch mode |
| 7939 | */ |
| 7940 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7941 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7942 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7943 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7944 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7945 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7946 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7947 | { } /* end */ |
| 7948 | }; |
| 7949 | |
| 7950 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7951 | * 6ch mode |
| 7952 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7953 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7954 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7955 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7956 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7957 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7958 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7959 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7960 | { } /* end */ |
| 7961 | }; |
| 7962 | |
| 7963 | /* |
| 7964 | * 8ch mode |
| 7965 | */ |
| 7966 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7967 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7968 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7969 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7970 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7971 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7972 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7973 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7974 | { } /* end */ |
| 7975 | }; |
| 7976 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7977 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7978 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7979 | { 6, alc889_ch6_intel_init }, |
| 7980 | { 8, alc889_ch8_intel_init }, |
| 7981 | }; |
| 7982 | |
| 7983 | /* |
| 7984 | * 6ch mode |
| 7985 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7986 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7987 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7988 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7989 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7990 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7991 | { } /* end */ |
| 7992 | }; |
| 7993 | |
| 7994 | /* |
| 7995 | * 8ch mode |
| 7996 | */ |
| 7997 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7998 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7999 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8000 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8001 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8002 | { } /* end */ |
| 8003 | }; |
| 8004 | |
| 8005 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 8006 | { 6, alc883_sixstack_ch6_init }, |
| 8007 | { 8, alc883_sixstack_ch8_init }, |
| 8008 | }; |
| 8009 | |
| 8010 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8011 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 8012 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 8013 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 8014 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8015 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8016 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8017 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8018 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8019 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8020 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8021 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8022 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8023 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8024 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8025 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8026 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8027 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8028 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8029 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8031 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8032 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8033 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8034 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8035 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8036 | { } /* end */ |
| 8037 | }; |
| 8038 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8039 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8040 | |
| 8041 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 8042 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8043 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8044 | { } |
| 8045 | }; |
| 8046 | |
| 8047 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8048 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8049 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8050 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8051 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8052 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8053 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8054 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8055 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8056 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8057 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8058 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8060 | { } /* end */ |
| 8061 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8062 | |
| 8063 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8065 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8066 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8067 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8068 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8069 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8070 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8071 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8072 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8073 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8075 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8076 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8077 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8078 | { } /* end */ |
| 8079 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8080 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8081 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 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), |
| 8088 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8089 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8090 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8091 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8092 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8093 | { } /* end */ |
| 8094 | }; |
| 8095 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8096 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8097 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8098 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8099 | { } /* end */ |
| 8100 | }; |
| 8101 | |
| 8102 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8103 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8104 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8105 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8108 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8109 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8111 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8113 | { } /* end */ |
| 8114 | }; |
| 8115 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8116 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8118 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8119 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8120 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8121 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8122 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8123 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8126 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8127 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8128 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8129 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8130 | { } /* end */ |
| 8131 | }; |
| 8132 | |
| 8133 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8134 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8135 | */ |
| 8136 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8137 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8138 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8139 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8140 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8141 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8142 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8143 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8144 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8145 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8146 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8147 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8148 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8149 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8150 | { } /* end */ |
| 8151 | }; |
| 8152 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8153 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8154 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8155 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8156 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8157 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8158 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8159 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8160 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8161 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8162 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8164 | { } /* end */ |
| 8165 | }; |
| 8166 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8167 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8168 | { |
| 8169 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8170 | .name = "Channel Mode", |
| 8171 | .info = alc_ch_mode_info, |
| 8172 | .get = alc_ch_mode_get, |
| 8173 | .put = alc_ch_mode_put, |
| 8174 | }, |
| 8175 | { } /* end */ |
| 8176 | }; |
| 8177 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8178 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8179 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8180 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8181 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8182 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8183 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8184 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8185 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8186 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8187 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8188 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8189 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8190 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8191 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8192 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8194 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8195 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8196 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8197 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8198 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8199 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8200 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8201 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8202 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8203 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8204 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8205 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8206 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8207 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8208 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8209 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8210 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8211 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8212 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8213 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8214 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8215 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8216 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8217 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8219 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8220 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8221 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8222 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8223 | |
| 8224 | /* FIXME: use matrix-type input source selection */ |
| 8225 | /* 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] | 8226 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8227 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8228 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8229 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8230 | /* ADC2: mute amp left and right */ |
| 8231 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8232 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8233 | /* ADC3: mute amp left and right */ |
| 8234 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8235 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8236 | |
| 8237 | { } |
| 8238 | }; |
| 8239 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8240 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8241 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8242 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8243 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8245 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8246 | /* ADC1: mute amp left and right */ |
| 8247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8248 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8249 | { } |
| 8250 | }; |
| 8251 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8252 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8253 | /* change to EAPD mode */ |
| 8254 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8255 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8256 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8257 | }; |
| 8258 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8259 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8260 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8261 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8262 | { } |
| 8263 | }; |
| 8264 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8265 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8266 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8268 | {} |
| 8269 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8270 | |
| 8271 | static struct hda_verb alc885_init_verbs[] = { |
| 8272 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8273 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8274 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8275 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8276 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8277 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8278 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8279 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8280 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8281 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8283 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8284 | |
| 8285 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8289 | /* Front Pin: output 0 (0x0c) */ |
| 8290 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8291 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8292 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8293 | /* Rear Pin: output 1 (0x0d) */ |
| 8294 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8295 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8296 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8297 | /* CLFE Pin: output 2 (0x0e) */ |
| 8298 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8299 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8300 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8301 | /* Side Pin: output 3 (0x0f) */ |
| 8302 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8303 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8304 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8305 | /* Mic (rear) pin: input vref at 80% */ |
| 8306 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8307 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8308 | /* Front Mic pin: input vref at 80% */ |
| 8309 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8311 | /* Line In pin: input */ |
| 8312 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8313 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8314 | |
| 8315 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8316 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8317 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8318 | /* Input mixer2 */ |
| 8319 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8320 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8321 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8322 | /* ADC2: mute amp left and right */ |
| 8323 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8324 | /* ADC3: mute amp left and right */ |
| 8325 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8326 | |
| 8327 | { } |
| 8328 | }; |
| 8329 | |
| 8330 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8331 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8332 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8334 | { } |
| 8335 | }; |
| 8336 | |
| 8337 | |
| 8338 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8339 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8340 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8342 | { } |
| 8343 | }; |
| 8344 | |
| 8345 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8346 | #define alc883_init_verbs alc882_base_init_verbs |
| 8347 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8348 | /* Mac Pro test */ |
| 8349 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8350 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8351 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8354 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8355 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8356 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8357 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8358 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8359 | { } /* end */ |
| 8360 | }; |
| 8361 | |
| 8362 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8363 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8364 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8365 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8367 | /* Front Pin: output 0 (0x0c) */ |
| 8368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8371 | /* Front Mic pin: input vref at 80% */ |
| 8372 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8373 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8374 | /* Speaker: output */ |
| 8375 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8376 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8377 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8378 | /* Headphone output (output 0 - 0x0c) */ |
| 8379 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8380 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8381 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8382 | |
| 8383 | /* FIXME: use matrix-type input source selection */ |
| 8384 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8385 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8386 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8389 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8390 | /* Input mixer2 */ |
| 8391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8395 | /* Input mixer3 */ |
| 8396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8400 | /* ADC1: mute amp left and right */ |
| 8401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8402 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8403 | /* ADC2: mute amp left and right */ |
| 8404 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8405 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8406 | /* ADC3: mute amp left and right */ |
| 8407 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8408 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8409 | |
| 8410 | { } |
| 8411 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8412 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8413 | /* Macbook 5,1 */ |
| 8414 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8415 | /* DACs */ |
| 8416 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8417 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8418 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8419 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8420 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8424 | /* Surround mixer */ |
| 8425 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8426 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8427 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8428 | /* LFE mixer */ |
| 8429 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8430 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8431 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8432 | /* HP mixer */ |
| 8433 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8434 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8435 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8436 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8437 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8439 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8440 | /* LFE Pin (0x0e) */ |
| 8441 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8442 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8443 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8444 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8445 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8446 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8447 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8448 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8449 | /* Front Mic pin: input vref at 80% */ |
| 8450 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8451 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8452 | /* Line In pin */ |
| 8453 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8454 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8455 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8459 | { } |
| 8460 | }; |
| 8461 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8462 | /* Macmini 3,1 */ |
| 8463 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8464 | /* DACs */ |
| 8465 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8466 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8467 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8468 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8469 | /* Front mixer */ |
| 8470 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8473 | /* Surround mixer */ |
| 8474 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8475 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8476 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8477 | /* LFE mixer */ |
| 8478 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8479 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8480 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8481 | /* HP mixer */ |
| 8482 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8483 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8484 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8485 | /* Front Pin (0x0c) */ |
| 8486 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8487 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8488 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8489 | /* LFE Pin (0x0e) */ |
| 8490 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8491 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8492 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8493 | /* HP Pin (0x0f) */ |
| 8494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8495 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8496 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8497 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8498 | /* Line In pin */ |
| 8499 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8501 | |
| 8502 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8503 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8504 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8505 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8506 | { } |
| 8507 | }; |
| 8508 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8509 | |
| 8510 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8511 | /*Internal and HP Speaker Mixer*/ |
| 8512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8514 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8515 | /*Internal Speaker Pin (0x0c)*/ |
| 8516 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8517 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8518 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8519 | /* HP Pin: output 0 (0x0e) */ |
| 8520 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8521 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8522 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8523 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8524 | /* Line in (is hp when jack connected)*/ |
| 8525 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8526 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8527 | |
| 8528 | { } |
| 8529 | }; |
| 8530 | |
| 8531 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8532 | /* Macbook Pro rev3 */ |
| 8533 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8534 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8537 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8538 | /* Rear mixer */ |
| 8539 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8540 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8541 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8542 | /* HP mixer */ |
| 8543 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8544 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8545 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8546 | /* Front Pin: output 0 (0x0c) */ |
| 8547 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8548 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8549 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8550 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8553 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8554 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8555 | /* Mic (rear) pin: input vref at 80% */ |
| 8556 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8557 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8558 | /* Front Mic pin: input vref at 80% */ |
| 8559 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8560 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8561 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8562 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8563 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8564 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8565 | |
| 8566 | /* FIXME: use matrix-type input source selection */ |
| 8567 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8568 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8569 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8570 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8571 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8572 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8573 | /* Input mixer2 */ |
| 8574 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8575 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8577 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8578 | /* Input mixer3 */ |
| 8579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8583 | /* ADC1: mute amp left and right */ |
| 8584 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8585 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8586 | /* ADC2: mute amp left and right */ |
| 8587 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8588 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8589 | /* ADC3: mute amp left and right */ |
| 8590 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8591 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8592 | |
| 8593 | { } |
| 8594 | }; |
| 8595 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8596 | /* iMac 9,1 */ |
| 8597 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8598 | /* Internal Speaker Pin (0x0c) */ |
| 8599 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8600 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8601 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8602 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8603 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8604 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8605 | /* HP Pin: Rear */ |
| 8606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8608 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8609 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8610 | /* Line in Rear */ |
| 8611 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8612 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8613 | /* Front Mic pin: input vref at 80% */ |
| 8614 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8615 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8616 | /* Rear mixer */ |
| 8617 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8618 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8620 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8621 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8622 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8623 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8624 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8625 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8626 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8627 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8629 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8630 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8631 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8632 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8634 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8635 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8637 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8639 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8640 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8641 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8642 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8643 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8644 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8645 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8646 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8647 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8648 | { } |
| 8649 | }; |
| 8650 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8651 | /* iMac 24 mixer. */ |
| 8652 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8653 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8654 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8655 | { } /* end */ |
| 8656 | }; |
| 8657 | |
| 8658 | /* iMac 24 init verbs. */ |
| 8659 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8660 | /* Internal speakers: output 0 (0x0c) */ |
| 8661 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8662 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8663 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8664 | /* Internal speakers: output 0 (0x0c) */ |
| 8665 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8666 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8667 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8668 | /* Headphone: output 0 (0x0c) */ |
| 8669 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8670 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8671 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8672 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8673 | /* Front Mic: input vref at 80% */ |
| 8674 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8675 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8676 | { } |
| 8677 | }; |
| 8678 | |
| 8679 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8680 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8681 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8682 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8683 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8684 | spec->autocfg.hp_pins[0] = 0x14; |
| 8685 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8686 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8687 | spec->automute = 1; |
| 8688 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8689 | } |
| 8690 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8691 | #define alc885_mb5_setup alc885_imac24_setup |
| 8692 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8693 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8694 | /* Macbook Air 2,1 */ |
| 8695 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8696 | { |
| 8697 | struct alc_spec *spec = codec->spec; |
| 8698 | |
| 8699 | spec->autocfg.hp_pins[0] = 0x14; |
| 8700 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8701 | spec->automute = 1; |
| 8702 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8703 | } |
| 8704 | |
| 8705 | |
| 8706 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8707 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8708 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8709 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8710 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8711 | spec->autocfg.hp_pins[0] = 0x15; |
| 8712 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8713 | spec->automute = 1; |
| 8714 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8715 | } |
| 8716 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8717 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8718 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8719 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8720 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8721 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8722 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8723 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8724 | spec->automute = 1; |
| 8725 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8726 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8727 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8728 | static struct hda_verb alc882_targa_verbs[] = { |
| 8729 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8730 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8731 | |
| 8732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8733 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8734 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8735 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8736 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8737 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8738 | |
| 8739 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8740 | { } /* end */ |
| 8741 | }; |
| 8742 | |
| 8743 | /* toggle speaker-output according to the hp-jack state */ |
| 8744 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8745 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8746 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8747 | alc_hp_automute(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8748 | 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] | 8749 | spec->jack_present ? 1 : 3); |
| 8750 | } |
| 8751 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8752 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8753 | { |
| 8754 | struct alc_spec *spec = codec->spec; |
| 8755 | |
| 8756 | spec->autocfg.hp_pins[0] = 0x14; |
| 8757 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8758 | spec->automute = 1; |
| 8759 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8760 | } |
| 8761 | |
| 8762 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8763 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8764 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8765 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8766 | } |
| 8767 | |
| 8768 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8769 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8770 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8771 | |
| 8772 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8773 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8774 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8775 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8776 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8777 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8778 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8779 | |
| 8780 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8781 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8782 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8783 | { } /* end */ |
| 8784 | }; |
| 8785 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8786 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 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 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +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 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8804 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8805 | { |
| 8806 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8807 | |
| 8808 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8809 | AC_VERB_GET_GPIO_DATA, 0); |
| 8810 | |
| 8811 | if (!muted) |
| 8812 | gpiostate |= (1 << pin); |
| 8813 | else |
| 8814 | gpiostate &= ~(1 << pin); |
| 8815 | |
| 8816 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8817 | AC_VERB_GET_GPIO_MASK, 0); |
| 8818 | gpiomask |= (1 << pin); |
| 8819 | |
| 8820 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8821 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8822 | gpiodir |= (1 << pin); |
| 8823 | |
| 8824 | |
| 8825 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8826 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8827 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8828 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8829 | |
| 8830 | msleep(1); |
| 8831 | |
| 8832 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8833 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8834 | } |
| 8835 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8836 | /* set up GPIO at initialization */ |
| 8837 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8838 | { |
| 8839 | alc882_gpio_mute(codec, 0, 0); |
| 8840 | alc882_gpio_mute(codec, 1, 0); |
| 8841 | } |
| 8842 | |
| 8843 | /* set up GPIO and update auto-muting at initialization */ |
| 8844 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8845 | { |
| 8846 | alc885_macpro_init_hook(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8847 | alc_hp_automute(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8848 | } |
| 8849 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8850 | /* |
| 8851 | * generic initialization of ADC, input mixers and output mixers |
| 8852 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8853 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8854 | /* |
| 8855 | * Unmute ADC0-2 and set the default input to mic-in |
| 8856 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8857 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8859 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8860 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8862 | /* |
| 8863 | * Set up output mixers (0x0c - 0x0f) |
| 8864 | */ |
| 8865 | /* set vol=0 to output mixers */ |
| 8866 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8867 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8868 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8869 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8870 | /* set up input amps for analog loopback */ |
| 8871 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8872 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8873 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8874 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8875 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8876 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8877 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8878 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8879 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8880 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8881 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8882 | |
| 8883 | /* FIXME: use matrix-type input source selection */ |
| 8884 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8885 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8886 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8887 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8889 | { } |
| 8890 | }; |
| 8891 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8892 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8893 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8894 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8895 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8896 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8897 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8898 | { } /* end */ |
| 8899 | }; |
| 8900 | |
| 8901 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8902 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8903 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8904 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8905 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8906 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8907 | { } /* end */ |
| 8908 | }; |
| 8909 | |
| 8910 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8911 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8912 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8913 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8914 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8915 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8916 | { } /* end */ |
| 8917 | }; |
| 8918 | |
| 8919 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8920 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8921 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8922 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8923 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8924 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8925 | { } /* end */ |
| 8926 | }; |
| 8927 | |
| 8928 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8929 | { 2, alc889A_mb31_ch2_init }, |
| 8930 | { 4, alc889A_mb31_ch4_init }, |
| 8931 | { 5, alc889A_mb31_ch5_init }, |
| 8932 | { 6, alc889A_mb31_ch6_init }, |
| 8933 | }; |
| 8934 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8935 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8936 | /* eanable EAPD on medion laptop */ |
| 8937 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8938 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8939 | { } |
| 8940 | }; |
| 8941 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8942 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8943 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8944 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8945 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8946 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8947 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8948 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8949 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8950 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8952 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8953 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8954 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8955 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8956 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8957 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8958 | { } /* end */ |
| 8959 | }; |
| 8960 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8961 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8962 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8963 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8964 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8965 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8966 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8967 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8968 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8969 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8970 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8971 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8972 | { } /* end */ |
| 8973 | }; |
| 8974 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8975 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8976 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8977 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8978 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8979 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8980 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8981 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8982 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8983 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8984 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8985 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8986 | { } /* end */ |
| 8987 | }; |
| 8988 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8989 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8991 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8992 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8993 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8994 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8998 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8999 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9000 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9001 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9002 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9003 | { } /* end */ |
| 9004 | }; |
| 9005 | |
| 9006 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 9007 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9008 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9009 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9010 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9011 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, 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", 0x1b, 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, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9021 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9022 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9023 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9024 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9025 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9026 | { } /* end */ |
| 9027 | }; |
| 9028 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9029 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 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_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9040 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9041 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 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, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9045 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, 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), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9049 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9050 | { } /* end */ |
| 9051 | }; |
| 9052 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9053 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 9054 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9055 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9056 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9057 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9058 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9059 | HDA_OUTPUT), |
| 9060 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9061 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9062 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9063 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9064 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9065 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9066 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9067 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9069 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9070 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9071 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9072 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9073 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9074 | { } /* end */ |
| 9075 | }; |
| 9076 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9077 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9078 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9079 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9080 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9081 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9082 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9083 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9084 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9085 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9086 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 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), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9094 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9095 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9096 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9097 | { } /* end */ |
| 9098 | }; |
| 9099 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9100 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9101 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9102 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9103 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9104 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9105 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9106 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9107 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9108 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9109 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9110 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9111 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9112 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9113 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9114 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9116 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9118 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9119 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9120 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9121 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9122 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9123 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9124 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9125 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, 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 | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9131 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9132 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9133 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9134 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9135 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9136 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9137 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9138 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9139 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9140 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9141 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9142 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9143 | { } /* end */ |
| 9144 | }; |
| 9145 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9146 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9147 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9148 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9149 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9150 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9151 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9153 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9154 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9155 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9156 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9157 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9158 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9159 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9160 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9162 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9163 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9164 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9165 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9166 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9167 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9168 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9169 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9170 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9171 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9173 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9174 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9175 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9176 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9177 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9178 | { } /* end */ |
| 9179 | }; |
| 9180 | |
| 9181 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9182 | /* Unmute front mixer */ |
| 9183 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9184 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9185 | |
| 9186 | /* Set speaker pin to front mixer */ |
| 9187 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9188 | |
| 9189 | /* Init headphone pin */ |
| 9190 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9191 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9192 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9193 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9194 | |
| 9195 | { } /* end */ |
| 9196 | }; |
| 9197 | |
| 9198 | /* toggle speaker-output according to the hp-jack state */ |
| 9199 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9200 | { |
| 9201 | struct alc_spec *spec = codec->spec; |
| 9202 | |
| 9203 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9204 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9205 | spec->automute = 1; |
| 9206 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9207 | } |
| 9208 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9209 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9210 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9211 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9212 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9214 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9216 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9218 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9219 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9220 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9221 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9222 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9223 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9225 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9226 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9227 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9228 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9229 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9230 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9231 | { } /* end */ |
| 9232 | }; |
| 9233 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9234 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9235 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9236 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9237 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9238 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9239 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9240 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9241 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9242 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9243 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9244 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9245 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9246 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9247 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9248 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9249 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9250 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9251 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9252 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9253 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9254 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9255 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9256 | { } /* end */ |
| 9257 | }; |
| 9258 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9259 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9260 | /* Output mixers */ |
| 9261 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9262 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9263 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9264 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9265 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9266 | HDA_OUTPUT), |
| 9267 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9268 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9269 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9270 | /* Output switches */ |
| 9271 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9272 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9273 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9274 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9275 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9276 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9277 | /* Input mixers */ |
| 9278 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9279 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9280 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9281 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9282 | { } /* end */ |
| 9283 | }; |
| 9284 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9285 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9287 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9288 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9290 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9291 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9292 | { } /* end */ |
| 9293 | }; |
| 9294 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9295 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9296 | .ops = &snd_hda_bind_vol, |
| 9297 | .values = { |
| 9298 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9299 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9300 | 0 |
| 9301 | }, |
| 9302 | }; |
| 9303 | |
| 9304 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9305 | .ops = &snd_hda_bind_sw, |
| 9306 | .values = { |
| 9307 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9308 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9309 | 0 |
| 9310 | }, |
| 9311 | }; |
| 9312 | |
| 9313 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9314 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9315 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9316 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9317 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9318 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9320 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9321 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9322 | { } /* end */ |
| 9323 | }; |
| 9324 | |
| 9325 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9326 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9327 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9328 | { |
| 9329 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9330 | /* .name = "Capture Source", */ |
| 9331 | .name = "Input Source", |
| 9332 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9333 | .info = alc_mux_enum_info, |
| 9334 | .get = alc_mux_enum_get, |
| 9335 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9336 | }, |
| 9337 | { } /* end */ |
| 9338 | }; |
| 9339 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9340 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9341 | { |
| 9342 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9343 | .name = "Channel Mode", |
| 9344 | .info = alc_ch_mode_info, |
| 9345 | .get = alc_ch_mode_get, |
| 9346 | .put = alc_ch_mode_put, |
| 9347 | }, |
| 9348 | { } /* end */ |
| 9349 | }; |
| 9350 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9351 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9352 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9353 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9354 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9355 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9356 | spec->autocfg.hp_pins[0] = 0x15; |
| 9357 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9358 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9359 | spec->automute = 1; |
| 9360 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9361 | } |
| 9362 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9363 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9364 | /* HP */ |
| 9365 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9367 | /* Subwoofer */ |
| 9368 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9369 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9370 | |
| 9371 | /* enable unsolicited event */ |
| 9372 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9373 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9374 | |
| 9375 | { } /* end */ |
| 9376 | }; |
| 9377 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9378 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9379 | /* HP */ |
| 9380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9381 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9382 | /* Int speaker */ |
| 9383 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9384 | |
| 9385 | /* enable unsolicited event */ |
| 9386 | /* |
| 9387 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9388 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9389 | */ |
| 9390 | |
| 9391 | { } /* end */ |
| 9392 | }; |
| 9393 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9394 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9395 | /* HP */ |
| 9396 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9397 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9398 | /* Int speaker */ |
| 9399 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9400 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9401 | |
| 9402 | /* enable unsolicited event */ |
| 9403 | {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] | 9404 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9405 | |
| 9406 | { } /* end */ |
| 9407 | }; |
| 9408 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9409 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9410 | /* HP */ |
| 9411 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9412 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9413 | /* Subwoofer */ |
| 9414 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9415 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9416 | |
| 9417 | /* enable unsolicited event */ |
| 9418 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9419 | |
| 9420 | { } /* end */ |
| 9421 | }; |
| 9422 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9423 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9426 | |
| 9427 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9428 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9429 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9430 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9431 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9432 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9433 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9434 | /* Connect Mic jack to CLFE */ |
| 9435 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9436 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9437 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9438 | /* Connect Line-in jack to Surround */ |
| 9439 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9441 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9442 | /* Connect HP out jack to Front */ |
| 9443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9445 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9446 | |
| 9447 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9448 | |
| 9449 | { } /* end */ |
| 9450 | }; |
| 9451 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9452 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9453 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9454 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9455 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9456 | { } /* end */ |
| 9457 | }; |
| 9458 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9459 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9462 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9464 | { } /* end */ |
| 9465 | }; |
| 9466 | |
| 9467 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9470 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9471 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9472 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9473 | { } /* end */ |
| 9474 | }; |
| 9475 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9476 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9477 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9478 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9479 | |
| 9480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9481 | |
| 9482 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9483 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9484 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9485 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9486 | { } /* end */ |
| 9487 | }; |
| 9488 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9489 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9492 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9493 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9494 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9495 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9496 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9497 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9498 | { } /* end */ |
| 9499 | }; |
| 9500 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9501 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9502 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9503 | { } |
| 9504 | }; |
| 9505 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9506 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9507 | /* HP */ |
| 9508 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9509 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9510 | |
| 9511 | /* enable unsolicited event */ |
| 9512 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9513 | |
| 9514 | { } /* end */ |
| 9515 | }; |
| 9516 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9517 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9518 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9519 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9520 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9521 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9522 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9523 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9524 | spec->autocfg.speaker_pins[2] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9525 | spec->automute = 1; |
| 9526 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9527 | } |
| 9528 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9529 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9530 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9531 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9532 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9533 | {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] | 9534 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9535 | }; |
| 9536 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9537 | /* |
| 9538 | * 2ch mode |
| 9539 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9540 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9541 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9542 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9543 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9544 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9545 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9546 | }; |
| 9547 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9548 | /* |
| 9549 | * 4ch mode |
| 9550 | */ |
| 9551 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9552 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9553 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9554 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9555 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9556 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9557 | { } /* end */ |
| 9558 | }; |
| 9559 | |
| 9560 | /* |
| 9561 | * 6ch mode |
| 9562 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9563 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9564 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9565 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9566 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9567 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9568 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9569 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9570 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9571 | }; |
| 9572 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9573 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9574 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9575 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9576 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9577 | }; |
| 9578 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9579 | static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9580 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9581 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9582 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9583 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9584 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9585 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9586 | spec->automute = 1; |
| 9587 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9588 | } |
| 9589 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9590 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9591 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9592 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9593 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9594 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9595 | spec->autocfg.hp_pins[0] = 0x14; |
| 9596 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9597 | spec->automute = 1; |
| 9598 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9599 | } |
| 9600 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9601 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9602 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9603 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9604 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9605 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9606 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9607 | struct alc_spec *spec = codec->spec; |
| 9608 | |
| 9609 | spec->autocfg.hp_pins[0] = 0x15; |
| 9610 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9611 | spec->automute = 1; |
| 9612 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9613 | } |
| 9614 | |
| 9615 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9616 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9617 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9618 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9619 | } |
| 9620 | |
| 9621 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9622 | unsigned int res) |
| 9623 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9624 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9625 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9626 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9627 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9628 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9629 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9630 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9631 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9632 | } |
| 9633 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9634 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9635 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9636 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9637 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9638 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9639 | spec->autocfg.hp_pins[0] = 0x14; |
| 9640 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9641 | spec->automute = 1; |
| 9642 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9643 | } |
| 9644 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9645 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9646 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9647 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9648 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9649 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9650 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9651 | spec->automute = 1; |
| 9652 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9653 | } |
| 9654 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9655 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9656 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9657 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9658 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9659 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9660 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9661 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9662 | spec->automute = 1; |
| 9663 | spec->detect_line = 1; |
| 9664 | spec->automute_lines = 1; |
| 9665 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9666 | } |
| 9667 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9668 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9669 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9670 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9671 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9672 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9673 | spec->autocfg.hp_pins[0] = 0x14; |
| 9674 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9675 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9676 | spec->automute = 1; |
| 9677 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9678 | } |
| 9679 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9680 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9681 | /* HP Pin: output 0 (0x0c) */ |
| 9682 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9683 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9684 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9685 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9686 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9687 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9688 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9689 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9690 | /* eanable EAPD on medion laptop */ |
| 9691 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9692 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9693 | /* enable unsolicited event */ |
| 9694 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9695 | { } |
| 9696 | }; |
| 9697 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9698 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9699 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9700 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9701 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9702 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9703 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9704 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9705 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9706 | spec->autocfg.speaker_pins[3] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9707 | spec->automute = 1; |
| 9708 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9709 | } |
| 9710 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9711 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9712 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9713 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9714 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9715 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9716 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9717 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9718 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9719 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9720 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9721 | spec->automute = 1; |
| 9722 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9723 | } |
| 9724 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9725 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9726 | { |
| 9727 | struct alc_spec *spec = codec->spec; |
| 9728 | |
| 9729 | spec->autocfg.hp_pins[0] = 0x15; |
| 9730 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9731 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9732 | spec->automute = 1; |
| 9733 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9734 | } |
| 9735 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9736 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9737 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9738 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9739 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9740 | /* enable unsolicited event */ |
| 9741 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9742 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9743 | { } /* end */ |
| 9744 | }; |
| 9745 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9746 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9747 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9748 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9749 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9750 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9751 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9752 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9753 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9754 | spec->ext_mic.pin = 0x18; |
| 9755 | spec->int_mic.pin = 0x19; |
| 9756 | spec->ext_mic.mux_idx = 0; |
| 9757 | spec->int_mic.mux_idx = 1; |
| 9758 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9759 | spec->automute = 1; |
| 9760 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9761 | } |
| 9762 | |
| 9763 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9764 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9765 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9766 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9767 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9768 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9769 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9770 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9771 | /* enable unsolicited event */ |
| 9772 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9773 | { } /* end */ |
| 9774 | }; |
| 9775 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9776 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9777 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9778 | struct alc_spec *spec = codec->spec; |
| 9779 | |
| 9780 | spec->autocfg.hp_pins[0] = 0x14; |
| 9781 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9782 | alc_hp_automute(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9783 | } |
| 9784 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9785 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9786 | /* Init rear pin (used as headphone output) */ |
| 9787 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9788 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9789 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9790 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9791 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9792 | /* Init line 2 pin (used as headphone out by default) */ |
| 9793 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9794 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9795 | { } /* end */ |
| 9796 | }; |
| 9797 | |
| 9798 | /* Mute speakers according to the headphone jack state */ |
| 9799 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9800 | { |
| 9801 | unsigned int present; |
| 9802 | |
| 9803 | /* Mute only in 2ch or 4ch mode */ |
| 9804 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9805 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9806 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9807 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9808 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9809 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9810 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9811 | } |
| 9812 | } |
| 9813 | |
| 9814 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9815 | { |
| 9816 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9817 | alc889A_mb31_automute(codec); |
| 9818 | } |
| 9819 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9820 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9821 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9822 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9823 | #endif |
| 9824 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9825 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9826 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9827 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9828 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9829 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9830 | |
| 9831 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9832 | ALC1200_DIGOUT_NID, 0, |
| 9833 | }; |
| 9834 | |
| 9835 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9836 | ALC883_DIGOUT_NID, 0, |
| 9837 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9838 | |
| 9839 | /* |
| 9840 | * configuration and preset |
| 9841 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9842 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9843 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9844 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9845 | [ALC882_ARIMA] = "arima", |
| 9846 | [ALC882_W2JC] = "w2jc", |
| 9847 | [ALC882_TARGA] = "targa", |
| 9848 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9849 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9850 | [ALC885_MACPRO] = "macpro", |
| 9851 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9852 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9853 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9854 | [ALC885_MBP3] = "mbp3", |
| 9855 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9856 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9857 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9858 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9859 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9860 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9861 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9862 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9863 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9864 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9865 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9866 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9867 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9868 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9869 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9870 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9871 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9872 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9873 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9874 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9875 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9876 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9877 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9878 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9879 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9880 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9881 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9882 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9883 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9884 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9885 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9886 | [ALC889A_INTEL] = "intel-alc889a", |
| 9887 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9888 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9889 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9890 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9891 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9892 | }; |
| 9893 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9894 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9895 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9896 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9898 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9899 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9901 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9902 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9903 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9904 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9905 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9906 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9907 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9908 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9909 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9910 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9911 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9912 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9913 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9914 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9915 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9916 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9917 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9918 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9919 | /* default Acer -- disabled as it causes more problems. |
| 9920 | * model=auto should work fine now |
| 9921 | */ |
| 9922 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9923 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9924 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9925 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9926 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9927 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9928 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9929 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9930 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9931 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9932 | |
| 9933 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9934 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9935 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9936 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9937 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9938 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9939 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9940 | 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] | 9941 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9942 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9943 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9944 | |
| 9945 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9946 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9947 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9948 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9950 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9951 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9952 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9953 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9954 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9955 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9956 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9957 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9958 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9959 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9960 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9961 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9962 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9963 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9964 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9965 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9966 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9967 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9968 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9969 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9970 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9971 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9972 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9973 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9974 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9975 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9976 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9977 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9979 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9980 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9981 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9982 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9983 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9984 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9985 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9986 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9987 | 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] | 9988 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9989 | 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] | 9990 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9991 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9992 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9993 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9994 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9995 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9996 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9997 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9998 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9999 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10000 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10001 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 10002 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10003 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 10004 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 10005 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10006 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10007 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10008 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 10009 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10010 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10011 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 10012 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 10013 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 10014 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10015 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10016 | {} |
| 10017 | }; |
| 10018 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10019 | /* codec SSID table for Intel Mac */ |
| 10020 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 10021 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 10022 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 10023 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 10024 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 10025 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 10026 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 10027 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 10028 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 10029 | 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] | 10030 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 10031 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10032 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10033 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10034 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10035 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10036 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10037 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10038 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10039 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10040 | */ |
| 10041 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10042 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10043 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10044 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10045 | }; |
| 10046 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10047 | static struct alc_config_preset alc882_presets[] = { |
| 10048 | [ALC882_3ST_DIG] = { |
| 10049 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10050 | .init_verbs = { alc882_base_init_verbs, |
| 10051 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10052 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10053 | .dac_nids = alc882_dac_nids, |
| 10054 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10055 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10056 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10057 | .channel_mode = alc882_ch_modes, |
| 10058 | .need_dac_fix = 1, |
| 10059 | .input_mux = &alc882_capture_source, |
| 10060 | }, |
| 10061 | [ALC882_6ST_DIG] = { |
| 10062 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10063 | .init_verbs = { alc882_base_init_verbs, |
| 10064 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10065 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10066 | .dac_nids = alc882_dac_nids, |
| 10067 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10068 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10069 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10070 | .channel_mode = alc882_sixstack_modes, |
| 10071 | .input_mux = &alc882_capture_source, |
| 10072 | }, |
| 10073 | [ALC882_ARIMA] = { |
| 10074 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10075 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10076 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10077 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10078 | .dac_nids = alc882_dac_nids, |
| 10079 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10080 | .channel_mode = alc882_sixstack_modes, |
| 10081 | .input_mux = &alc882_capture_source, |
| 10082 | }, |
| 10083 | [ALC882_W2JC] = { |
| 10084 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10085 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10086 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10087 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10088 | .dac_nids = alc882_dac_nids, |
| 10089 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10090 | .channel_mode = alc880_threestack_modes, |
| 10091 | .need_dac_fix = 1, |
| 10092 | .input_mux = &alc882_capture_source, |
| 10093 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10094 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10095 | [ALC885_MBA21] = { |
| 10096 | .mixers = { alc885_mba21_mixer }, |
| 10097 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10098 | .num_dacs = 2, |
| 10099 | .dac_nids = alc882_dac_nids, |
| 10100 | .channel_mode = alc885_mba21_ch_modes, |
| 10101 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10102 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10103 | .unsol_event = alc_sku_unsol_event, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10104 | .setup = alc885_mba21_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10105 | .init_hook = alc_hp_automute, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10106 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10107 | [ALC885_MBP3] = { |
| 10108 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10109 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10110 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10111 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10112 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10113 | .hp_nid = 0x04, |
| 10114 | .channel_mode = alc885_mbp_4ch_modes, |
| 10115 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10116 | .input_mux = &alc882_capture_source, |
| 10117 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10118 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10119 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10120 | .setup = alc885_mbp3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10121 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10122 | }, |
| 10123 | [ALC885_MB5] = { |
| 10124 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10125 | .init_verbs = { alc885_mb5_init_verbs, |
| 10126 | alc880_gpio1_init_verbs }, |
| 10127 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10128 | .dac_nids = alc882_dac_nids, |
| 10129 | .channel_mode = alc885_mb5_6ch_modes, |
| 10130 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10131 | .input_mux = &mb5_capture_source, |
| 10132 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10133 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10134 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10135 | .setup = alc885_mb5_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10136 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10137 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10138 | [ALC885_MACMINI3] = { |
| 10139 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10140 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10141 | alc880_gpio1_init_verbs }, |
| 10142 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10143 | .dac_nids = alc882_dac_nids, |
| 10144 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10145 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10146 | .input_mux = &macmini3_capture_source, |
| 10147 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10148 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10149 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10150 | .setup = alc885_macmini3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10151 | .init_hook = alc_hp_automute, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10152 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10153 | [ALC885_MACPRO] = { |
| 10154 | .mixers = { alc882_macpro_mixer }, |
| 10155 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10156 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10157 | .dac_nids = alc882_dac_nids, |
| 10158 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10159 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10160 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10161 | .channel_mode = alc882_ch_modes, |
| 10162 | .input_mux = &alc882_capture_source, |
| 10163 | .init_hook = alc885_macpro_init_hook, |
| 10164 | }, |
| 10165 | [ALC885_IMAC24] = { |
| 10166 | .mixers = { alc885_imac24_mixer }, |
| 10167 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10168 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10169 | .dac_nids = alc882_dac_nids, |
| 10170 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10171 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10172 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10173 | .channel_mode = alc882_ch_modes, |
| 10174 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10175 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10176 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10177 | .init_hook = alc885_imac24_init_hook, |
| 10178 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10179 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10180 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10181 | .init_verbs = { alc885_imac91_init_verbs, |
| 10182 | alc880_gpio1_init_verbs }, |
| 10183 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10184 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10185 | .channel_mode = alc885_mba21_ch_modes, |
| 10186 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10187 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10188 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10189 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10190 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10191 | .setup = alc885_imac91_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10192 | .init_hook = alc_hp_automute, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10193 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10194 | [ALC882_TARGA] = { |
| 10195 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10196 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10197 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10198 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10199 | .dac_nids = alc882_dac_nids, |
| 10200 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10201 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10202 | .adc_nids = alc882_adc_nids, |
| 10203 | .capsrc_nids = alc882_capsrc_nids, |
| 10204 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10205 | .channel_mode = alc882_3ST_6ch_modes, |
| 10206 | .need_dac_fix = 1, |
| 10207 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10208 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10209 | .setup = alc882_targa_setup, |
| 10210 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10211 | }, |
| 10212 | [ALC882_ASUS_A7J] = { |
| 10213 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10214 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10215 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10216 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10217 | .dac_nids = alc882_dac_nids, |
| 10218 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10219 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10220 | .adc_nids = alc882_adc_nids, |
| 10221 | .capsrc_nids = alc882_capsrc_nids, |
| 10222 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10223 | .channel_mode = alc882_3ST_6ch_modes, |
| 10224 | .need_dac_fix = 1, |
| 10225 | .input_mux = &alc882_capture_source, |
| 10226 | }, |
| 10227 | [ALC882_ASUS_A7M] = { |
| 10228 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10229 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10230 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10231 | alc882_asus_a7m_verbs }, |
| 10232 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10233 | .dac_nids = alc882_dac_nids, |
| 10234 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10235 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10236 | .channel_mode = alc880_threestack_modes, |
| 10237 | .need_dac_fix = 1, |
| 10238 | .input_mux = &alc882_capture_source, |
| 10239 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10240 | [ALC883_3ST_2ch_DIG] = { |
| 10241 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10242 | .init_verbs = { alc883_init_verbs }, |
| 10243 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10244 | .dac_nids = alc883_dac_nids, |
| 10245 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10246 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10247 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10248 | .channel_mode = alc883_3ST_2ch_modes, |
| 10249 | .input_mux = &alc883_capture_source, |
| 10250 | }, |
| 10251 | [ALC883_3ST_6ch_DIG] = { |
| 10252 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10253 | .init_verbs = { alc883_init_verbs }, |
| 10254 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10255 | .dac_nids = alc883_dac_nids, |
| 10256 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10257 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10258 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10259 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10260 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10261 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10262 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10263 | [ALC883_3ST_6ch] = { |
| 10264 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10265 | .init_verbs = { alc883_init_verbs }, |
| 10266 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10267 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10268 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10269 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10270 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10271 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10272 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10273 | [ALC883_3ST_6ch_INTEL] = { |
| 10274 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10275 | .init_verbs = { alc883_init_verbs }, |
| 10276 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10277 | .dac_nids = alc883_dac_nids, |
| 10278 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10279 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10280 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10281 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10282 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10283 | .need_dac_fix = 1, |
| 10284 | .input_mux = &alc883_3stack_6ch_intel, |
| 10285 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10286 | [ALC889A_INTEL] = { |
| 10287 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10288 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10289 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10290 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10291 | .dac_nids = alc883_dac_nids, |
| 10292 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10293 | .adc_nids = alc889_adc_nids, |
| 10294 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10295 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10296 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10297 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10298 | .channel_mode = alc889_8ch_intel_modes, |
| 10299 | .capsrc_nids = alc889_capsrc_nids, |
| 10300 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10301 | .setup = alc889_automute_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10302 | .init_hook = alc_hp_automute, |
| 10303 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10304 | .need_dac_fix = 1, |
| 10305 | }, |
| 10306 | [ALC889_INTEL] = { |
| 10307 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10308 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10309 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10310 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10311 | .dac_nids = alc883_dac_nids, |
| 10312 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10313 | .adc_nids = alc889_adc_nids, |
| 10314 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10315 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10316 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10317 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10318 | .channel_mode = alc889_8ch_intel_modes, |
| 10319 | .capsrc_nids = alc889_capsrc_nids, |
| 10320 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10321 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10322 | .init_hook = alc889_intel_init_hook, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10323 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10324 | .need_dac_fix = 1, |
| 10325 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10326 | [ALC883_6ST_DIG] = { |
| 10327 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10328 | .init_verbs = { alc883_init_verbs }, |
| 10329 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10330 | .dac_nids = alc883_dac_nids, |
| 10331 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10332 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10333 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10334 | .channel_mode = alc883_sixstack_modes, |
| 10335 | .input_mux = &alc883_capture_source, |
| 10336 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10337 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10338 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10339 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10340 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10341 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10342 | .dac_nids = alc883_dac_nids, |
| 10343 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10344 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10345 | .channel_mode = alc883_3ST_6ch_modes, |
| 10346 | .need_dac_fix = 1, |
| 10347 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10348 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10349 | .setup = alc882_targa_setup, |
| 10350 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10351 | }, |
| 10352 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10353 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10354 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10355 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10356 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10357 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10358 | .adc_nids = alc883_adc_nids_alt, |
| 10359 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10360 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10361 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10362 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10363 | .channel_mode = alc883_3ST_2ch_modes, |
| 10364 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10365 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10366 | .setup = alc882_targa_setup, |
| 10367 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10368 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10369 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10370 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10371 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10372 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10373 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10375 | .dac_nids = alc883_dac_nids, |
| 10376 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10377 | .adc_nids = alc883_adc_nids_rev, |
| 10378 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10379 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10380 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10381 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10382 | .channel_mode = alc883_4ST_8ch_modes, |
| 10383 | .need_dac_fix = 1, |
| 10384 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10385 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10386 | .setup = alc882_targa_setup, |
| 10387 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10388 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10389 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10390 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10391 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10392 | * and the headphone jack. Turn this on and rely on the |
| 10393 | * standard mute methods whenever the user wants to turn |
| 10394 | * these outputs off. |
| 10395 | */ |
| 10396 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10397 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10398 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10399 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10400 | .channel_mode = alc883_3ST_2ch_modes, |
| 10401 | .input_mux = &alc883_capture_source, |
| 10402 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10403 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10404 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10405 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10406 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10407 | .dac_nids = alc883_dac_nids, |
| 10408 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10409 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10410 | .channel_mode = alc883_3ST_2ch_modes, |
| 10411 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10412 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10413 | .setup = alc883_acer_aspire_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10414 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10415 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10416 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10417 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10418 | alc883_chmode_mixer }, |
| 10419 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10420 | alc888_acer_aspire_4930g_verbs }, |
| 10421 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10422 | .dac_nids = alc883_dac_nids, |
| 10423 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10424 | .adc_nids = alc883_adc_nids_rev, |
| 10425 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10426 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10427 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10428 | .channel_mode = alc883_3ST_6ch_modes, |
| 10429 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10430 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10431 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10432 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10433 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10434 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10435 | .setup = alc888_acer_aspire_4930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10436 | .init_hook = alc_hp_automute, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10437 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10438 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10439 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10440 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10441 | alc888_acer_aspire_6530g_verbs }, |
| 10442 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10443 | .dac_nids = alc883_dac_nids, |
| 10444 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10445 | .adc_nids = alc883_adc_nids_rev, |
| 10446 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10447 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10448 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10449 | .channel_mode = alc883_3ST_2ch_modes, |
| 10450 | .num_mux_defs = |
| 10451 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10452 | .input_mux = alc888_acer_aspire_6530_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 = alc888_acer_aspire_6530g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10455 | .init_hook = alc_hp_automute, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10456 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10457 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10458 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10459 | alc883_chmode_mixer }, |
| 10460 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10461 | alc889_acer_aspire_8930g_verbs, |
| 10462 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10463 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10464 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10465 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10466 | .adc_nids = alc889_adc_nids, |
| 10467 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10468 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10469 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10470 | .channel_mode = alc883_3ST_6ch_modes, |
| 10471 | .need_dac_fix = 1, |
| 10472 | .const_channel_count = 6, |
| 10473 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10474 | ARRAY_SIZE(alc889_capture_sources), |
| 10475 | .input_mux = alc889_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10476 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10477 | .setup = alc889_acer_aspire_8930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10478 | .init_hook = alc_hp_automute, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10479 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10480 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10481 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10482 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10483 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10484 | .mixers = { alc883_3ST_6ch_mixer, |
| 10485 | alc883_chmode_mixer }, |
| 10486 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10487 | alc888_acer_aspire_7730G_verbs }, |
| 10488 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10489 | .dac_nids = alc883_dac_nids, |
| 10490 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10491 | .adc_nids = alc883_adc_nids_rev, |
| 10492 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10493 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10494 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10495 | .channel_mode = alc883_3ST_6ch_modes, |
| 10496 | .need_dac_fix = 1, |
| 10497 | .const_channel_count = 6, |
| 10498 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10499 | .unsol_event = alc_sku_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10500 | .setup = alc888_acer_aspire_7730g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10501 | .init_hook = alc_hp_automute, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10502 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10503 | [ALC883_MEDION] = { |
| 10504 | .mixers = { alc883_fivestack_mixer, |
| 10505 | alc883_chmode_mixer }, |
| 10506 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10507 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10508 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10509 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10510 | .adc_nids = alc883_adc_nids_alt, |
| 10511 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10512 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10513 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10514 | .channel_mode = alc883_sixstack_modes, |
| 10515 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10516 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10517 | [ALC883_MEDION_WIM2160] = { |
| 10518 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10519 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10520 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10521 | .dac_nids = alc883_dac_nids, |
| 10522 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10523 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10524 | .adc_nids = alc883_adc_nids, |
| 10525 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10526 | .channel_mode = alc883_3ST_2ch_modes, |
| 10527 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10528 | .unsol_event = alc_sku_unsol_event, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10529 | .setup = alc883_medion_wim2160_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10530 | .init_hook = alc_hp_automute, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10531 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10532 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10533 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10534 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10535 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10536 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10537 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10538 | .channel_mode = alc883_3ST_2ch_modes, |
| 10539 | .input_mux = &alc883_capture_source, |
| 10540 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10541 | [ALC883_CLEVO_M540R] = { |
| 10542 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10543 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10544 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10545 | .dac_nids = alc883_dac_nids, |
| 10546 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10547 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10548 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10549 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10550 | .need_dac_fix = 1, |
| 10551 | .input_mux = &alc883_capture_source, |
| 10552 | /* This machine has the hardware HP auto-muting, thus |
| 10553 | * we need no software mute via unsol event |
| 10554 | */ |
| 10555 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10556 | [ALC883_CLEVO_M720] = { |
| 10557 | .mixers = { alc883_clevo_m720_mixer }, |
| 10558 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10559 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10560 | .dac_nids = alc883_dac_nids, |
| 10561 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10562 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10563 | .channel_mode = alc883_3ST_2ch_modes, |
| 10564 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10565 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10566 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10567 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10568 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10569 | [ALC883_LENOVO_101E_2ch] = { |
| 10570 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10571 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10572 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10573 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10574 | .adc_nids = alc883_adc_nids_alt, |
| 10575 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10576 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10577 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10578 | .channel_mode = alc883_3ST_2ch_modes, |
| 10579 | .input_mux = &alc883_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10580 | .setup = alc883_lenovo_101e_setup, |
| 10581 | .unsol_event = alc_sku_unsol_event, |
| 10582 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10583 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10584 | [ALC883_LENOVO_NB0763] = { |
| 10585 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10586 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10587 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10588 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10589 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10590 | .channel_mode = alc883_3ST_2ch_modes, |
| 10591 | .need_dac_fix = 1, |
| 10592 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10593 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10594 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10595 | .init_hook = alc_hp_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10596 | }, |
| 10597 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10598 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10599 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10600 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10601 | .dac_nids = alc883_dac_nids, |
| 10602 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10603 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10604 | .channel_mode = alc883_3ST_6ch_modes, |
| 10605 | .need_dac_fix = 1, |
| 10606 | .input_mux = &alc883_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10607 | .unsol_event = alc_sku_unsol_event, |
| 10608 | .setup = alc888_lenovo_ms7195_setup, |
| 10609 | .init_hook = alc_inithook, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10610 | }, |
| 10611 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10612 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10613 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10614 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10615 | .dac_nids = alc883_dac_nids, |
| 10616 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10617 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10618 | .channel_mode = alc883_3ST_2ch_modes, |
| 10619 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10620 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10621 | .setup = alc883_haier_w66_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10622 | .init_hook = alc_hp_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10623 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10624 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10625 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10626 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10627 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10628 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10629 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10630 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10631 | .need_dac_fix = 1, |
| 10632 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10633 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10634 | .setup = alc888_3st_hp_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10635 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10636 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10637 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10638 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10639 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10640 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10641 | .dac_nids = alc883_dac_nids, |
| 10642 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10643 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10644 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10645 | .channel_mode = alc883_sixstack_modes, |
| 10646 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10647 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10648 | .setup = alc888_6st_dell_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10649 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10650 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10651 | [ALC883_MITAC] = { |
| 10652 | .mixers = { alc883_mitac_mixer }, |
| 10653 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10654 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10655 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10656 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10657 | .channel_mode = alc883_3ST_2ch_modes, |
| 10658 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10659 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10660 | .setup = alc883_mitac_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10661 | .init_hook = alc_hp_automute, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10662 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10663 | [ALC883_FUJITSU_PI2515] = { |
| 10664 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10665 | .init_verbs = { alc883_init_verbs, |
| 10666 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10667 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10668 | .dac_nids = alc883_dac_nids, |
| 10669 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10670 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10671 | .channel_mode = alc883_3ST_2ch_modes, |
| 10672 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10673 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10674 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10675 | .init_hook = alc_hp_automute, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10676 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10677 | [ALC888_FUJITSU_XA3530] = { |
| 10678 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10679 | .init_verbs = { alc883_init_verbs, |
| 10680 | alc888_fujitsu_xa3530_verbs }, |
| 10681 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10682 | .dac_nids = alc883_dac_nids, |
| 10683 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10684 | .adc_nids = alc883_adc_nids_rev, |
| 10685 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10686 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10687 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10688 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10689 | .num_mux_defs = |
| 10690 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10691 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10692 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10693 | .setup = alc888_fujitsu_xa3530_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10694 | .init_hook = alc_hp_automute, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10695 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10696 | [ALC888_LENOVO_SKY] = { |
| 10697 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10698 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10699 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10700 | .dac_nids = alc883_dac_nids, |
| 10701 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10702 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10703 | .channel_mode = alc883_sixstack_modes, |
| 10704 | .need_dac_fix = 1, |
| 10705 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10706 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10707 | .setup = alc888_lenovo_sky_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10708 | .init_hook = alc_hp_automute, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10709 | }, |
| 10710 | [ALC888_ASUS_M90V] = { |
| 10711 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10712 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10713 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10714 | .dac_nids = alc883_dac_nids, |
| 10715 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10716 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10717 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10718 | .channel_mode = alc883_3ST_6ch_modes, |
| 10719 | .need_dac_fix = 1, |
| 10720 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10721 | .unsol_event = alc_sku_unsol_event, |
| 10722 | .setup = alc883_mode2_setup, |
| 10723 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10724 | }, |
| 10725 | [ALC888_ASUS_EEE1601] = { |
| 10726 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10727 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10728 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10729 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10730 | .dac_nids = alc883_dac_nids, |
| 10731 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10732 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10733 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10734 | .channel_mode = alc883_3ST_2ch_modes, |
| 10735 | .need_dac_fix = 1, |
| 10736 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10737 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10738 | .init_hook = alc883_eee1601_inithook, |
| 10739 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10740 | [ALC1200_ASUS_P5Q] = { |
| 10741 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10742 | .init_verbs = { alc883_init_verbs }, |
| 10743 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10744 | .dac_nids = alc883_dac_nids, |
| 10745 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10746 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10747 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10748 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10749 | .channel_mode = alc883_sixstack_modes, |
| 10750 | .input_mux = &alc883_capture_source, |
| 10751 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10752 | [ALC889A_MB31] = { |
| 10753 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10754 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10755 | alc880_gpio1_init_verbs }, |
| 10756 | .adc_nids = alc883_adc_nids, |
| 10757 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10758 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10759 | .dac_nids = alc883_dac_nids, |
| 10760 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10761 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10762 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10763 | .input_mux = &alc889A_mb31_capture_source, |
| 10764 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10765 | .unsol_event = alc889A_mb31_unsol_event, |
| 10766 | .init_hook = alc889A_mb31_automute, |
| 10767 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10768 | [ALC883_SONY_VAIO_TT] = { |
| 10769 | .mixers = { alc883_vaiott_mixer }, |
| 10770 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10771 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10772 | .dac_nids = alc883_dac_nids, |
| 10773 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10774 | .channel_mode = alc883_3ST_2ch_modes, |
| 10775 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10776 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10777 | .setup = alc883_vaiott_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10778 | .init_hook = alc_hp_automute, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10779 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10780 | }; |
| 10781 | |
| 10782 | |
| 10783 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10784 | * Pin config fixes |
| 10785 | */ |
| 10786 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10787 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10788 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10789 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10790 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10791 | PINFIX_GIGABYTE_880GM, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10792 | }; |
| 10793 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10794 | static const struct alc_fixup alc882_fixups[] = { |
| 10795 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10796 | .type = ALC_FIXUP_PINS, |
| 10797 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10798 | { 0x15, 0x01080104 }, /* side */ |
| 10799 | { 0x16, 0x01011012 }, /* rear */ |
| 10800 | { 0x17, 0x01016011 }, /* clfe */ |
| 10801 | { } |
| 10802 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10803 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10804 | [PINFIX_LENOVO_Y530] = { |
| 10805 | .type = ALC_FIXUP_PINS, |
| 10806 | .v.pins = (const struct alc_pincfg[]) { |
| 10807 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10808 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10809 | { } |
| 10810 | } |
| 10811 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10812 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10813 | .type = ALC_FIXUP_VERBS, |
| 10814 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10815 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10816 | {} |
| 10817 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10818 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10819 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10820 | .type = ALC_FIXUP_SKU, |
| 10821 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10822 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10823 | [PINFIX_GIGABYTE_880GM] = { |
| 10824 | .type = ALC_FIXUP_PINS, |
| 10825 | .v.pins = (const struct alc_pincfg[]) { |
| 10826 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 10827 | { } |
| 10828 | } |
| 10829 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10830 | }; |
| 10831 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10832 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10833 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10834 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10835 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10836 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10837 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10838 | {} |
| 10839 | }; |
| 10840 | |
| 10841 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10842 | * BIOS auto configuration |
| 10843 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10844 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10845 | const struct auto_pin_cfg *cfg) |
| 10846 | { |
| 10847 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10848 | } |
| 10849 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10850 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10851 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10852 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10853 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10854 | int idx; |
| 10855 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10856 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10857 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10858 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10859 | if (dac == 0x25) |
| 10860 | idx = 4; |
| 10861 | else if (dac >= 0x02 && dac <= 0x05) |
| 10862 | idx = dac - 2; |
| 10863 | else |
| 10864 | return; |
| 10865 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10866 | } |
| 10867 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10868 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10869 | { |
| 10870 | struct alc_spec *spec = codec->spec; |
| 10871 | int i; |
| 10872 | |
| 10873 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10874 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10875 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10876 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10877 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10878 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10879 | } |
| 10880 | } |
| 10881 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10882 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10883 | { |
| 10884 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10885 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10886 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10887 | |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10888 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
| 10889 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10890 | pin = spec->autocfg.hp_pins[i]; |
| 10891 | if (!pin) |
| 10892 | break; |
| 10893 | dac = spec->multiout.hp_nid; |
| 10894 | if (!dac) |
| 10895 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10896 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10897 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10898 | } |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10899 | |
| 10900 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 10901 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10902 | pin = spec->autocfg.speaker_pins[i]; |
| 10903 | if (!pin) |
| 10904 | break; |
| 10905 | dac = spec->multiout.extra_out_nid[0]; |
| 10906 | if (!dac) |
| 10907 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10908 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10909 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10910 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10911 | } |
| 10912 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10913 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10914 | { |
| 10915 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10916 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10917 | int i; |
| 10918 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10919 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10920 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10921 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10922 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10923 | snd_hda_codec_write(codec, nid, 0, |
| 10924 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10925 | AMP_OUT_MUTE); |
| 10926 | } |
| 10927 | } |
| 10928 | |
| 10929 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10930 | { |
| 10931 | struct alc_spec *spec = codec->spec; |
| 10932 | int c; |
| 10933 | |
| 10934 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10935 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10936 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10937 | unsigned int mux_idx; |
| 10938 | const struct hda_input_mux *imux; |
| 10939 | int conns, mute, idx, item; |
| 10940 | |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 10941 | /* mute ADC */ |
| 10942 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 10943 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10944 | AMP_IN_MUTE(0)); |
| 10945 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10946 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10947 | ARRAY_SIZE(conn_list)); |
| 10948 | if (conns < 0) |
| 10949 | continue; |
| 10950 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10951 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10952 | if (!imux->num_items && mux_idx > 0) |
| 10953 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10954 | for (idx = 0; idx < conns; idx++) { |
| 10955 | /* if the current connection is the selected one, |
| 10956 | * unmute it as default - otherwise mute it |
| 10957 | */ |
| 10958 | mute = AMP_IN_MUTE(idx); |
| 10959 | for (item = 0; item < imux->num_items; item++) { |
| 10960 | if (imux->items[item].index == idx) { |
| 10961 | if (spec->cur_mux[c] == item) |
| 10962 | mute = AMP_IN_UNMUTE(idx); |
| 10963 | break; |
| 10964 | } |
| 10965 | } |
| 10966 | /* check if we have a selector or mixer |
| 10967 | * we could check for the widget type instead, but |
| 10968 | * just check for Amp-In presence (in case of mixer |
| 10969 | * without amp-in there is something wrong, this |
| 10970 | * function shouldn't be used or capsrc nid is wrong) |
| 10971 | */ |
| 10972 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10973 | snd_hda_codec_write(codec, nid, 0, |
| 10974 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10975 | mute); |
| 10976 | else if (mute != AMP_IN_MUTE(idx)) |
| 10977 | snd_hda_codec_write(codec, nid, 0, |
| 10978 | AC_VERB_SET_CONNECT_SEL, |
| 10979 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10980 | } |
| 10981 | } |
| 10982 | } |
| 10983 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10984 | /* add mic boosts if needed */ |
| 10985 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10986 | { |
| 10987 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10988 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10989 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10990 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10991 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10992 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10993 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10994 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10995 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10996 | break; |
| 10997 | nid = cfg->inputs[i].pin; |
| 10998 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10999 | const char *label; |
| 11000 | char boost_label[32]; |
| 11001 | |
| 11002 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 11003 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11004 | type_idx++; |
| 11005 | else |
| 11006 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11007 | prev_label = label; |
| 11008 | |
| 11009 | snprintf(boost_label, sizeof(boost_label), |
| 11010 | "%s Boost Volume", label); |
| 11011 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11012 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11013 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11014 | if (err < 0) |
| 11015 | return err; |
| 11016 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11017 | } |
| 11018 | return 0; |
| 11019 | } |
| 11020 | |
| 11021 | /* almost identical with ALC880 parser... */ |
| 11022 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 11023 | { |
| 11024 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11025 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11026 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11027 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11028 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11029 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11030 | if (err < 0) |
| 11031 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11032 | if (!spec->autocfg.line_outs) |
| 11033 | return 0; /* can't find valid BIOS pin config */ |
| 11034 | |
| 11035 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11036 | if (err < 0) |
| 11037 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 11038 | err = alc_auto_add_multi_channel_mode(codec); |
| 11039 | if (err < 0) |
| 11040 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 11041 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11042 | if (err < 0) |
| 11043 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11044 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11045 | "Headphone"); |
| 11046 | if (err < 0) |
| 11047 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11048 | err = alc880_auto_create_extra_out(spec, |
| 11049 | spec->autocfg.speaker_pins[0], |
| 11050 | "Speaker"); |
| 11051 | if (err < 0) |
| 11052 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11053 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 11054 | if (err < 0) |
| 11055 | return err; |
| 11056 | |
| 11057 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11058 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11059 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11060 | |
| 11061 | if (spec->kctls.list) |
| 11062 | add_mixer(spec, spec->kctls.list); |
| 11063 | |
| 11064 | add_verb(spec, alc883_auto_init_verbs); |
| 11065 | /* if ADC 0x07 is available, initialize it, too */ |
| 11066 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 11067 | add_verb(spec, alc882_adc1_init_verbs); |
| 11068 | |
| 11069 | spec->num_mux_defs = 1; |
| 11070 | spec->input_mux = &spec->private_imux[0]; |
| 11071 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11072 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11073 | |
| 11074 | err = alc_auto_add_mic_boost(codec); |
| 11075 | if (err < 0) |
| 11076 | return err; |
| 11077 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11078 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11079 | } |
| 11080 | |
| 11081 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11082 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11083 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11084 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11085 | alc882_auto_init_multi_out(codec); |
| 11086 | alc882_auto_init_hp_out(codec); |
| 11087 | alc882_auto_init_analog_input(codec); |
| 11088 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11089 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11090 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11091 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11092 | } |
| 11093 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11094 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11095 | { |
| 11096 | struct alc_spec *spec; |
| 11097 | int err, board_config; |
| 11098 | |
| 11099 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11100 | if (spec == NULL) |
| 11101 | return -ENOMEM; |
| 11102 | |
| 11103 | codec->spec = spec; |
| 11104 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11105 | switch (codec->vendor_id) { |
| 11106 | case 0x10ec0882: |
| 11107 | case 0x10ec0885: |
| 11108 | break; |
| 11109 | default: |
| 11110 | /* ALC883 and variants */ |
| 11111 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11112 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11113 | } |
| 11114 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11115 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11116 | alc882_models, |
| 11117 | alc882_cfg_tbl); |
| 11118 | |
| 11119 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11120 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11121 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11122 | |
| 11123 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11124 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11125 | codec->chip_name); |
| 11126 | board_config = ALC882_AUTO; |
| 11127 | } |
| 11128 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11129 | if (board_config == ALC882_AUTO) { |
| 11130 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11131 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11132 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11133 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11134 | alc_auto_parse_customize_define(codec); |
| 11135 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11136 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11137 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11138 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11139 | if (err < 0) { |
| 11140 | alc_free(codec); |
| 11141 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11142 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11143 | printk(KERN_INFO |
| 11144 | "hda_codec: Cannot set up configuration " |
| 11145 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11146 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11147 | } |
| 11148 | } |
| 11149 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11150 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11151 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11152 | if (err < 0) { |
| 11153 | alc_free(codec); |
| 11154 | return err; |
| 11155 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11156 | } |
| 11157 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11158 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11159 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11160 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11161 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11162 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11163 | /* FIXME: setup DAC5 */ |
| 11164 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11165 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11166 | |
| 11167 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11168 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11169 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11170 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11171 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11172 | spec->num_adc_nids = 0; |
| 11173 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11174 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11175 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11176 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11177 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11178 | unsigned int wcap = get_wcaps(codec, nid); |
| 11179 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11180 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11181 | if (wcap != AC_WID_AUD_IN) |
| 11182 | continue; |
| 11183 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11184 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11185 | if (err < 0) |
| 11186 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11187 | err = snd_hda_get_connections(codec, cap, items, |
| 11188 | ARRAY_SIZE(items)); |
| 11189 | if (err < 0) |
| 11190 | continue; |
| 11191 | for (j = 0; j < imux->num_items; j++) |
| 11192 | if (imux->items[j].index >= err) |
| 11193 | break; |
| 11194 | if (j < imux->num_items) |
| 11195 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11196 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11197 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11198 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11199 | spec->adc_nids = spec->private_adc_nids; |
| 11200 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11201 | } |
| 11202 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11203 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11204 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11205 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11206 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11207 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11208 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11209 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11210 | spec->vmaster_nid = 0x0c; |
| 11211 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11212 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11213 | if (board_config == ALC882_AUTO) |
| 11214 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11215 | |
| 11216 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11217 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11218 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11219 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11220 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11221 | |
| 11222 | return 0; |
| 11223 | } |
| 11224 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11225 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11226 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11227 | * ALC262 support |
| 11228 | */ |
| 11229 | |
| 11230 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11231 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11232 | |
| 11233 | #define alc262_dac_nids alc260_dac_nids |
| 11234 | #define alc262_adc_nids alc882_adc_nids |
| 11235 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11236 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11237 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11238 | |
| 11239 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11240 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11241 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11242 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11243 | /* ADC0 */ |
| 11244 | 0x09 |
| 11245 | }; |
| 11246 | |
| 11247 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11249 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11250 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11251 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11252 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11253 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11254 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11255 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11256 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11258 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11259 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11260 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11261 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11262 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11263 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11264 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11265 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11266 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11267 | }; |
| 11268 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11269 | /* update HP, line and mono-out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11270 | #define alc262_hp_master_update alc260_hp_master_update |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11271 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11272 | static void alc262_hp_bpc_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11273 | { |
| 11274 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11275 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11276 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11277 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11278 | spec->automute = 1; |
| 11279 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11280 | } |
| 11281 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11282 | static void alc262_hp_wildwest_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11283 | { |
| 11284 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11285 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11286 | spec->autocfg.hp_pins[0] = 0x15; |
| 11287 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11288 | spec->automute = 1; |
| 11289 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11290 | } |
| 11291 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11292 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11293 | #define alc262_hp_master_sw_put alc260_hp_master_sw_put |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11294 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11295 | #define ALC262_HP_MASTER_SWITCH \ |
| 11296 | { \ |
| 11297 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11298 | .name = "Master Playback Switch", \ |
| 11299 | .info = snd_ctl_boolean_mono_info, \ |
| 11300 | .get = alc262_hp_master_sw_get, \ |
| 11301 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11302 | }, \ |
| 11303 | { \ |
| 11304 | .iface = NID_MAPPING, \ |
| 11305 | .name = "Master Playback Switch", \ |
| 11306 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11307 | } |
| 11308 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11309 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11310 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11311 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11312 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11313 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11314 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11315 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11316 | HDA_OUTPUT), |
| 11317 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11318 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11320 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11321 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11322 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11323 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11324 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 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("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11328 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11329 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11330 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11331 | { } /* end */ |
| 11332 | }; |
| 11333 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11334 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11335 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11336 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11337 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11338 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11339 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11340 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11341 | HDA_OUTPUT), |
| 11342 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11343 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11344 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11345 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11346 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11347 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11348 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11349 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11350 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11351 | { } /* end */ |
| 11352 | }; |
| 11353 | |
| 11354 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11355 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11356 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11357 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11358 | { } /* end */ |
| 11359 | }; |
| 11360 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11361 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11362 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11363 | { |
| 11364 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11365 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11366 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11367 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11368 | spec->automute = 1; |
| 11369 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11370 | } |
| 11371 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11372 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11373 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11374 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11375 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11376 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11377 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11378 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11379 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11380 | { } /* end */ |
| 11381 | }; |
| 11382 | |
| 11383 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11384 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11385 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11386 | |
| 11387 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11388 | { } |
| 11389 | }; |
| 11390 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11391 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11392 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11393 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11394 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11395 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11396 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11397 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11398 | { } /* end */ |
| 11399 | }; |
| 11400 | |
| 11401 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11402 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11403 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11404 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11405 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11406 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11407 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11409 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11410 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11411 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11412 | {} |
| 11413 | }; |
| 11414 | |
| 11415 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11416 | .num_items = 1, |
| 11417 | .items = { |
| 11418 | { "Line", 0x1 }, |
| 11419 | }, |
| 11420 | }; |
| 11421 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11422 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11423 | #define alc262_hippo_master_update alc262_hp_master_update |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11424 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11425 | #define alc262_hippo_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11426 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11427 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11428 | { \ |
| 11429 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11430 | .name = "Master Playback Switch", \ |
| 11431 | .info = snd_ctl_boolean_mono_info, \ |
| 11432 | .get = alc262_hippo_master_sw_get, \ |
| 11433 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11434 | }, \ |
| 11435 | { \ |
| 11436 | .iface = NID_MAPPING, \ |
| 11437 | .name = "Master Playback Switch", \ |
| 11438 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11439 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11440 | } |
| 11441 | |
| 11442 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11443 | ALC262_HIPPO_MASTER_SWITCH, |
| 11444 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11448 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11450 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11451 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11452 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11453 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11454 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11455 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11456 | { } /* end */ |
| 11457 | }; |
| 11458 | |
| 11459 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11460 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11461 | ALC262_HIPPO_MASTER_SWITCH, |
| 11462 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11463 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11464 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11465 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11466 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11467 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11468 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11469 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11470 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11471 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11472 | { } /* end */ |
| 11473 | }; |
| 11474 | |
| 11475 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11476 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11477 | { |
| 11478 | struct alc_spec *spec = codec->spec; |
| 11479 | |
| 11480 | spec->autocfg.hp_pins[0] = 0x15; |
| 11481 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11482 | spec->automute = 1; |
| 11483 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11484 | } |
| 11485 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11486 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11487 | { |
| 11488 | struct alc_spec *spec = codec->spec; |
| 11489 | |
| 11490 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11491 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11492 | spec->automute = 1; |
| 11493 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11494 | } |
| 11495 | |
| 11496 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11497 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11498 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11499 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11502 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11503 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11504 | { } /* end */ |
| 11505 | }; |
| 11506 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11507 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11508 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11509 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11510 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11511 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11512 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11513 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11514 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11515 | { } /* end */ |
| 11516 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11517 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11518 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11519 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11520 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11521 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11522 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11523 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11524 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11525 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11526 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11527 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11528 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11529 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11530 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11531 | { } /* end */ |
| 11532 | }; |
| 11533 | |
| 11534 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11535 | /* Headphone automute */ |
| 11536 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11537 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11538 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11539 | |
| 11540 | /* P11 AUX_IN, white 4-pin connector */ |
| 11541 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11542 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11543 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11544 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11545 | |
| 11546 | {} |
| 11547 | }; |
| 11548 | |
| 11549 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11550 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11551 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11552 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11553 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11554 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11555 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11556 | spec->automute = 1; |
| 11557 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11558 | } |
| 11559 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11560 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11561 | #define alc262_capture_mixer alc882_capture_mixer |
| 11562 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11563 | |
| 11564 | /* |
| 11565 | * generic initialization of ADC, input mixers and output mixers |
| 11566 | */ |
| 11567 | static struct hda_verb alc262_init_verbs[] = { |
| 11568 | /* |
| 11569 | * Unmute ADC0-2 and set the default input to mic-in |
| 11570 | */ |
| 11571 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11572 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11573 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11574 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11575 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11576 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11577 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11578 | /* 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] | 11579 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11580 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11581 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11582 | */ |
| 11583 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11589 | |
| 11590 | /* |
| 11591 | * Set up output mixers (0x0c - 0x0e) |
| 11592 | */ |
| 11593 | /* set vol=0 to output mixers */ |
| 11594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11596 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11597 | /* set up input amps for analog loopback */ |
| 11598 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11599 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11601 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11602 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11603 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11604 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11605 | |
| 11606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11608 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11609 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11610 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11611 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11612 | |
| 11613 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11614 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11615 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11616 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11617 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11619 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11620 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11621 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11622 | /* FIXME: use matrix-type input source selection */ |
| 11623 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11624 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11625 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11626 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11627 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11629 | /* Input mixer2 */ |
| 11630 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11631 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11632 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11634 | /* Input mixer3 */ |
| 11635 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11637 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11639 | |
| 11640 | { } |
| 11641 | }; |
| 11642 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11643 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11644 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11645 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11646 | { } |
| 11647 | }; |
| 11648 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11649 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11650 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11651 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11652 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11653 | |
| 11654 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11655 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11656 | {} |
| 11657 | }; |
| 11658 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11659 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11660 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11661 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11662 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11663 | |
| 11664 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11665 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11666 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11667 | }; |
| 11668 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11669 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11670 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11671 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11672 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11675 | { } /* end */ |
| 11676 | }; |
| 11677 | |
| 11678 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11679 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11681 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11682 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11683 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11684 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11685 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11686 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11687 | {} |
| 11688 | }; |
| 11689 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11690 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11691 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11692 | struct alc_spec *spec = codec->spec; |
| 11693 | |
| 11694 | spec->autocfg.hp_pins[0] = 0x15; |
| 11695 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11696 | spec->ext_mic.pin = 0x18; |
| 11697 | spec->ext_mic.mux_idx = 0; |
| 11698 | spec->int_mic.pin = 0x12; |
| 11699 | spec->int_mic.mux_idx = 9; |
| 11700 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11701 | spec->automute = 1; |
| 11702 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11703 | } |
| 11704 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11705 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11706 | * nec model |
| 11707 | * 0x15 = headphone |
| 11708 | * 0x16 = internal speaker |
| 11709 | * 0x18 = external mic |
| 11710 | */ |
| 11711 | |
| 11712 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11713 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11714 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11715 | |
| 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("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11719 | |
| 11720 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11722 | { } /* end */ |
| 11723 | }; |
| 11724 | |
| 11725 | static struct hda_verb alc262_nec_verbs[] = { |
| 11726 | /* Unmute Speaker */ |
| 11727 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11728 | |
| 11729 | /* Headphone */ |
| 11730 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11732 | |
| 11733 | /* External mic to headphone */ |
| 11734 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11735 | /* External mic to speaker */ |
| 11736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11737 | {} |
| 11738 | }; |
| 11739 | |
| 11740 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11741 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11742 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11743 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11744 | */ |
| 11745 | |
| 11746 | #define ALC_HP_EVENT 0x37 |
| 11747 | |
| 11748 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11749 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11751 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11752 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11753 | {} |
| 11754 | }; |
| 11755 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11756 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11757 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11758 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11759 | {} |
| 11760 | }; |
| 11761 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11762 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11763 | /* Front Mic pin: input vref at 50% */ |
| 11764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11766 | {} |
| 11767 | }; |
| 11768 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11769 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11770 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11771 | .items = { |
| 11772 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11773 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11774 | { "CD", 0x4 }, |
| 11775 | }, |
| 11776 | }; |
| 11777 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11778 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11779 | .num_items = 5, |
| 11780 | .items = { |
| 11781 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11782 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11783 | { "Line", 0x2 }, |
| 11784 | { "CD", 0x4 }, |
| 11785 | { "AUX IN", 0x6 }, |
| 11786 | }, |
| 11787 | }; |
| 11788 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11789 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11790 | .num_items = 4, |
| 11791 | .items = { |
| 11792 | { "Mic", 0x0 }, |
| 11793 | { "Front Mic", 0x2 }, |
| 11794 | { "Line", 0x1 }, |
| 11795 | { "CD", 0x4 }, |
| 11796 | }, |
| 11797 | }; |
| 11798 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 11799 | static void alc262_fujitsu_setup(struct hda_codec *codec) |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11800 | { |
| 11801 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11802 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 11803 | spec->autocfg.hp_pins[0] = 0x14; |
| 11804 | spec->autocfg.hp_pins[1] = 0x1b; |
| 11805 | spec->autocfg.speaker_pins[0] = 0x15; |
| 11806 | spec->automute = 1; |
| 11807 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11808 | } |
| 11809 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11810 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11811 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11812 | .ops = &snd_hda_bind_vol, |
| 11813 | .values = { |
| 11814 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11815 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11816 | 0 |
| 11817 | }, |
| 11818 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11819 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11820 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11821 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11822 | { |
| 11823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11824 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 11825 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 11826 | .info = snd_ctl_boolean_mono_info, |
| 11827 | .get = alc262_hp_master_sw_get, |
| 11828 | .put = alc262_hp_master_sw_put, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11829 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11830 | { |
| 11831 | .iface = NID_MAPPING, |
| 11832 | .name = "Master Playback Switch", |
| 11833 | .private_value = 0x1b, |
| 11834 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11837 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11840 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11841 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11842 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11843 | { } /* end */ |
| 11844 | }; |
| 11845 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 11846 | static void alc262_lenovo_3000_setup(struct hda_codec *codec) |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11847 | { |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 11848 | struct alc_spec *spec = codec->spec; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11849 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 11850 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11851 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11852 | spec->autocfg.speaker_pins[1] = 0x16; |
| 11853 | spec->automute = 1; |
| 11854 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11855 | } |
| 11856 | |
| 11857 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11858 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11859 | { |
| 11860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11861 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 11862 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b, |
| 11863 | .info = snd_ctl_boolean_mono_info, |
| 11864 | .get = alc262_hp_master_sw_get, |
| 11865 | .put = alc262_hp_master_sw_put, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11866 | }, |
| 11867 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11868 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11869 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11872 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11873 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11874 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11875 | { } /* end */ |
| 11876 | }; |
| 11877 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11878 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11879 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11880 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11881 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11882 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11883 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11884 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11885 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11886 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11887 | { } /* end */ |
| 11888 | }; |
| 11889 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11890 | /* additional init verbs for Benq laptops */ |
| 11891 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11892 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11893 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11894 | {} |
| 11895 | }; |
| 11896 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11897 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11898 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11899 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11900 | |
| 11901 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11902 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11903 | {} |
| 11904 | }; |
| 11905 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11906 | /* Samsung Q1 Ultra Vista model setup */ |
| 11907 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11908 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11909 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11910 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11911 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11912 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 11913 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11914 | { } /* end */ |
| 11915 | }; |
| 11916 | |
| 11917 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11918 | /* output mixer */ |
| 11919 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11920 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11922 | /* speaker */ |
| 11923 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11924 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11925 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11926 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11927 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11930 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11931 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11932 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11933 | /* internal mic */ |
| 11934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11936 | /* ADC, choose mic */ |
| 11937 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11938 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11939 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11940 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11941 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11943 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11945 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11946 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11947 | {} |
| 11948 | }; |
| 11949 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11950 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11951 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11952 | { |
| 11953 | struct alc_spec *spec = codec->spec; |
| 11954 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11955 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11956 | mute = 0; |
| 11957 | /* auto-mute only when HP is used as HP */ |
| 11958 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11959 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11960 | if (spec->jack_present) |
| 11961 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11962 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11963 | /* mute/unmute internal speaker */ |
| 11964 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11965 | HDA_AMP_MUTE, mute); |
| 11966 | /* mute/unmute HP */ |
| 11967 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11968 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11969 | } |
| 11970 | |
| 11971 | /* unsolicited event for HP jack sensing */ |
| 11972 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11973 | unsigned int res) |
| 11974 | { |
| 11975 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11976 | return; |
| 11977 | alc262_ultra_automute(codec); |
| 11978 | } |
| 11979 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11980 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11981 | .num_items = 2, |
| 11982 | .items = { |
| 11983 | { "Mic", 0x1 }, |
| 11984 | { "Headphone", 0x7 }, |
| 11985 | }, |
| 11986 | }; |
| 11987 | |
| 11988 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11989 | struct snd_ctl_elem_value *ucontrol) |
| 11990 | { |
| 11991 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11992 | struct alc_spec *spec = codec->spec; |
| 11993 | int ret; |
| 11994 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11995 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11996 | if (!ret) |
| 11997 | return 0; |
| 11998 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11999 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12000 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12001 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12002 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12003 | return ret; |
| 12004 | } |
| 12005 | |
| 12006 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12007 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12008 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12009 | { |
| 12010 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12011 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12012 | .info = alc_mux_enum_info, |
| 12013 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12014 | .put = alc262_ultra_mux_enum_put, |
| 12015 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12016 | { |
| 12017 | .iface = NID_MAPPING, |
| 12018 | .name = "Capture Source", |
| 12019 | .private_value = 0x15, |
| 12020 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12021 | { } /* end */ |
| 12022 | }; |
| 12023 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12024 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12025 | * and thus it's bound with a different mixer. |
| 12026 | * This function returns which mixer amp should be used. |
| 12027 | */ |
| 12028 | static int alc262_check_volbit(hda_nid_t nid) |
| 12029 | { |
| 12030 | if (!nid) |
| 12031 | return 0; |
| 12032 | else if (nid == 0x16) |
| 12033 | return 2; |
| 12034 | else |
| 12035 | return 1; |
| 12036 | } |
| 12037 | |
| 12038 | 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] | 12039 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12040 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12041 | unsigned long val; |
| 12042 | int vbit; |
| 12043 | |
| 12044 | vbit = alc262_check_volbit(nid); |
| 12045 | if (!vbit) |
| 12046 | return 0; |
| 12047 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12048 | return 0; |
| 12049 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12050 | if (vbit == 2) |
| 12051 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12052 | else |
| 12053 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12054 | 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] | 12055 | } |
| 12056 | |
| 12057 | 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] | 12058 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12059 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12060 | unsigned long val; |
| 12061 | |
| 12062 | if (!nid) |
| 12063 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12064 | if (nid == 0x16) |
| 12065 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12066 | else |
| 12067 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12068 | 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] | 12069 | } |
| 12070 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12071 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12072 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12073 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12074 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12075 | const char *pfx; |
| 12076 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12077 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12078 | |
| 12079 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12080 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12081 | spec->multiout.dac_nids[0] = 2; |
| 12082 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 12083 | pfx = alc_get_line_out_pfx(spec, true); |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12084 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12085 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12086 | for (i = 0; i < 2; i++) { |
| 12087 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12088 | if (err < 0) |
| 12089 | return err; |
| 12090 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12091 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12092 | "Speaker", i); |
| 12093 | if (err < 0) |
| 12094 | return err; |
| 12095 | } |
| 12096 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12097 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12098 | "Headphone", i); |
| 12099 | if (err < 0) |
| 12100 | return err; |
| 12101 | } |
| 12102 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12103 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12104 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12105 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12106 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12107 | if (vbits == 1 || vbits == 2) |
| 12108 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12109 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12110 | for (i = 0; i < 2; i++) { |
| 12111 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12112 | &vbits, i); |
| 12113 | if (err < 0) |
| 12114 | return err; |
| 12115 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12116 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12117 | "Speaker", &vbits, i); |
| 12118 | if (err < 0) |
| 12119 | return err; |
| 12120 | } |
| 12121 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12122 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12123 | "Headphone", &vbits, i); |
| 12124 | if (err < 0) |
| 12125 | return err; |
| 12126 | } |
| 12127 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12128 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12129 | } |
| 12130 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12131 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12132 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12133 | |
| 12134 | /* |
| 12135 | * generic initialization of ADC, input mixers and output mixers |
| 12136 | */ |
| 12137 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12138 | /* |
| 12139 | * Unmute ADC0-2 and set the default input to mic-in |
| 12140 | */ |
| 12141 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12143 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12145 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12146 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12147 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12148 | /* 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] | 12149 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12150 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12151 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12152 | */ |
| 12153 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12154 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12155 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12156 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12157 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12158 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12159 | |
| 12160 | /* |
| 12161 | * Set up output mixers (0x0c - 0x0f) |
| 12162 | */ |
| 12163 | /* set vol=0 to output mixers */ |
| 12164 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12165 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12166 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12168 | /* set up input amps for analog loopback */ |
| 12169 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12170 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12171 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12172 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12173 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12174 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12175 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12176 | |
| 12177 | /* FIXME: use matrix-type input source selection */ |
| 12178 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12179 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12180 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12181 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12182 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12183 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12184 | /* Input mixer2 */ |
| 12185 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12186 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12188 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12189 | /* Input mixer3 */ |
| 12190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12194 | |
| 12195 | { } |
| 12196 | }; |
| 12197 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12198 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12199 | /* |
| 12200 | * Unmute ADC0-2 and set the default input to mic-in |
| 12201 | */ |
| 12202 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12203 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12204 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12205 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12206 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12207 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12208 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12209 | /* 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] | 12210 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12211 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12212 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12213 | */ |
| 12214 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12222 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12223 | /* |
| 12224 | * Set up output mixers (0x0c - 0x0e) |
| 12225 | */ |
| 12226 | /* set vol=0 to output mixers */ |
| 12227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12229 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12230 | |
| 12231 | /* set up input amps for analog loopback */ |
| 12232 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12235 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12236 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12237 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12238 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12239 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12240 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12241 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12242 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12243 | |
| 12244 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12245 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12246 | |
| 12247 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12248 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12249 | |
| 12250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12251 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12252 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12253 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12254 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12255 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12256 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12257 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12258 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12259 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12260 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12261 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12262 | |
| 12263 | |
| 12264 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12265 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12266 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12267 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12268 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12269 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12270 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12271 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12272 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12273 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12274 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12275 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12276 | /* Input mixer2 */ |
| 12277 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12278 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12279 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12280 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12281 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12282 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12283 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12284 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12285 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12286 | /* Input mixer3 */ |
| 12287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12288 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12289 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12291 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12292 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12293 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12294 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12295 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12296 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12297 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12298 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12299 | { } |
| 12300 | }; |
| 12301 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12302 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12303 | /* |
| 12304 | * Unmute ADC0-2 and set the default input to mic-in |
| 12305 | */ |
| 12306 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12307 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12308 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12309 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12310 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12311 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12312 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12313 | /* 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] | 12314 | * mixer widget |
| 12315 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12316 | * panel mic (mic 2) |
| 12317 | */ |
| 12318 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12319 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12320 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12321 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12327 | /* |
| 12328 | * Set up output mixers (0x0c - 0x0e) |
| 12329 | */ |
| 12330 | /* set vol=0 to output mixers */ |
| 12331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12334 | |
| 12335 | /* set up input amps for analog loopback */ |
| 12336 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12339 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12340 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12341 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12342 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12343 | |
| 12344 | |
| 12345 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12346 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12347 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12348 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12349 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12350 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12351 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12352 | |
| 12353 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12354 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12355 | |
| 12356 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12357 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12358 | |
| 12359 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12360 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12361 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12362 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12363 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12364 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12365 | |
| 12366 | /* FIXME: use matrix-type input source selection */ |
| 12367 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12368 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12369 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12370 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12371 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12372 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12373 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12374 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12376 | /* Input mixer2 */ |
| 12377 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12378 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12379 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12381 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12382 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12383 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12384 | /* Input mixer3 */ |
| 12385 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12389 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12390 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12391 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12392 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12393 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12394 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12395 | { } |
| 12396 | }; |
| 12397 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12398 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12399 | |
| 12400 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12401 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12402 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12403 | |
| 12404 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12405 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12406 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12407 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12408 | |
| 12409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12410 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12411 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12412 | {} |
| 12413 | }; |
| 12414 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12415 | /* |
| 12416 | * Pin config fixes |
| 12417 | */ |
| 12418 | enum { |
| 12419 | PINFIX_FSC_H270, |
| 12420 | }; |
| 12421 | |
| 12422 | static const struct alc_fixup alc262_fixups[] = { |
| 12423 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12424 | .type = ALC_FIXUP_PINS, |
| 12425 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12426 | { 0x14, 0x99130110 }, /* speaker */ |
| 12427 | { 0x15, 0x0221142f }, /* front HP */ |
| 12428 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12429 | { } |
| 12430 | } |
| 12431 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12432 | }; |
| 12433 | |
| 12434 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12435 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12436 | {} |
| 12437 | }; |
| 12438 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12439 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12440 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12441 | #define alc262_loopbacks alc880_loopbacks |
| 12442 | #endif |
| 12443 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12444 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12445 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12446 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12447 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12448 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12449 | |
| 12450 | /* |
| 12451 | * BIOS auto configuration |
| 12452 | */ |
| 12453 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12454 | { |
| 12455 | struct alc_spec *spec = codec->spec; |
| 12456 | int err; |
| 12457 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12458 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12459 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12460 | alc262_ignore); |
| 12461 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12462 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12463 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12464 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12465 | spec->multiout.max_channels = 2; |
| 12466 | spec->no_analog = 1; |
| 12467 | goto dig_only; |
| 12468 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12469 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12470 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12471 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12472 | if (err < 0) |
| 12473 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12474 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12475 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12476 | return err; |
| 12477 | |
| 12478 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12479 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12480 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12481 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12482 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12483 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12484 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12485 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12486 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12487 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12488 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12489 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12490 | err = alc_auto_add_mic_boost(codec); |
| 12491 | if (err < 0) |
| 12492 | return err; |
| 12493 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12494 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12495 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12496 | return 1; |
| 12497 | } |
| 12498 | |
| 12499 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12500 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12501 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12502 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12503 | |
| 12504 | |
| 12505 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12506 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12507 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12508 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12509 | alc262_auto_init_multi_out(codec); |
| 12510 | alc262_auto_init_hp_out(codec); |
| 12511 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12512 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12513 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12514 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12515 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12516 | } |
| 12517 | |
| 12518 | /* |
| 12519 | * configuration and preset |
| 12520 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12521 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12522 | [ALC262_BASIC] = "basic", |
| 12523 | [ALC262_HIPPO] = "hippo", |
| 12524 | [ALC262_HIPPO_1] = "hippo_1", |
| 12525 | [ALC262_FUJITSU] = "fujitsu", |
| 12526 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12527 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12528 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12529 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12530 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12531 | [ALC262_BENQ_T31] = "benq-t31", |
| 12532 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12533 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12534 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12535 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12536 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12537 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12538 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12539 | [ALC262_AUTO] = "auto", |
| 12540 | }; |
| 12541 | |
| 12542 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12543 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12544 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12545 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12546 | ALC262_HP_BPC), |
| 12547 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12548 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12549 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12550 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12551 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12552 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12553 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12554 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12555 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12556 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12557 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12558 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12559 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12560 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12561 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12562 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12563 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12564 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12565 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12566 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12567 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12568 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12569 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12570 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12571 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12572 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12573 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12574 | #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] | 12575 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12576 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12577 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12578 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12579 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12580 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12581 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12582 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12583 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12584 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12585 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12586 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12587 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12588 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12589 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12590 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12591 | {} |
| 12592 | }; |
| 12593 | |
| 12594 | static struct alc_config_preset alc262_presets[] = { |
| 12595 | [ALC262_BASIC] = { |
| 12596 | .mixers = { alc262_base_mixer }, |
| 12597 | .init_verbs = { alc262_init_verbs }, |
| 12598 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12599 | .dac_nids = alc262_dac_nids, |
| 12600 | .hp_nid = 0x03, |
| 12601 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12602 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12603 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12604 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12605 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12606 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12607 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12608 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12609 | .dac_nids = alc262_dac_nids, |
| 12610 | .hp_nid = 0x03, |
| 12611 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12612 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12613 | .channel_mode = alc262_modes, |
| 12614 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12615 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12616 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12617 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12618 | }, |
| 12619 | [ALC262_HIPPO_1] = { |
| 12620 | .mixers = { alc262_hippo1_mixer }, |
| 12621 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12622 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12623 | .dac_nids = alc262_dac_nids, |
| 12624 | .hp_nid = 0x02, |
| 12625 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12626 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12627 | .channel_mode = alc262_modes, |
| 12628 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12629 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12630 | .setup = alc262_hippo1_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12631 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12632 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12633 | [ALC262_FUJITSU] = { |
| 12634 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12635 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12636 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12637 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12638 | .dac_nids = alc262_dac_nids, |
| 12639 | .hp_nid = 0x03, |
| 12640 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12641 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12642 | .channel_mode = alc262_modes, |
| 12643 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 12644 | .unsol_event = alc_sku_unsol_event, |
| 12645 | .setup = alc262_fujitsu_setup, |
| 12646 | .init_hook = alc_inithook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12647 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12648 | [ALC262_HP_BPC] = { |
| 12649 | .mixers = { alc262_HP_BPC_mixer }, |
| 12650 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12651 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12652 | .dac_nids = alc262_dac_nids, |
| 12653 | .hp_nid = 0x03, |
| 12654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12655 | .channel_mode = alc262_modes, |
| 12656 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12657 | .unsol_event = alc_sku_unsol_event, |
| 12658 | .setup = alc262_hp_bpc_setup, |
| 12659 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12660 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12661 | [ALC262_HP_BPC_D7000_WF] = { |
| 12662 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12663 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12664 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12665 | .dac_nids = alc262_dac_nids, |
| 12666 | .hp_nid = 0x03, |
| 12667 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12668 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12669 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12670 | .unsol_event = alc_sku_unsol_event, |
| 12671 | .setup = alc262_hp_wildwest_setup, |
| 12672 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12673 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12674 | [ALC262_HP_BPC_D7000_WL] = { |
| 12675 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12676 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12677 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12678 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12679 | .dac_nids = alc262_dac_nids, |
| 12680 | .hp_nid = 0x03, |
| 12681 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12682 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12683 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12684 | .unsol_event = alc_sku_unsol_event, |
| 12685 | .setup = alc262_hp_wildwest_setup, |
| 12686 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12687 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12688 | [ALC262_HP_TC_T5735] = { |
| 12689 | .mixers = { alc262_hp_t5735_mixer }, |
| 12690 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12691 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12692 | .dac_nids = alc262_dac_nids, |
| 12693 | .hp_nid = 0x03, |
| 12694 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12695 | .channel_mode = alc262_modes, |
| 12696 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12697 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12698 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12699 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12700 | }, |
| 12701 | [ALC262_HP_RP5700] = { |
| 12702 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12703 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12704 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12705 | .dac_nids = alc262_dac_nids, |
| 12706 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12707 | .channel_mode = alc262_modes, |
| 12708 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12709 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12710 | [ALC262_BENQ_ED8] = { |
| 12711 | .mixers = { alc262_base_mixer }, |
| 12712 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12713 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12714 | .dac_nids = alc262_dac_nids, |
| 12715 | .hp_nid = 0x03, |
| 12716 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12717 | .channel_mode = alc262_modes, |
| 12718 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12719 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12720 | [ALC262_SONY_ASSAMD] = { |
| 12721 | .mixers = { alc262_sony_mixer }, |
| 12722 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12723 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12724 | .dac_nids = alc262_dac_nids, |
| 12725 | .hp_nid = 0x02, |
| 12726 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12727 | .channel_mode = alc262_modes, |
| 12728 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12729 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12730 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12731 | .init_hook = alc_inithook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12732 | }, |
| 12733 | [ALC262_BENQ_T31] = { |
| 12734 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12735 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12736 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12737 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12738 | .dac_nids = alc262_dac_nids, |
| 12739 | .hp_nid = 0x03, |
| 12740 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12741 | .channel_mode = alc262_modes, |
| 12742 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12743 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12744 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12745 | .init_hook = alc_inithook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12746 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12747 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12748 | .mixers = { alc262_ultra_mixer }, |
| 12749 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12750 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12751 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12752 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12753 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12754 | .channel_mode = alc262_modes, |
| 12755 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12756 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12757 | .capsrc_nids = alc262_capsrc_nids, |
| 12758 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12759 | .unsol_event = alc262_ultra_unsol_event, |
| 12760 | .init_hook = alc262_ultra_automute, |
| 12761 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12762 | [ALC262_LENOVO_3000] = { |
| 12763 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12764 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12765 | alc262_lenovo_3000_unsol_verbs, |
| 12766 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12767 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12768 | .dac_nids = alc262_dac_nids, |
| 12769 | .hp_nid = 0x03, |
| 12770 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12771 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12772 | .channel_mode = alc262_modes, |
| 12773 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 12774 | .unsol_event = alc_sku_unsol_event, |
| 12775 | .setup = alc262_lenovo_3000_setup, |
| 12776 | .init_hook = alc_inithook, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12777 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12778 | [ALC262_NEC] = { |
| 12779 | .mixers = { alc262_nec_mixer }, |
| 12780 | .init_verbs = { alc262_nec_verbs }, |
| 12781 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12782 | .dac_nids = alc262_dac_nids, |
| 12783 | .hp_nid = 0x03, |
| 12784 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12785 | .channel_mode = alc262_modes, |
| 12786 | .input_mux = &alc262_capture_source, |
| 12787 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12788 | [ALC262_TOSHIBA_S06] = { |
| 12789 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12790 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12791 | alc262_eapd_verbs }, |
| 12792 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12793 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12794 | .dac_nids = alc262_dac_nids, |
| 12795 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12796 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12797 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12798 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12799 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12800 | .unsol_event = alc_sku_unsol_event, |
| 12801 | .setup = alc262_toshiba_s06_setup, |
| 12802 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12803 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12804 | [ALC262_TOSHIBA_RX1] = { |
| 12805 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12806 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12807 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12808 | .dac_nids = alc262_dac_nids, |
| 12809 | .hp_nid = 0x03, |
| 12810 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12811 | .channel_mode = alc262_modes, |
| 12812 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12813 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12814 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12815 | .init_hook = alc_inithook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12816 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12817 | [ALC262_TYAN] = { |
| 12818 | .mixers = { alc262_tyan_mixer }, |
| 12819 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12820 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12821 | .dac_nids = alc262_dac_nids, |
| 12822 | .hp_nid = 0x02, |
| 12823 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12824 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12825 | .channel_mode = alc262_modes, |
| 12826 | .input_mux = &alc262_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12827 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12828 | .setup = alc262_tyan_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12829 | .init_hook = alc_hp_automute, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12830 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12831 | }; |
| 12832 | |
| 12833 | static int patch_alc262(struct hda_codec *codec) |
| 12834 | { |
| 12835 | struct alc_spec *spec; |
| 12836 | int board_config; |
| 12837 | int err; |
| 12838 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12839 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12840 | if (spec == NULL) |
| 12841 | return -ENOMEM; |
| 12842 | |
| 12843 | codec->spec = spec; |
| 12844 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12845 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12846 | * under-run |
| 12847 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12848 | { |
| 12849 | int tmp; |
| 12850 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12851 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12852 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12853 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12854 | } |
| 12855 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12856 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12857 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12858 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12859 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12860 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12861 | alc262_models, |
| 12862 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12863 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12864 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12865 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12866 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12867 | board_config = ALC262_AUTO; |
| 12868 | } |
| 12869 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12870 | if (board_config == ALC262_AUTO) { |
| 12871 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12872 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12873 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12874 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12875 | if (board_config == ALC262_AUTO) { |
| 12876 | /* automatic parse from the BIOS config */ |
| 12877 | err = alc262_parse_auto_config(codec); |
| 12878 | if (err < 0) { |
| 12879 | alc_free(codec); |
| 12880 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12881 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12882 | printk(KERN_INFO |
| 12883 | "hda_codec: Cannot set up configuration " |
| 12884 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12885 | board_config = ALC262_BASIC; |
| 12886 | } |
| 12887 | } |
| 12888 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12889 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12890 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12891 | if (err < 0) { |
| 12892 | alc_free(codec); |
| 12893 | return err; |
| 12894 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12895 | } |
| 12896 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12897 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12898 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12899 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12900 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12901 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12902 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12903 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12904 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12905 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12906 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12907 | int i; |
| 12908 | /* check whether the digital-mic has to be supported */ |
| 12909 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12910 | if (spec->input_mux->items[i].index >= 9) |
| 12911 | break; |
| 12912 | } |
| 12913 | if (i < spec->input_mux->num_items) { |
| 12914 | /* use only ADC0 */ |
| 12915 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12916 | spec->num_adc_nids = 1; |
| 12917 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12918 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12919 | /* all analog inputs */ |
| 12920 | /* check whether NID 0x07 is valid */ |
| 12921 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12922 | |
| 12923 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12924 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12925 | if (wcap != AC_WID_AUD_IN) { |
| 12926 | spec->adc_nids = alc262_adc_nids_alt; |
| 12927 | spec->num_adc_nids = |
| 12928 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12929 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12930 | } else { |
| 12931 | spec->adc_nids = alc262_adc_nids; |
| 12932 | spec->num_adc_nids = |
| 12933 | ARRAY_SIZE(alc262_adc_nids); |
| 12934 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12935 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12936 | } |
| 12937 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12938 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12939 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12940 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12941 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12942 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12943 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12944 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12945 | spec->vmaster_nid = 0x0c; |
| 12946 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12947 | codec->patch_ops = alc_patch_ops; |
| 12948 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12949 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 12950 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 12951 | |
| 12952 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12953 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12954 | if (!spec->loopback.amplist) |
| 12955 | spec->loopback.amplist = alc262_loopbacks; |
| 12956 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12957 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12958 | return 0; |
| 12959 | } |
| 12960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12961 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12962 | * ALC268 channel source setting (2 channel) |
| 12963 | */ |
| 12964 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12965 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12966 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12967 | static hda_nid_t alc268_dac_nids[2] = { |
| 12968 | /* front, hp */ |
| 12969 | 0x02, 0x03 |
| 12970 | }; |
| 12971 | |
| 12972 | static hda_nid_t alc268_adc_nids[2] = { |
| 12973 | /* ADC0-1 */ |
| 12974 | 0x08, 0x07 |
| 12975 | }; |
| 12976 | |
| 12977 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12978 | /* ADC0 */ |
| 12979 | 0x08 |
| 12980 | }; |
| 12981 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12982 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12983 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12984 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12985 | /* output mixer control */ |
| 12986 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12987 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12988 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12989 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12990 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 12991 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12992 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12993 | { } |
| 12994 | }; |
| 12995 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12996 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12997 | /* output mixer control */ |
| 12998 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12999 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13000 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13001 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13002 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13003 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13004 | { } |
| 13005 | }; |
| 13006 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13007 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13008 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13009 | .ops = &snd_hda_bind_sw, |
| 13010 | .values = { |
| 13011 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13012 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13013 | 0 |
| 13014 | }, |
| 13015 | }; |
| 13016 | |
| 13017 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13018 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13019 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13020 | { } |
| 13021 | }; |
| 13022 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13023 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13024 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13025 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13026 | { } |
| 13027 | }; |
| 13028 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13029 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13030 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13031 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13032 | { } /* end */ |
| 13033 | }; |
| 13034 | |
| 13035 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13036 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13037 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13038 | .ops = &snd_hda_bind_vol, |
| 13039 | .values = { |
| 13040 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13041 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13042 | 0 |
| 13043 | }, |
| 13044 | }; |
| 13045 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13046 | static void alc268_acer_setup(struct hda_codec *codec) |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13047 | { |
| 13048 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13049 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13050 | spec->autocfg.hp_pins[0] = 0x14; |
| 13051 | spec->autocfg.speaker_pins[0] = 0x15; |
| 13052 | spec->automute = 1; |
| 13053 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13054 | } |
| 13055 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13056 | #define alc268_acer_master_sw_get alc262_hp_master_sw_get |
| 13057 | #define alc268_acer_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13058 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13059 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13060 | /* output mixer control */ |
| 13061 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13062 | { |
| 13063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13064 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13065 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x15, |
| 13066 | .info = snd_ctl_boolean_mono_info, |
| 13067 | .get = alc268_acer_master_sw_get, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13068 | .put = alc268_acer_master_sw_put, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13069 | }, |
| 13070 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13071 | { } |
| 13072 | }; |
| 13073 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13074 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13075 | /* output mixer control */ |
| 13076 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13077 | { |
| 13078 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13079 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13080 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13081 | .info = snd_ctl_boolean_mono_info, |
| 13082 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13083 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13084 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13085 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13086 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13087 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13088 | { } |
| 13089 | }; |
| 13090 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13091 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13092 | /* output mixer control */ |
| 13093 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13094 | { |
| 13095 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13096 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13097 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13098 | .info = snd_ctl_boolean_mono_info, |
| 13099 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13100 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13101 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13102 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13103 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13104 | { } |
| 13105 | }; |
| 13106 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13107 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13108 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13110 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13111 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13112 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13113 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13114 | { } |
| 13115 | }; |
| 13116 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13117 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13118 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13119 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13122 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13123 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13124 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13125 | { } |
| 13126 | }; |
| 13127 | |
| 13128 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13129 | #define alc268_toshiba_setup alc262_hippo_setup |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13130 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13131 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13132 | { |
| 13133 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13134 | spec->autocfg.hp_pins[0] = 0x15; |
| 13135 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13136 | spec->automute_mixer_nid[0] = 0x0f; |
| 13137 | spec->automute = 1; |
| 13138 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13139 | spec->ext_mic.pin = 0x18; |
| 13140 | spec->ext_mic.mux_idx = 0; |
| 13141 | spec->int_mic.pin = 0x12; |
| 13142 | spec->int_mic.mux_idx = 6; |
| 13143 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13144 | } |
| 13145 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13146 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13147 | /* output mixer control */ |
| 13148 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13149 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13150 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13151 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13152 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13153 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13154 | { } |
| 13155 | }; |
| 13156 | |
| 13157 | static struct hda_verb alc268_dell_verbs[] = { |
| 13158 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13159 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13160 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13161 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13162 | { } |
| 13163 | }; |
| 13164 | |
| 13165 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13166 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13167 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13168 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13169 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13170 | spec->autocfg.hp_pins[0] = 0x15; |
| 13171 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13172 | spec->ext_mic.pin = 0x18; |
| 13173 | spec->ext_mic.mux_idx = 0; |
| 13174 | spec->int_mic.pin = 0x19; |
| 13175 | spec->int_mic.mux_idx = 1; |
| 13176 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13177 | spec->automute = 1; |
| 13178 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13179 | } |
| 13180 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13181 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13182 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13183 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13184 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13186 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13187 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13188 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13189 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13190 | { } |
| 13191 | }; |
| 13192 | |
| 13193 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13194 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13195 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13196 | { } |
| 13197 | }; |
| 13198 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13199 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13200 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13201 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13202 | spec->autocfg.hp_pins[0] = 0x15; |
| 13203 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13204 | spec->ext_mic.pin = 0x18; |
| 13205 | spec->ext_mic.mux_idx = 0; |
| 13206 | spec->int_mic.pin = 0x19; |
| 13207 | spec->int_mic.mux_idx = 1; |
| 13208 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13209 | spec->automute = 1; |
| 13210 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13211 | } |
| 13212 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13213 | /* |
| 13214 | * generic initialization of ADC, input mixers and output mixers |
| 13215 | */ |
| 13216 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13217 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13218 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13219 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13220 | |
| 13221 | /* |
| 13222 | * Set up output mixers (0x0c - 0x0e) |
| 13223 | */ |
| 13224 | /* set vol=0 to output mixers */ |
| 13225 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13226 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13227 | |
| 13228 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13229 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13230 | |
| 13231 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13233 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13234 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13235 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13236 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13237 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13238 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13239 | |
| 13240 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13241 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13242 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13243 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13244 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13245 | |
| 13246 | /* set PCBEEP vol = 0, mute connections */ |
| 13247 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13248 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13249 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13250 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13251 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13252 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13253 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13254 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13255 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13257 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13258 | { } |
| 13259 | }; |
| 13260 | |
| 13261 | /* |
| 13262 | * generic initialization of ADC, input mixers and output mixers |
| 13263 | */ |
| 13264 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13265 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13266 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13267 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13268 | |
| 13269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13272 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13273 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13274 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13275 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13276 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13277 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13278 | |
| 13279 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13280 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13281 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13282 | /* set PCBEEP vol = 0, mute connections */ |
| 13283 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13284 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13285 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13286 | |
| 13287 | { } |
| 13288 | }; |
| 13289 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13290 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13291 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13292 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13293 | { } /* end */ |
| 13294 | }; |
| 13295 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13296 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13297 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13298 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13299 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13300 | { } /* end */ |
| 13301 | }; |
| 13302 | |
| 13303 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13304 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13305 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13306 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13307 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13308 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13309 | { } /* end */ |
| 13310 | }; |
| 13311 | |
| 13312 | static struct hda_input_mux alc268_capture_source = { |
| 13313 | .num_items = 4, |
| 13314 | .items = { |
| 13315 | { "Mic", 0x0 }, |
| 13316 | { "Front Mic", 0x1 }, |
| 13317 | { "Line", 0x2 }, |
| 13318 | { "CD", 0x3 }, |
| 13319 | }, |
| 13320 | }; |
| 13321 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13322 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13323 | .num_items = 3, |
| 13324 | .items = { |
| 13325 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13326 | { "Internal Mic", 0x1 }, |
| 13327 | { "Line", 0x2 }, |
| 13328 | }, |
| 13329 | }; |
| 13330 | |
| 13331 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13332 | .num_items = 3, |
| 13333 | .items = { |
| 13334 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13335 | { "Internal Mic", 0x6 }, |
| 13336 | { "Line", 0x2 }, |
| 13337 | }, |
| 13338 | }; |
| 13339 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13340 | #ifdef CONFIG_SND_DEBUG |
| 13341 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13342 | /* Volume widgets */ |
| 13343 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13344 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13345 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13346 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13347 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13348 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13349 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13350 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13351 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13352 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13353 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13354 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13355 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13356 | /* The below appears problematic on some hardwares */ |
| 13357 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13358 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13359 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13360 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13361 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13362 | |
| 13363 | /* Modes for retasking pin widgets */ |
| 13364 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13365 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13366 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13367 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13368 | |
| 13369 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13370 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13371 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13372 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13373 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13374 | |
| 13375 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13376 | * The ALC268 does not have an SPDIF input. |
| 13377 | */ |
| 13378 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13379 | |
| 13380 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13381 | * this output to turn on an external amplifier. |
| 13382 | */ |
| 13383 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13384 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13385 | |
| 13386 | { } /* end */ |
| 13387 | }; |
| 13388 | #endif |
| 13389 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13390 | /* create input playback/capture controls for the given pin */ |
| 13391 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13392 | const char *ctlname, int idx) |
| 13393 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13394 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13395 | int err; |
| 13396 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13397 | switch (nid) { |
| 13398 | case 0x14: |
| 13399 | case 0x16: |
| 13400 | dac = 0x02; |
| 13401 | break; |
| 13402 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13403 | case 0x1a: /* ALC259/269 only */ |
| 13404 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13405 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13406 | dac = 0x03; |
| 13407 | break; |
| 13408 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13409 | snd_printd(KERN_WARNING "hda_codec: " |
| 13410 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13411 | return 0; |
| 13412 | } |
| 13413 | if (spec->multiout.dac_nids[0] != dac && |
| 13414 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13415 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13416 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13417 | HDA_OUTPUT)); |
| 13418 | if (err < 0) |
| 13419 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13420 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13421 | } |
| 13422 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13423 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13424 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13425 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13426 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13427 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13428 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13429 | if (err < 0) |
| 13430 | return err; |
| 13431 | return 0; |
| 13432 | } |
| 13433 | |
| 13434 | /* add playback controls from the parsed DAC table */ |
| 13435 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13436 | const struct auto_pin_cfg *cfg) |
| 13437 | { |
| 13438 | hda_nid_t nid; |
| 13439 | int err; |
| 13440 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13441 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13442 | |
| 13443 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13444 | if (nid) { |
| 13445 | const char *name; |
| 13446 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13447 | name = "Speaker"; |
| 13448 | else |
| 13449 | name = "Front"; |
| 13450 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13451 | if (err < 0) |
| 13452 | return err; |
| 13453 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13454 | |
| 13455 | nid = cfg->speaker_pins[0]; |
| 13456 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13457 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13458 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13459 | if (err < 0) |
| 13460 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13461 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13462 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13463 | if (err < 0) |
| 13464 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13465 | } |
| 13466 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13467 | if (nid) { |
| 13468 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13469 | if (err < 0) |
| 13470 | return err; |
| 13471 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13472 | |
| 13473 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13474 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13475 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13476 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13477 | if (err < 0) |
| 13478 | return err; |
| 13479 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13480 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13481 | } |
| 13482 | |
| 13483 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13484 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13485 | const struct auto_pin_cfg *cfg) |
| 13486 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13487 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13488 | } |
| 13489 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13490 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13491 | hda_nid_t nid, int pin_type) |
| 13492 | { |
| 13493 | int idx; |
| 13494 | |
| 13495 | alc_set_pin_output(codec, nid, pin_type); |
| 13496 | if (nid == 0x14 || nid == 0x16) |
| 13497 | idx = 0; |
| 13498 | else |
| 13499 | idx = 1; |
| 13500 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13501 | } |
| 13502 | |
| 13503 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13504 | { |
| 13505 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13506 | int i; |
| 13507 | |
| 13508 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13509 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13510 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13511 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13512 | } |
| 13513 | } |
| 13514 | |
| 13515 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13516 | { |
| 13517 | struct alc_spec *spec = codec->spec; |
| 13518 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13519 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13520 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13521 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13522 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13523 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13524 | } |
| 13525 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13526 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13527 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13528 | } |
| 13529 | if (spec->autocfg.mono_out_pin) |
| 13530 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13531 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13532 | } |
| 13533 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13534 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13535 | { |
| 13536 | struct alc_spec *spec = codec->spec; |
| 13537 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13538 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13539 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13540 | unsigned int dac_vol1, dac_vol2; |
| 13541 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13542 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13543 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13544 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13545 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13546 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13547 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13548 | AMP_IN_UNMUTE(1)); |
| 13549 | snd_hda_codec_write(codec, 0x10, 0, |
| 13550 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13551 | AMP_IN_UNMUTE(1)); |
| 13552 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13553 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13554 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13555 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13556 | snd_hda_codec_write(codec, 0x10, 0, |
| 13557 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13558 | } |
| 13559 | |
| 13560 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13561 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13562 | dac_vol2 = AMP_OUT_ZERO; |
| 13563 | else if (line_nid == 0x15) |
| 13564 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13565 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13566 | dac_vol2 = AMP_OUT_ZERO; |
| 13567 | else if (hp_nid == 0x15) |
| 13568 | dac_vol1 = AMP_OUT_ZERO; |
| 13569 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13570 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13571 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13572 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13573 | |
| 13574 | snd_hda_codec_write(codec, 0x02, 0, |
| 13575 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13576 | snd_hda_codec_write(codec, 0x03, 0, |
| 13577 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13578 | } |
| 13579 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13580 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13581 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13582 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13583 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13584 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13585 | |
| 13586 | /* |
| 13587 | * BIOS auto configuration |
| 13588 | */ |
| 13589 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13590 | { |
| 13591 | struct alc_spec *spec = codec->spec; |
| 13592 | int err; |
| 13593 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13594 | |
| 13595 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13596 | alc268_ignore); |
| 13597 | if (err < 0) |
| 13598 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13599 | if (!spec->autocfg.line_outs) { |
| 13600 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13601 | spec->multiout.max_channels = 2; |
| 13602 | spec->no_analog = 1; |
| 13603 | goto dig_only; |
| 13604 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13605 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13606 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13607 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13608 | if (err < 0) |
| 13609 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13610 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13611 | if (err < 0) |
| 13612 | return err; |
| 13613 | |
| 13614 | spec->multiout.max_channels = 2; |
| 13615 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13616 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13617 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13618 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13619 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13620 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13621 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13622 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13623 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13624 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13625 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13626 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13627 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13628 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13629 | err = alc_auto_add_mic_boost(codec); |
| 13630 | if (err < 0) |
| 13631 | return err; |
| 13632 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13633 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13634 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13635 | return 1; |
| 13636 | } |
| 13637 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13638 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13639 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13640 | |
| 13641 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13642 | static void alc268_auto_init(struct hda_codec *codec) |
| 13643 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13644 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13645 | alc268_auto_init_multi_out(codec); |
| 13646 | alc268_auto_init_hp_out(codec); |
| 13647 | alc268_auto_init_mono_speaker_out(codec); |
| 13648 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13649 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13650 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13651 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13652 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13653 | } |
| 13654 | |
| 13655 | /* |
| 13656 | * configuration and preset |
| 13657 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13658 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13659 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13660 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13661 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13662 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13663 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13664 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13665 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13666 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13667 | #ifdef CONFIG_SND_DEBUG |
| 13668 | [ALC268_TEST] = "test", |
| 13669 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13670 | [ALC268_AUTO] = "auto", |
| 13671 | }; |
| 13672 | |
| 13673 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13674 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13675 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13676 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13677 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13678 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13679 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13680 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13681 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13682 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13683 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13684 | /* almost compatible with toshiba but with optional digital outs; |
| 13685 | * auto-probing seems working fine |
| 13686 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13687 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13688 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13689 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13690 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13691 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13692 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13693 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13694 | {} |
| 13695 | }; |
| 13696 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13697 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13698 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13699 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13700 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13701 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13702 | ALC268_TOSHIBA), |
| 13703 | {} |
| 13704 | }; |
| 13705 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13706 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13707 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13708 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13709 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13710 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13711 | alc267_quanta_il1_verbs }, |
| 13712 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13713 | .dac_nids = alc268_dac_nids, |
| 13714 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13715 | .adc_nids = alc268_adc_nids_alt, |
| 13716 | .hp_nid = 0x03, |
| 13717 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13718 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13719 | .unsol_event = alc_sku_unsol_event, |
| 13720 | .setup = alc267_quanta_il1_setup, |
| 13721 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13722 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13723 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13724 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13725 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13726 | .init_verbs = { alc268_base_init_verbs }, |
| 13727 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13728 | .dac_nids = alc268_dac_nids, |
| 13729 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13730 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13731 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13732 | .hp_nid = 0x03, |
| 13733 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13734 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13735 | .channel_mode = alc268_modes, |
| 13736 | .input_mux = &alc268_capture_source, |
| 13737 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13738 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13739 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13740 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13741 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13742 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13743 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13744 | .dac_nids = alc268_dac_nids, |
| 13745 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13746 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13747 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13748 | .hp_nid = 0x03, |
| 13749 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13750 | .channel_mode = alc268_modes, |
| 13751 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13752 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13753 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13754 | .init_hook = alc_inithook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13755 | }, |
| 13756 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13757 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13758 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13759 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13760 | alc268_acer_verbs }, |
| 13761 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13762 | .dac_nids = alc268_dac_nids, |
| 13763 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13764 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13765 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13766 | .hp_nid = 0x02, |
| 13767 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13768 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13769 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13770 | .unsol_event = alc_sku_unsol_event, |
| 13771 | .setup = alc268_acer_setup, |
| 13772 | .init_hook = alc_inithook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13773 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13774 | [ALC268_ACER_DMIC] = { |
| 13775 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13776 | alc268_beep_mixer }, |
| 13777 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13778 | alc268_acer_verbs }, |
| 13779 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13780 | .dac_nids = alc268_dac_nids, |
| 13781 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13782 | .adc_nids = alc268_adc_nids_alt, |
| 13783 | .capsrc_nids = alc268_capsrc_nids, |
| 13784 | .hp_nid = 0x02, |
| 13785 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13786 | .channel_mode = alc268_modes, |
| 13787 | .input_mux = &alc268_acer_dmic_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame^] | 13788 | .unsol_event = alc_sku_unsol_event, |
| 13789 | .setup = alc268_acer_setup, |
| 13790 | .init_hook = alc_inithook, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13791 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13792 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13793 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13794 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13795 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13796 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13797 | alc268_acer_aspire_one_verbs }, |
| 13798 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13799 | .dac_nids = alc268_dac_nids, |
| 13800 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13801 | .adc_nids = alc268_adc_nids_alt, |
| 13802 | .capsrc_nids = alc268_capsrc_nids, |
| 13803 | .hp_nid = 0x03, |
| 13804 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13805 | .channel_mode = alc268_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13806 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13807 | .setup = alc268_acer_lc_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13808 | .init_hook = alc_inithook, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13809 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13810 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13811 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13812 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13813 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13814 | alc268_dell_verbs }, |
| 13815 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13816 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13817 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13818 | .adc_nids = alc268_adc_nids_alt, |
| 13819 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13820 | .hp_nid = 0x02, |
| 13821 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13822 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13823 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13824 | .setup = alc268_dell_setup, |
| 13825 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13826 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13827 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13828 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13829 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13830 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13831 | alc268_toshiba_verbs }, |
| 13832 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13833 | .dac_nids = alc268_dac_nids, |
| 13834 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13835 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13836 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13837 | .hp_nid = 0x03, |
| 13838 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13839 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13840 | .channel_mode = alc268_modes, |
| 13841 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13842 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13843 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13844 | .init_hook = alc_inithook, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13845 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13846 | #ifdef CONFIG_SND_DEBUG |
| 13847 | [ALC268_TEST] = { |
| 13848 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13849 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13850 | alc268_volume_init_verbs }, |
| 13851 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13852 | .dac_nids = alc268_dac_nids, |
| 13853 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13854 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13855 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13856 | .hp_nid = 0x03, |
| 13857 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13858 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13859 | .channel_mode = alc268_modes, |
| 13860 | .input_mux = &alc268_capture_source, |
| 13861 | }, |
| 13862 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13863 | }; |
| 13864 | |
| 13865 | static int patch_alc268(struct hda_codec *codec) |
| 13866 | { |
| 13867 | struct alc_spec *spec; |
| 13868 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13869 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13870 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13871 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13872 | if (spec == NULL) |
| 13873 | return -ENOMEM; |
| 13874 | |
| 13875 | codec->spec = spec; |
| 13876 | |
| 13877 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13878 | alc268_models, |
| 13879 | alc268_cfg_tbl); |
| 13880 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13881 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13882 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13883 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13884 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13885 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13886 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13887 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13888 | board_config = ALC268_AUTO; |
| 13889 | } |
| 13890 | |
| 13891 | if (board_config == ALC268_AUTO) { |
| 13892 | /* automatic parse from the BIOS config */ |
| 13893 | err = alc268_parse_auto_config(codec); |
| 13894 | if (err < 0) { |
| 13895 | alc_free(codec); |
| 13896 | return err; |
| 13897 | } else if (!err) { |
| 13898 | printk(KERN_INFO |
| 13899 | "hda_codec: Cannot set up configuration " |
| 13900 | "from BIOS. Using base mode...\n"); |
| 13901 | board_config = ALC268_3ST; |
| 13902 | } |
| 13903 | } |
| 13904 | |
| 13905 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13906 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13907 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13908 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13909 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13910 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13911 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13912 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13913 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13914 | has_beep = 0; |
| 13915 | for (i = 0; i < spec->num_mixers; i++) { |
| 13916 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13917 | has_beep = 1; |
| 13918 | break; |
| 13919 | } |
| 13920 | } |
| 13921 | |
| 13922 | if (has_beep) { |
| 13923 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13924 | if (err < 0) { |
| 13925 | alc_free(codec); |
| 13926 | return err; |
| 13927 | } |
| 13928 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13929 | /* override the amp caps for beep generator */ |
| 13930 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13931 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13932 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13933 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13934 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13935 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13936 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13937 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13938 | /* check whether NID 0x07 is valid */ |
| 13939 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13940 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13941 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13942 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13943 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13944 | if (spec->auto_mic || |
| 13945 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13946 | spec->adc_nids = alc268_adc_nids_alt; |
| 13947 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13948 | if (spec->auto_mic) |
| 13949 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13950 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13951 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13952 | else |
| 13953 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13954 | } else { |
| 13955 | spec->adc_nids = alc268_adc_nids; |
| 13956 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13957 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13958 | } |
| 13959 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13960 | |
| 13961 | spec->vmaster_nid = 0x02; |
| 13962 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13963 | codec->patch_ops = alc_patch_ops; |
| 13964 | if (board_config == ALC268_AUTO) |
| 13965 | spec->init_hook = alc268_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 13966 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13967 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13968 | alc_init_jacks(codec); |
| 13969 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13970 | return 0; |
| 13971 | } |
| 13972 | |
| 13973 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13974 | * ALC269 channel source setting (2 channel) |
| 13975 | */ |
| 13976 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13977 | |
| 13978 | #define alc269_dac_nids alc260_dac_nids |
| 13979 | |
| 13980 | static hda_nid_t alc269_adc_nids[1] = { |
| 13981 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13982 | 0x08, |
| 13983 | }; |
| 13984 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13985 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13986 | 0x23, |
| 13987 | }; |
| 13988 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13989 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13990 | /* ADC1 */ |
| 13991 | 0x09, |
| 13992 | }; |
| 13993 | |
| 13994 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13995 | 0x22, |
| 13996 | }; |
| 13997 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13998 | static hda_nid_t alc269_adc_candidates[] = { |
David Henningsson | 262ac22 | 2011-04-07 11:43:00 +0200 | [diff] [blame] | 13999 | 0x08, 0x09, 0x07, 0x11, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14000 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14001 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14002 | #define alc269_modes alc260_modes |
| 14003 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14004 | |
| 14005 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14007 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14008 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14009 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14011 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14012 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14013 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14014 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14015 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14016 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14017 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14018 | { } /* end */ |
| 14019 | }; |
| 14020 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14021 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14022 | /* output mixer control */ |
| 14023 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14024 | { |
| 14025 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14026 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14027 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14028 | .info = snd_hda_mixer_amp_switch_info, |
| 14029 | .get = snd_hda_mixer_amp_switch_get, |
| 14030 | .put = alc268_acer_master_sw_put, |
| 14031 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14032 | }, |
| 14033 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14035 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14036 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14037 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14038 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14039 | { } |
| 14040 | }; |
| 14041 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14042 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14043 | /* output mixer control */ |
| 14044 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14045 | { |
| 14046 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14047 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14048 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14049 | .info = snd_hda_mixer_amp_switch_info, |
| 14050 | .get = snd_hda_mixer_amp_switch_get, |
| 14051 | .put = alc268_acer_master_sw_put, |
| 14052 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14053 | }, |
| 14054 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14055 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14056 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14057 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14058 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14059 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14060 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14061 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14062 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14063 | { } |
| 14064 | }; |
| 14065 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14066 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14067 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14068 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14069 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14070 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14071 | { } /* end */ |
| 14072 | }; |
| 14073 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14074 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14075 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14076 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14077 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14078 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14079 | { } /* end */ |
| 14080 | }; |
| 14081 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14082 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14083 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14084 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14085 | { } /* end */ |
| 14086 | }; |
| 14087 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14088 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14089 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14090 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14091 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14092 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14093 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14094 | { } /* end */ |
| 14095 | }; |
| 14096 | |
| 14097 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14098 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14099 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14100 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14101 | { } /* end */ |
| 14102 | }; |
| 14103 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14104 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14105 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14106 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14107 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14108 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14109 | { } /* end */ |
| 14110 | }; |
| 14111 | |
| 14112 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14113 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14114 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14115 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14116 | { } /* end */ |
| 14117 | }; |
| 14118 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14119 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14120 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14121 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14122 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14123 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14124 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14125 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14126 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14127 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14128 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14129 | { } |
| 14130 | }; |
| 14131 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14132 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14133 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14134 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14135 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14137 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14138 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14139 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14140 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14141 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14142 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14143 | { } |
| 14144 | }; |
| 14145 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14146 | /* toggle speaker-output according to the hp-jack state */ |
| 14147 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14148 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14149 | alc_hp_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14150 | |
| 14151 | snd_hda_codec_write(codec, 0x20, 0, |
| 14152 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14153 | snd_hda_codec_write(codec, 0x20, 0, |
| 14154 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14155 | |
| 14156 | snd_hda_codec_write(codec, 0x20, 0, |
| 14157 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14158 | snd_hda_codec_write(codec, 0x20, 0, |
| 14159 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14160 | } |
| 14161 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14162 | #define alc269_lifebook_speaker_automute \ |
| 14163 | alc269_quanta_fl1_speaker_automute |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14164 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14165 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14166 | { |
| 14167 | unsigned int present_laptop; |
| 14168 | unsigned int present_dock; |
| 14169 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14170 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14171 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14172 | |
| 14173 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14174 | if (present_dock) |
| 14175 | snd_hda_codec_write(codec, 0x23, 0, |
| 14176 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14177 | if (present_laptop) |
| 14178 | snd_hda_codec_write(codec, 0x23, 0, |
| 14179 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14180 | if (!present_dock && !present_laptop) |
| 14181 | snd_hda_codec_write(codec, 0x23, 0, |
| 14182 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14183 | } |
| 14184 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14185 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14186 | unsigned int res) |
| 14187 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14188 | switch (res >> 26) { |
| 14189 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14190 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14191 | break; |
| 14192 | case ALC880_MIC_EVENT: |
| 14193 | alc_mic_automute(codec); |
| 14194 | break; |
| 14195 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14196 | } |
| 14197 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14198 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14199 | unsigned int res) |
| 14200 | { |
| 14201 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14202 | alc269_lifebook_speaker_automute(codec); |
| 14203 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14204 | alc269_lifebook_mic_autoswitch(codec); |
| 14205 | } |
| 14206 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14207 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14208 | { |
| 14209 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14210 | spec->autocfg.hp_pins[0] = 0x15; |
| 14211 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14212 | spec->automute_mixer_nid[0] = 0x0c; |
| 14213 | spec->automute = 1; |
| 14214 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14215 | spec->ext_mic.pin = 0x18; |
| 14216 | spec->ext_mic.mux_idx = 0; |
| 14217 | spec->int_mic.pin = 0x19; |
| 14218 | spec->int_mic.mux_idx = 1; |
| 14219 | spec->auto_mic = 1; |
| 14220 | } |
| 14221 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14222 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14223 | { |
| 14224 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14225 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14226 | } |
| 14227 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14228 | static void alc269_lifebook_setup(struct hda_codec *codec) |
| 14229 | { |
| 14230 | struct alc_spec *spec = codec->spec; |
| 14231 | spec->autocfg.hp_pins[0] = 0x15; |
| 14232 | spec->autocfg.hp_pins[1] = 0x1a; |
| 14233 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14234 | spec->automute_mixer_nid[0] = 0x0c; |
| 14235 | spec->automute = 1; |
| 14236 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 14237 | } |
| 14238 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14239 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14240 | { |
| 14241 | alc269_lifebook_speaker_automute(codec); |
| 14242 | alc269_lifebook_mic_autoswitch(codec); |
| 14243 | } |
| 14244 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14245 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14247 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14248 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14250 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14251 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14252 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14253 | {} |
| 14254 | }; |
| 14255 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14256 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14258 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14259 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14260 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14261 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14262 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14263 | {} |
| 14264 | }; |
| 14265 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14266 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14267 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14268 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14269 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14271 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14272 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14273 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14274 | {} |
| 14275 | }; |
| 14276 | |
| 14277 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14278 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14279 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14280 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14281 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14282 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14283 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14284 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14285 | {} |
| 14286 | }; |
| 14287 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14288 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14289 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14290 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14291 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14293 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14294 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14295 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14296 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14297 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14298 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14299 | { } |
| 14300 | }; |
| 14301 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14302 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14303 | { |
| 14304 | struct alc_spec *spec = codec->spec; |
| 14305 | spec->autocfg.hp_pins[0] = 0x15; |
| 14306 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14307 | spec->automute_mixer_nid[0] = 0x0c; |
| 14308 | spec->automute = 1; |
| 14309 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14310 | spec->ext_mic.pin = 0x18; |
| 14311 | spec->ext_mic.mux_idx = 0; |
| 14312 | spec->int_mic.pin = 0x19; |
| 14313 | spec->int_mic.mux_idx = 1; |
| 14314 | spec->auto_mic = 1; |
| 14315 | } |
| 14316 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14317 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14318 | { |
| 14319 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14320 | spec->autocfg.hp_pins[0] = 0x15; |
| 14321 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14322 | spec->automute_mixer_nid[0] = 0x0c; |
| 14323 | spec->automute = 1; |
| 14324 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14325 | spec->ext_mic.pin = 0x18; |
| 14326 | spec->ext_mic.mux_idx = 0; |
| 14327 | spec->int_mic.pin = 0x12; |
| 14328 | spec->int_mic.mux_idx = 5; |
| 14329 | spec->auto_mic = 1; |
| 14330 | } |
| 14331 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14332 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14333 | { |
| 14334 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14335 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14336 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14337 | spec->automute_mixer_nid[0] = 0x0c; |
| 14338 | spec->automute = 1; |
| 14339 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14340 | spec->ext_mic.pin = 0x18; |
| 14341 | spec->ext_mic.mux_idx = 0; |
| 14342 | spec->int_mic.pin = 0x19; |
| 14343 | spec->int_mic.mux_idx = 1; |
| 14344 | spec->auto_mic = 1; |
| 14345 | } |
| 14346 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14347 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14348 | { |
| 14349 | struct alc_spec *spec = codec->spec; |
| 14350 | spec->autocfg.hp_pins[0] = 0x21; |
| 14351 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14352 | spec->automute_mixer_nid[0] = 0x0c; |
| 14353 | spec->automute = 1; |
| 14354 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14355 | spec->ext_mic.pin = 0x18; |
| 14356 | spec->ext_mic.mux_idx = 0; |
| 14357 | spec->int_mic.pin = 0x12; |
| 14358 | spec->int_mic.mux_idx = 6; |
| 14359 | spec->auto_mic = 1; |
| 14360 | } |
| 14361 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14362 | /* |
| 14363 | * generic initialization of ADC, input mixers and output mixers |
| 14364 | */ |
| 14365 | static struct hda_verb alc269_init_verbs[] = { |
| 14366 | /* |
| 14367 | * Unmute ADC0 and set the default input to mic-in |
| 14368 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14369 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14370 | |
| 14371 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14372 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14373 | */ |
| 14374 | /* set vol=0 to output mixers */ |
| 14375 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14376 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14377 | |
| 14378 | /* set up input amps for analog loopback */ |
| 14379 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14382 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14383 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14384 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14385 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14386 | |
| 14387 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14388 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14389 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14390 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14391 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14392 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14393 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14394 | |
| 14395 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14397 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14398 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14399 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14400 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14401 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14402 | |
| 14403 | /* set EAPD */ |
| 14404 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14405 | { } |
| 14406 | }; |
| 14407 | |
| 14408 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14409 | /* |
| 14410 | * Unmute ADC0 and set the default input to mic-in |
| 14411 | */ |
| 14412 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14413 | |
| 14414 | /* |
| 14415 | * Set up output mixers (0x02 - 0x03) |
| 14416 | */ |
| 14417 | /* set vol=0 to output mixers */ |
| 14418 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14419 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14420 | |
| 14421 | /* set up input amps for analog loopback */ |
| 14422 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14425 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14426 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14427 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14429 | |
| 14430 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14431 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14432 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14433 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14434 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14435 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14436 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14437 | |
| 14438 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14439 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14440 | |
| 14441 | /* FIXME: use Mux-type input source selection */ |
| 14442 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14443 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14444 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14445 | |
| 14446 | /* set EAPD */ |
| 14447 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14448 | { } |
| 14449 | }; |
| 14450 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14451 | #define alc269_auto_create_multi_out_ctls \ |
| 14452 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14453 | #define alc269_auto_create_input_ctls \ |
| 14454 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14455 | |
| 14456 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14457 | #define alc269_loopbacks alc880_loopbacks |
| 14458 | #endif |
| 14459 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14460 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14461 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14462 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14463 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14464 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14465 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14466 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14467 | .substreams = 1, |
| 14468 | .channels_min = 2, |
| 14469 | .channels_max = 8, |
| 14470 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14471 | /* NID is set in alc_build_pcms */ |
| 14472 | .ops = { |
| 14473 | .open = alc880_playback_pcm_open, |
| 14474 | .prepare = alc880_playback_pcm_prepare, |
| 14475 | .cleanup = alc880_playback_pcm_cleanup |
| 14476 | }, |
| 14477 | }; |
| 14478 | |
| 14479 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14480 | .substreams = 1, |
| 14481 | .channels_min = 2, |
| 14482 | .channels_max = 2, |
| 14483 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14484 | /* NID is set in alc_build_pcms */ |
| 14485 | }; |
| 14486 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14487 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14488 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14489 | { |
| 14490 | switch (codec->subsystem_id) { |
| 14491 | case 0x103c1586: |
| 14492 | return 1; |
| 14493 | } |
| 14494 | return 0; |
| 14495 | } |
| 14496 | |
| 14497 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14498 | { |
| 14499 | /* update mute-LED according to the speaker mute state */ |
| 14500 | if (nid == 0x01 || nid == 0x14) { |
| 14501 | int pinval; |
| 14502 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14503 | HDA_AMP_MUTE) |
| 14504 | pinval = 0x24; |
| 14505 | else |
| 14506 | pinval = 0x20; |
| 14507 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14508 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14509 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14510 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14511 | } |
| 14512 | return alc_check_power_status(codec, nid); |
| 14513 | } |
| 14514 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14515 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14516 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14517 | { |
| 14518 | struct alc_spec *spec = codec->spec; |
| 14519 | |
| 14520 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14521 | return 0; |
| 14522 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14523 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14524 | if (spec->ext_mic.pin <= 0x12) { |
| 14525 | spec->private_adc_nids[0] = 0x08; |
| 14526 | spec->private_adc_nids[1] = 0x11; |
| 14527 | spec->private_capsrc_nids[0] = 0x23; |
| 14528 | spec->private_capsrc_nids[1] = 0x22; |
| 14529 | } else { |
| 14530 | spec->private_adc_nids[0] = 0x11; |
| 14531 | spec->private_adc_nids[1] = 0x08; |
| 14532 | spec->private_capsrc_nids[0] = 0x22; |
| 14533 | spec->private_capsrc_nids[1] = 0x23; |
| 14534 | } |
| 14535 | spec->adc_nids = spec->private_adc_nids; |
| 14536 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14537 | spec->num_adc_nids = 2; |
| 14538 | spec->dual_adc_switch = 1; |
| 14539 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14540 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14541 | return 1; |
| 14542 | } |
| 14543 | return 0; |
| 14544 | } |
| 14545 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14546 | /* different alc269-variants */ |
| 14547 | enum { |
| 14548 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14549 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14550 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14551 | ALC269_TYPE_ALC269VB, |
| 14552 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14553 | ALC269_TYPE_ALC271X, |
| 14554 | }; |
| 14555 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14556 | /* |
| 14557 | * BIOS auto configuration |
| 14558 | */ |
| 14559 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14560 | { |
| 14561 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14562 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14563 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14564 | |
| 14565 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14566 | alc269_ignore); |
| 14567 | if (err < 0) |
| 14568 | return err; |
| 14569 | |
| 14570 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14571 | if (err < 0) |
| 14572 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14573 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14574 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14575 | else |
| 14576 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14577 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14578 | if (err < 0) |
| 14579 | return err; |
| 14580 | |
| 14581 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14582 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14583 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14584 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14585 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14586 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14587 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14588 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14589 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14590 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14591 | } else { |
| 14592 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14593 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14594 | } |
| 14595 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14596 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14597 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14598 | |
| 14599 | if (!alc275_setup_dual_adc(codec)) |
| 14600 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14601 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14602 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14603 | err = alc_auto_add_mic_boost(codec); |
| 14604 | if (err < 0) |
| 14605 | return err; |
| 14606 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14607 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14608 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14609 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14610 | return 1; |
| 14611 | } |
| 14612 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14613 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14614 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14615 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14616 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14617 | |
| 14618 | |
| 14619 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14620 | static void alc269_auto_init(struct hda_codec *codec) |
| 14621 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14622 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14623 | alc269_auto_init_multi_out(codec); |
| 14624 | alc269_auto_init_hp_out(codec); |
| 14625 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14626 | if (!spec->dual_adc_switch) |
| 14627 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14628 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14629 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14630 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14631 | } |
| 14632 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14633 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14634 | { |
| 14635 | int val = alc_read_coef_idx(codec, 0x04); |
| 14636 | if (power_up) |
| 14637 | val |= 1 << 11; |
| 14638 | else |
| 14639 | val &= ~(1 << 11); |
| 14640 | alc_write_coef_idx(codec, 0x04, val); |
| 14641 | } |
| 14642 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14643 | static void alc269_shutup(struct hda_codec *codec) |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14644 | { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14645 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14646 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14647 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14648 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14649 | msleep(150); |
| 14650 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14651 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14652 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14653 | #ifdef SND_HDA_NEEDS_RESUME |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14654 | static int alc269_resume(struct hda_codec *codec) |
| 14655 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14656 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14657 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14658 | msleep(150); |
| 14659 | } |
| 14660 | |
| 14661 | codec->patch_ops.init(codec); |
| 14662 | |
| 14663 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14664 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14665 | msleep(200); |
| 14666 | } |
| 14667 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14668 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14669 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14670 | |
| 14671 | snd_hda_codec_resume_amp(codec); |
| 14672 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14673 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14674 | return 0; |
| 14675 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14676 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14677 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14678 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14679 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14680 | { |
| 14681 | int coef; |
| 14682 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14683 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14684 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14685 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14686 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14687 | } |
| 14688 | |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14689 | static void alc271_fixup_dmic(struct hda_codec *codec, |
| 14690 | const struct alc_fixup *fix, int action) |
| 14691 | { |
| 14692 | static struct hda_verb verbs[] = { |
| 14693 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14694 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14695 | {} |
| 14696 | }; |
| 14697 | unsigned int cfg; |
| 14698 | |
| 14699 | if (strcmp(codec->chip_name, "ALC271X")) |
| 14700 | return; |
| 14701 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 14702 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 14703 | snd_hda_sequence_write(codec, verbs); |
| 14704 | } |
| 14705 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14706 | enum { |
| 14707 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14708 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14709 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14710 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14711 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14712 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14713 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14714 | ALC271_FIXUP_DMIC, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14715 | }; |
| 14716 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14717 | static const struct alc_fixup alc269_fixups[] = { |
| 14718 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14719 | .type = ALC_FIXUP_VERBS, |
| 14720 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14721 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14722 | {} |
| 14723 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14724 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14725 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14726 | .type = ALC_FIXUP_VERBS, |
| 14727 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14728 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14729 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14730 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14731 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14732 | }, |
| 14733 | .chained = true, |
| 14734 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14735 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14736 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14737 | .type = ALC_FIXUP_VERBS, |
| 14738 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14739 | /* Enables internal speaker */ |
| 14740 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14741 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14742 | {} |
| 14743 | } |
| 14744 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14745 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14746 | .type = ALC_FIXUP_SKU, |
| 14747 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14748 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14749 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14750 | .type = ALC_FIXUP_PINS, |
| 14751 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14752 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14753 | { } |
| 14754 | } |
| 14755 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14756 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14757 | .type = ALC_FIXUP_VERBS, |
| 14758 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14759 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14760 | {} |
| 14761 | } |
| 14762 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14763 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14764 | .type = ALC_FIXUP_FUNC, |
| 14765 | .v.func = alc269_fixup_hweq, |
| 14766 | .chained = true, |
| 14767 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14768 | }, |
| 14769 | [ALC271_FIXUP_DMIC] = { |
| 14770 | .type = ALC_FIXUP_FUNC, |
| 14771 | .v.func = alc271_fixup_dmic, |
| 14772 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14773 | }; |
| 14774 | |
| 14775 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14776 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14777 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14778 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14779 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14780 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14781 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14782 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14783 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14784 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14785 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14786 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14787 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14788 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14789 | {} |
| 14790 | }; |
| 14791 | |
| 14792 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14793 | /* |
| 14794 | * configuration and preset |
| 14795 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14796 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14797 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14798 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14799 | [ALC269_AMIC] = "laptop-amic", |
| 14800 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14801 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14802 | [ALC269_LIFEBOOK] = "lifebook", |
| 14803 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14804 | }; |
| 14805 | |
| 14806 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14807 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14808 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14809 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14810 | ALC269_AMIC), |
| 14811 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14812 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14813 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14814 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14815 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14816 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14817 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14818 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14819 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 14820 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14821 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14822 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14823 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14824 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14825 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14826 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14827 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14828 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14829 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14830 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14831 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14832 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14833 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14834 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14835 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14836 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14837 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14838 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14839 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14840 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14841 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14842 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14843 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14844 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14845 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14846 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14847 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14848 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14849 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14850 | ALC269_DMIC), |
| 14851 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14852 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14853 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14854 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14855 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14856 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14857 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14858 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14859 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14860 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14861 | {} |
| 14862 | }; |
| 14863 | |
| 14864 | static struct alc_config_preset alc269_presets[] = { |
| 14865 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14866 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14867 | .init_verbs = { alc269_init_verbs }, |
| 14868 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14869 | .dac_nids = alc269_dac_nids, |
| 14870 | .hp_nid = 0x03, |
| 14871 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14872 | .channel_mode = alc269_modes, |
| 14873 | .input_mux = &alc269_capture_source, |
| 14874 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14875 | [ALC269_QUANTA_FL1] = { |
| 14876 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14877 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14878 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14879 | .dac_nids = alc269_dac_nids, |
| 14880 | .hp_nid = 0x03, |
| 14881 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14882 | .channel_mode = alc269_modes, |
| 14883 | .input_mux = &alc269_capture_source, |
| 14884 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14885 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14886 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14887 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14888 | [ALC269_AMIC] = { |
| 14889 | .mixers = { alc269_laptop_mixer }, |
| 14890 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14891 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14892 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14893 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14894 | .dac_nids = alc269_dac_nids, |
| 14895 | .hp_nid = 0x03, |
| 14896 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14897 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14898 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14899 | .setup = alc269_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14900 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14901 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14902 | [ALC269_DMIC] = { |
| 14903 | .mixers = { alc269_laptop_mixer }, |
| 14904 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14905 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14906 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14907 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14908 | .dac_nids = alc269_dac_nids, |
| 14909 | .hp_nid = 0x03, |
| 14910 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14911 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14912 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14913 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14914 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14915 | }, |
| 14916 | [ALC269VB_AMIC] = { |
| 14917 | .mixers = { alc269vb_laptop_mixer }, |
| 14918 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14919 | .init_verbs = { alc269vb_init_verbs, |
| 14920 | alc269vb_laptop_amic_init_verbs }, |
| 14921 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14922 | .dac_nids = alc269_dac_nids, |
| 14923 | .hp_nid = 0x03, |
| 14924 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14925 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14926 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14927 | .setup = alc269vb_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14928 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14929 | }, |
| 14930 | [ALC269VB_DMIC] = { |
| 14931 | .mixers = { alc269vb_laptop_mixer }, |
| 14932 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14933 | .init_verbs = { alc269vb_init_verbs, |
| 14934 | alc269vb_laptop_dmic_init_verbs }, |
| 14935 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14936 | .dac_nids = alc269_dac_nids, |
| 14937 | .hp_nid = 0x03, |
| 14938 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14939 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14940 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14941 | .setup = alc269vb_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14942 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14943 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14944 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14945 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14946 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14947 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14948 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14949 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14950 | .dac_nids = alc269_dac_nids, |
| 14951 | .hp_nid = 0x03, |
| 14952 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14953 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14954 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14955 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14956 | .init_hook = alc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14957 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14958 | [ALC269_LIFEBOOK] = { |
| 14959 | .mixers = { alc269_lifebook_mixer }, |
| 14960 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14961 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14962 | .dac_nids = alc269_dac_nids, |
| 14963 | .hp_nid = 0x03, |
| 14964 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14965 | .channel_mode = alc269_modes, |
| 14966 | .input_mux = &alc269_capture_source, |
| 14967 | .unsol_event = alc269_lifebook_unsol_event, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14968 | .setup = alc269_lifebook_setup, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14969 | .init_hook = alc269_lifebook_init_hook, |
| 14970 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14971 | [ALC271_ACER] = { |
| 14972 | .mixers = { alc269_asus_mixer }, |
| 14973 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14974 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14975 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14976 | .dac_nids = alc269_dac_nids, |
| 14977 | .adc_nids = alc262_dmic_adc_nids, |
| 14978 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14979 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14980 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14981 | .channel_mode = alc269_modes, |
| 14982 | .input_mux = &alc269_capture_source, |
| 14983 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14984 | .unsol_event = alc_sku_unsol_event, |
| 14985 | .setup = alc269vb_laptop_dmic_setup, |
| 14986 | .init_hook = alc_inithook, |
| 14987 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14988 | }; |
| 14989 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14990 | static int alc269_fill_coef(struct hda_codec *codec) |
| 14991 | { |
| 14992 | int val; |
| 14993 | |
| 14994 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 14995 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 14996 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 14997 | } |
| 14998 | |
| 14999 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15000 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15001 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15002 | } |
| 15003 | |
| 15004 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15005 | val = alc_read_coef_idx(codec, 0x04); |
| 15006 | /* Power up output pin */ |
| 15007 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15008 | } |
| 15009 | |
| 15010 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15011 | val = alc_read_coef_idx(codec, 0xd); |
| 15012 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15013 | /* Capless ramp up clock control */ |
| 15014 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15015 | } |
| 15016 | val = alc_read_coef_idx(codec, 0x17); |
| 15017 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15018 | /* Class D power on reset */ |
| 15019 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15020 | } |
| 15021 | } |
| 15022 | return 0; |
| 15023 | } |
| 15024 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15025 | static int patch_alc269(struct hda_codec *codec) |
| 15026 | { |
| 15027 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15028 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15029 | int err; |
| 15030 | |
| 15031 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15032 | if (spec == NULL) |
| 15033 | return -ENOMEM; |
| 15034 | |
| 15035 | codec->spec = spec; |
| 15036 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15037 | alc_auto_parse_customize_define(codec); |
| 15038 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15039 | if (codec->vendor_id == 0x10ec0269) { |
| 15040 | coef = alc_read_coef_idx(codec, 0); |
| 15041 | if ((coef & 0x00f0) == 0x0010) { |
| 15042 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15043 | spec->cdefine.platform_type == 1) { |
| 15044 | alc_codec_rename(codec, "ALC271X"); |
| 15045 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15046 | } else if ((coef & 0xf000) == 0x1000) { |
| 15047 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15048 | } else if ((coef & 0xf000) == 0x2000) { |
| 15049 | alc_codec_rename(codec, "ALC259"); |
| 15050 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15051 | } else if ((coef & 0xf000) == 0x3000) { |
| 15052 | alc_codec_rename(codec, "ALC258"); |
| 15053 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15054 | } else { |
| 15055 | alc_codec_rename(codec, "ALC269VB"); |
| 15056 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15057 | } |
| 15058 | } else |
| 15059 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15060 | alc269_fill_coef(codec); |
| 15061 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15062 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15063 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15064 | alc269_models, |
| 15065 | alc269_cfg_tbl); |
| 15066 | |
| 15067 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15068 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15069 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15070 | board_config = ALC269_AUTO; |
| 15071 | } |
| 15072 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15073 | if (board_config == ALC269_AUTO) { |
| 15074 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15075 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15076 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15077 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15078 | if (board_config == ALC269_AUTO) { |
| 15079 | /* automatic parse from the BIOS config */ |
| 15080 | err = alc269_parse_auto_config(codec); |
| 15081 | if (err < 0) { |
| 15082 | alc_free(codec); |
| 15083 | return err; |
| 15084 | } else if (!err) { |
| 15085 | printk(KERN_INFO |
| 15086 | "hda_codec: Cannot set up configuration " |
| 15087 | "from BIOS. Using base mode...\n"); |
| 15088 | board_config = ALC269_BASIC; |
| 15089 | } |
| 15090 | } |
| 15091 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15092 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15093 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15094 | if (err < 0) { |
| 15095 | alc_free(codec); |
| 15096 | return err; |
| 15097 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15098 | } |
| 15099 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15100 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15101 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15102 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15103 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15104 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15105 | * fix the sample rate of analog I/O to 44.1kHz |
| 15106 | */ |
| 15107 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15108 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15109 | } else if (spec->dual_adc_switch) { |
| 15110 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15111 | /* switch ADC dynamically */ |
| 15112 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15113 | } else { |
| 15114 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15115 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15116 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15117 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15118 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15119 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15120 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15121 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15122 | spec->adc_nids = alc269_adc_nids; |
| 15123 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15124 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15125 | } else { |
| 15126 | spec->adc_nids = alc269vb_adc_nids; |
| 15127 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15128 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15129 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15130 | } |
| 15131 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15132 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15133 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15134 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15135 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15136 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15137 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15138 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15139 | spec->vmaster_nid = 0x02; |
| 15140 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15141 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15142 | #ifdef SND_HDA_NEEDS_RESUME |
| 15143 | codec->patch_ops.resume = alc269_resume; |
| 15144 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15145 | if (board_config == ALC269_AUTO) |
| 15146 | spec->init_hook = alc269_auto_init; |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 15147 | spec->shutup = alc269_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15148 | |
| 15149 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15150 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15151 | if (!spec->loopback.amplist) |
| 15152 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15153 | if (alc269_mic2_for_mute_led(codec)) |
| 15154 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15155 | #endif |
| 15156 | |
| 15157 | return 0; |
| 15158 | } |
| 15159 | |
| 15160 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15161 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15162 | */ |
| 15163 | |
| 15164 | /* |
| 15165 | * set the path ways for 2 channel output |
| 15166 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15167 | */ |
| 15168 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15169 | /* set pin widget 1Ah (line in) for input */ |
| 15170 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15171 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15172 | * the vref |
| 15173 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15174 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15175 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15176 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15177 | #if 0 |
| 15178 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15179 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15180 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15181 | { } /* end */ |
| 15182 | }; |
| 15183 | /* |
| 15184 | * 6ch mode |
| 15185 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15186 | */ |
| 15187 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15188 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15189 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15190 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15191 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15192 | |
| 15193 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15194 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15195 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15196 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15197 | #if 0 |
| 15198 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15199 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15200 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15201 | { } /* end */ |
| 15202 | }; |
| 15203 | |
| 15204 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15205 | { 2, alc861_threestack_ch2_init }, |
| 15206 | { 6, alc861_threestack_ch6_init }, |
| 15207 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15208 | /* Set mic1 as input and unmute the mixer */ |
| 15209 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15210 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15211 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15212 | { } /* end */ |
| 15213 | }; |
| 15214 | /* Set mic1 as output and mute mixer */ |
| 15215 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15216 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15217 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15218 | { } /* end */ |
| 15219 | }; |
| 15220 | |
| 15221 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15222 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15223 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15224 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15225 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15226 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15227 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15228 | /* set pin widget 1Ah (line in) for input */ |
| 15229 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15230 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15231 | * the vref |
| 15232 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15233 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15234 | |
| 15235 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15236 | #if 0 |
| 15237 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15238 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15239 | #endif |
| 15240 | { } /* end */ |
| 15241 | }; |
| 15242 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15243 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15244 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15245 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15246 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15247 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15248 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15249 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15250 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15251 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15252 | |
| 15253 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15254 | #if 0 |
| 15255 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15256 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15257 | #endif |
| 15258 | { } /* end */ |
| 15259 | }; |
| 15260 | |
| 15261 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15262 | { 2, alc861_asus_ch2_init }, |
| 15263 | { 6, alc861_asus_ch6_init }, |
| 15264 | }; |
| 15265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15266 | /* patch-ALC861 */ |
| 15267 | |
| 15268 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15269 | /* output mixer control */ |
| 15270 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15271 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15272 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15273 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15274 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15275 | |
| 15276 | /*Input mixer control */ |
| 15277 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15278 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15279 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15280 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15281 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15282 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15283 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15284 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15285 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15286 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15287 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15288 | { } /* end */ |
| 15289 | }; |
| 15290 | |
| 15291 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15292 | /* output mixer control */ |
| 15293 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15294 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15295 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15296 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15297 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15298 | |
| 15299 | /* Input mixer control */ |
| 15300 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15301 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15303 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15304 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15305 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15306 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15307 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15308 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15309 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15310 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15311 | { |
| 15312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15313 | .name = "Channel Mode", |
| 15314 | .info = alc_ch_mode_info, |
| 15315 | .get = alc_ch_mode_get, |
| 15316 | .put = alc_ch_mode_put, |
| 15317 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15318 | }, |
| 15319 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15320 | }; |
| 15321 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15322 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15323 | /* output mixer control */ |
| 15324 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15325 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15326 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15327 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15328 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15329 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15330 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15331 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15332 | /* output mixer control */ |
| 15333 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15334 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15335 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15336 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15337 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15338 | |
| 15339 | /* Input mixer control */ |
| 15340 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15341 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15342 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15343 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15344 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15345 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15346 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15347 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15348 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15350 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15351 | { |
| 15352 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15353 | .name = "Channel Mode", |
| 15354 | .info = alc_ch_mode_info, |
| 15355 | .get = alc_ch_mode_get, |
| 15356 | .put = alc_ch_mode_put, |
| 15357 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15358 | }, |
| 15359 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15360 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15361 | |
| 15362 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15363 | /* output mixer control */ |
| 15364 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15365 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15366 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15367 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15368 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15369 | |
| 15370 | /* Input mixer control */ |
| 15371 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15372 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15373 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15374 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15375 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15376 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15377 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15378 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15379 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15380 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15381 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15382 | { |
| 15383 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15384 | .name = "Channel Mode", |
| 15385 | .info = alc_ch_mode_info, |
| 15386 | .get = alc_ch_mode_get, |
| 15387 | .put = alc_ch_mode_put, |
| 15388 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15389 | }, |
| 15390 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15391 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15392 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15393 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15394 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15395 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15396 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15397 | { } |
| 15398 | }; |
| 15399 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15400 | /* |
| 15401 | * generic initialization of ADC, input mixers and output mixers |
| 15402 | */ |
| 15403 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15404 | /* |
| 15405 | * Unmute ADC0 and set the default input to mic-in |
| 15406 | */ |
| 15407 | /* port-A for surround (rear panel) */ |
| 15408 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15409 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15410 | /* port-B for mic-in (rear panel) with vref */ |
| 15411 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15412 | /* port-C for line-in (rear panel) */ |
| 15413 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15414 | /* port-D for Front */ |
| 15415 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15416 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15417 | /* port-E for HP out (front panel) */ |
| 15418 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15419 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15420 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15421 | /* port-F for mic-in (front panel) with vref */ |
| 15422 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15423 | /* port-G for CLFE (rear panel) */ |
| 15424 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15425 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15426 | /* port-H for side (rear panel) */ |
| 15427 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15428 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15429 | /* CD-in */ |
| 15430 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15431 | /* route front mic to ADC1*/ |
| 15432 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15434 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15435 | /* Unmute DAC0~3 & spdif out*/ |
| 15436 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15437 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15438 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15439 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15441 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15442 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15443 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15444 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15445 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15446 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15447 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15448 | /* Unmute Stereo Mixer 15 */ |
| 15449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15451 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15453 | |
| 15454 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15455 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15456 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15457 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15458 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15459 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15460 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15461 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15462 | /* hp used DAC 3 (Front) */ |
| 15463 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15464 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15465 | |
| 15466 | { } |
| 15467 | }; |
| 15468 | |
| 15469 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15470 | /* |
| 15471 | * Unmute ADC0 and set the default input to mic-in |
| 15472 | */ |
| 15473 | /* port-A for surround (rear panel) */ |
| 15474 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15475 | /* port-B for mic-in (rear panel) with vref */ |
| 15476 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15477 | /* port-C for line-in (rear panel) */ |
| 15478 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15479 | /* port-D for Front */ |
| 15480 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15481 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15482 | /* port-E for HP out (front panel) */ |
| 15483 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15484 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15485 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15486 | /* port-F for mic-in (front panel) with vref */ |
| 15487 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15488 | /* port-G for CLFE (rear panel) */ |
| 15489 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15490 | /* port-H for side (rear panel) */ |
| 15491 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15492 | /* CD-in */ |
| 15493 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15494 | /* route front mic to ADC1*/ |
| 15495 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15496 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15497 | /* Unmute DAC0~3 & spdif out*/ |
| 15498 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15499 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15500 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15501 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15503 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15504 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15505 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15506 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15507 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15508 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15509 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15510 | /* Unmute Stereo Mixer 15 */ |
| 15511 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15512 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15513 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15514 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15515 | |
| 15516 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15517 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15518 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15519 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15520 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15521 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15522 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15523 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15524 | /* hp used DAC 3 (Front) */ |
| 15525 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15526 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15527 | { } |
| 15528 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15529 | |
| 15530 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15531 | /* |
| 15532 | * Unmute ADC0 and set the default input to mic-in |
| 15533 | */ |
| 15534 | /* port-A for surround (rear panel) */ |
| 15535 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15536 | /* port-B for mic-in (rear panel) with vref */ |
| 15537 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15538 | /* port-C for line-in (rear panel) */ |
| 15539 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15540 | /* port-D for Front */ |
| 15541 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15542 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15543 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15544 | /* this has to be set to VREF80 */ |
| 15545 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15546 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15547 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15548 | /* port-F for mic-in (front panel) with vref */ |
| 15549 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15550 | /* port-G for CLFE (rear panel) */ |
| 15551 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15552 | /* port-H for side (rear panel) */ |
| 15553 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15554 | /* CD-in */ |
| 15555 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15556 | /* route front mic to ADC1*/ |
| 15557 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15558 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15559 | /* Unmute DAC0~3 & spdif out*/ |
| 15560 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15561 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15562 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15563 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15565 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15566 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15567 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15568 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15569 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15570 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15571 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15572 | /* Unmute Stereo Mixer 15 */ |
| 15573 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15575 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15577 | |
| 15578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15579 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15580 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15581 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15582 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15583 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15584 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15585 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15586 | /* hp used DAC 3 (Front) */ |
| 15587 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15588 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15589 | { } |
| 15590 | }; |
| 15591 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15592 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15593 | /* |
| 15594 | * Unmute ADC0 and set the default input to mic-in |
| 15595 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15596 | /* port-A for surround (rear panel) |
| 15597 | * according to codec#0 this is the HP jack |
| 15598 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15599 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15600 | /* route front PCM to HP */ |
| 15601 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15602 | /* port-B for mic-in (rear panel) with vref */ |
| 15603 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15604 | /* port-C for line-in (rear panel) */ |
| 15605 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15606 | /* port-D for Front */ |
| 15607 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15608 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15609 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15610 | /* this has to be set to VREF80 */ |
| 15611 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15612 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15613 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15614 | /* port-F for mic-in (front panel) with vref */ |
| 15615 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15616 | /* port-G for CLFE (rear panel) */ |
| 15617 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15618 | /* port-H for side (rear panel) */ |
| 15619 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15620 | /* CD-in */ |
| 15621 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15622 | /* route front mic to ADC1*/ |
| 15623 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15624 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15625 | /* Unmute DAC0~3 & spdif out*/ |
| 15626 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15627 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15628 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15629 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15630 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15631 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15632 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15633 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15634 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15635 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15636 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15637 | /* Unmute Stereo Mixer 15 */ |
| 15638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15639 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15641 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15642 | |
| 15643 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15644 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15645 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15646 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15647 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15648 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15649 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15650 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15651 | /* hp used DAC 3 (Front) */ |
| 15652 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15653 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15654 | { } |
| 15655 | }; |
| 15656 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15657 | /* additional init verbs for ASUS laptops */ |
| 15658 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15659 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15660 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15661 | { } |
| 15662 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15663 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15664 | /* |
| 15665 | * generic initialization of ADC, input mixers and output mixers |
| 15666 | */ |
| 15667 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15668 | /* |
| 15669 | * Unmute ADC0 and set the default input to mic-in |
| 15670 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15671 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15672 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15673 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15674 | /* Unmute DAC0~3 & spdif out*/ |
| 15675 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15676 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15677 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15678 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15679 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15680 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15681 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15682 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15683 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15684 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15685 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15686 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15687 | /* Unmute Stereo Mixer 15 */ |
| 15688 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15692 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15693 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15694 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15695 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15696 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15697 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15698 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15699 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15700 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15701 | |
| 15702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15703 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15704 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15705 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15706 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15707 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15708 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15709 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15710 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15711 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15712 | |
| 15713 | { } |
| 15714 | }; |
| 15715 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15716 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15717 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15718 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15719 | { } |
| 15720 | }; |
| 15721 | |
| 15722 | /* toggle speaker-output according to the hp-jack state */ |
| 15723 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15724 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15725 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15726 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15727 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15728 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15729 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15730 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15731 | } |
| 15732 | |
| 15733 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15734 | unsigned int res) |
| 15735 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15736 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15737 | alc861_toshiba_automute(codec); |
| 15738 | } |
| 15739 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15740 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15741 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15742 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15743 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15744 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15745 | |
| 15746 | |
| 15747 | #define ALC861_DIGOUT_NID 0x07 |
| 15748 | |
| 15749 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15750 | { 8, NULL } |
| 15751 | }; |
| 15752 | |
| 15753 | static hda_nid_t alc861_dac_nids[4] = { |
| 15754 | /* front, surround, clfe, side */ |
| 15755 | 0x03, 0x06, 0x05, 0x04 |
| 15756 | }; |
| 15757 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15758 | static hda_nid_t alc660_dac_nids[3] = { |
| 15759 | /* front, clfe, surround */ |
| 15760 | 0x03, 0x05, 0x06 |
| 15761 | }; |
| 15762 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15763 | static hda_nid_t alc861_adc_nids[1] = { |
| 15764 | /* ADC0-2 */ |
| 15765 | 0x08, |
| 15766 | }; |
| 15767 | |
| 15768 | static struct hda_input_mux alc861_capture_source = { |
| 15769 | .num_items = 5, |
| 15770 | .items = { |
| 15771 | { "Mic", 0x0 }, |
| 15772 | { "Front Mic", 0x3 }, |
| 15773 | { "Line", 0x1 }, |
| 15774 | { "CD", 0x4 }, |
| 15775 | { "Mixer", 0x5 }, |
| 15776 | }, |
| 15777 | }; |
| 15778 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15779 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15780 | { |
| 15781 | struct alc_spec *spec = codec->spec; |
| 15782 | hda_nid_t mix, srcs[5]; |
| 15783 | int i, j, num; |
| 15784 | |
| 15785 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15786 | return 0; |
| 15787 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15788 | if (num < 0) |
| 15789 | return 0; |
| 15790 | for (i = 0; i < num; i++) { |
| 15791 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15792 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15793 | if (type != AC_WID_AUD_OUT) |
| 15794 | continue; |
| 15795 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15796 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15797 | break; |
| 15798 | if (j >= spec->multiout.num_dacs) |
| 15799 | return srcs[i]; |
| 15800 | } |
| 15801 | return 0; |
| 15802 | } |
| 15803 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15804 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15805 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15806 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15807 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15808 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15809 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15810 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15811 | |
| 15812 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15813 | for (i = 0; i < cfg->line_outs; i++) { |
| 15814 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15815 | dac = alc861_look_for_dac(codec, nid); |
| 15816 | if (!dac) |
| 15817 | continue; |
| 15818 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15819 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15820 | return 0; |
| 15821 | } |
| 15822 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15823 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15824 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15825 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15826 | 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] | 15827 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15828 | } |
| 15829 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15830 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15831 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15832 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15833 | /* add playback controls from the parsed DAC table */ |
| 15834 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15835 | const struct auto_pin_cfg *cfg) |
| 15836 | { |
| 15837 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 15838 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15839 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15840 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15841 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15842 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15843 | int i, err, noutputs; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15844 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15845 | noutputs = cfg->line_outs; |
| 15846 | if (spec->multi_ios > 0) |
| 15847 | noutputs += spec->multi_ios; |
| 15848 | |
| 15849 | for (i = 0; i < noutputs; i++) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15850 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15851 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15852 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15853 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15854 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15855 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15856 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15857 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15858 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15859 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15860 | return err; |
| 15861 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15862 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15863 | int index = i; |
| 15864 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15865 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15866 | index = 0; |
| 15867 | } |
| 15868 | err = __alc861_create_out_sw(codec, name, nid, index, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15869 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15870 | return err; |
| 15871 | } |
| 15872 | } |
| 15873 | return 0; |
| 15874 | } |
| 15875 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15876 | 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] | 15877 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15878 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15879 | int err; |
| 15880 | hda_nid_t nid; |
| 15881 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15882 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15883 | return 0; |
| 15884 | |
| 15885 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15886 | nid = alc861_look_for_dac(codec, pin); |
| 15887 | if (nid) { |
| 15888 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15889 | if (err < 0) |
| 15890 | return err; |
| 15891 | spec->multiout.hp_nid = nid; |
| 15892 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15893 | } |
| 15894 | return 0; |
| 15895 | } |
| 15896 | |
| 15897 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15898 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15899 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15900 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15901 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15902 | } |
| 15903 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15904 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15905 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15906 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15907 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15908 | hda_nid_t mix, srcs[5]; |
| 15909 | int i, num; |
| 15910 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15911 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15912 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15913 | 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] | 15914 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15915 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15916 | return; |
| 15917 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15918 | if (num < 0) |
| 15919 | return; |
| 15920 | for (i = 0; i < num; i++) { |
| 15921 | unsigned int mute; |
| 15922 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15923 | mute = AMP_IN_UNMUTE(i); |
| 15924 | else |
| 15925 | mute = AMP_IN_MUTE(i); |
| 15926 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15927 | mute); |
| 15928 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15929 | } |
| 15930 | |
| 15931 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15932 | { |
| 15933 | struct alc_spec *spec = codec->spec; |
| 15934 | int i; |
| 15935 | |
| 15936 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15937 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15938 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15939 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15940 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15941 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15942 | } |
| 15943 | } |
| 15944 | |
| 15945 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15946 | { |
| 15947 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15948 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15949 | if (spec->autocfg.hp_outs) |
| 15950 | alc861_auto_set_output_and_unmute(codec, |
| 15951 | spec->autocfg.hp_pins[0], |
| 15952 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15953 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15954 | if (spec->autocfg.speaker_outs) |
| 15955 | alc861_auto_set_output_and_unmute(codec, |
| 15956 | spec->autocfg.speaker_pins[0], |
| 15957 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15958 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15959 | } |
| 15960 | |
| 15961 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15962 | { |
| 15963 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15964 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15965 | int i; |
| 15966 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15967 | for (i = 0; i < cfg->num_inputs; i++) { |
| 15968 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15969 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 15970 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15971 | } |
| 15972 | } |
| 15973 | |
| 15974 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15975 | /* return 1 if successful, 0 if the proper config is not found, |
| 15976 | * or a negative error code |
| 15977 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15978 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15979 | { |
| 15980 | struct alc_spec *spec = codec->spec; |
| 15981 | int err; |
| 15982 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15983 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15984 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15985 | alc861_ignore); |
| 15986 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15987 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15988 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15989 | return 0; /* can't find valid BIOS pin config */ |
| 15990 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15991 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15992 | if (err < 0) |
| 15993 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15994 | err = alc_auto_add_multi_channel_mode(codec); |
| 15995 | if (err < 0) |
| 15996 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15997 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15998 | if (err < 0) |
| 15999 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16000 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16001 | if (err < 0) |
| 16002 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16003 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16004 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16005 | return err; |
| 16006 | |
| 16007 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16008 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16009 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16010 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16011 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16012 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16013 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16014 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16015 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16016 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16017 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16018 | |
| 16019 | spec->adc_nids = alc861_adc_nids; |
| 16020 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16021 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16022 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16023 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16024 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16025 | return 1; |
| 16026 | } |
| 16027 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16028 | /* additional initialization for auto-configuration model */ |
| 16029 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16030 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16031 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16032 | alc861_auto_init_multi_out(codec); |
| 16033 | alc861_auto_init_hp_out(codec); |
| 16034 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16035 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16036 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16037 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16038 | } |
| 16039 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16040 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16041 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16042 | { 0x15, HDA_INPUT, 0 }, |
| 16043 | { 0x15, HDA_INPUT, 1 }, |
| 16044 | { 0x15, HDA_INPUT, 2 }, |
| 16045 | { 0x15, HDA_INPUT, 3 }, |
| 16046 | { } /* end */ |
| 16047 | }; |
| 16048 | #endif |
| 16049 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16050 | |
| 16051 | /* |
| 16052 | * configuration and preset |
| 16053 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16054 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16055 | [ALC861_3ST] = "3stack", |
| 16056 | [ALC660_3ST] = "3stack-660", |
| 16057 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16058 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16059 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16060 | [ALC861_TOSHIBA] = "toshiba", |
| 16061 | [ALC861_ASUS] = "asus", |
| 16062 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16063 | [ALC861_AUTO] = "auto", |
| 16064 | }; |
| 16065 | |
| 16066 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16067 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16068 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16069 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16070 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16071 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16072 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16073 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16074 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16075 | * Any other models that need this preset? |
| 16076 | */ |
| 16077 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16078 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16079 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16080 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16081 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16082 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16083 | /* FIXME: the below seems conflict */ |
| 16084 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16085 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16086 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16087 | {} |
| 16088 | }; |
| 16089 | |
| 16090 | static struct alc_config_preset alc861_presets[] = { |
| 16091 | [ALC861_3ST] = { |
| 16092 | .mixers = { alc861_3ST_mixer }, |
| 16093 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16094 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16095 | .dac_nids = alc861_dac_nids, |
| 16096 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16097 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16098 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16099 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16100 | .adc_nids = alc861_adc_nids, |
| 16101 | .input_mux = &alc861_capture_source, |
| 16102 | }, |
| 16103 | [ALC861_3ST_DIG] = { |
| 16104 | .mixers = { alc861_base_mixer }, |
| 16105 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16106 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16107 | .dac_nids = alc861_dac_nids, |
| 16108 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16109 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16110 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16111 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16112 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16113 | .adc_nids = alc861_adc_nids, |
| 16114 | .input_mux = &alc861_capture_source, |
| 16115 | }, |
| 16116 | [ALC861_6ST_DIG] = { |
| 16117 | .mixers = { alc861_base_mixer }, |
| 16118 | .init_verbs = { alc861_base_init_verbs }, |
| 16119 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16120 | .dac_nids = alc861_dac_nids, |
| 16121 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16122 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16123 | .channel_mode = alc861_8ch_modes, |
| 16124 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16125 | .adc_nids = alc861_adc_nids, |
| 16126 | .input_mux = &alc861_capture_source, |
| 16127 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16128 | [ALC660_3ST] = { |
| 16129 | .mixers = { alc861_3ST_mixer }, |
| 16130 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16131 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16132 | .dac_nids = alc660_dac_nids, |
| 16133 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16134 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16135 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16136 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16137 | .adc_nids = alc861_adc_nids, |
| 16138 | .input_mux = &alc861_capture_source, |
| 16139 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16140 | [ALC861_UNIWILL_M31] = { |
| 16141 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16142 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16143 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16144 | .dac_nids = alc861_dac_nids, |
| 16145 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16146 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16147 | .channel_mode = alc861_uniwill_m31_modes, |
| 16148 | .need_dac_fix = 1, |
| 16149 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16150 | .adc_nids = alc861_adc_nids, |
| 16151 | .input_mux = &alc861_capture_source, |
| 16152 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16153 | [ALC861_TOSHIBA] = { |
| 16154 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16155 | .init_verbs = { alc861_base_init_verbs, |
| 16156 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16157 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16158 | .dac_nids = alc861_dac_nids, |
| 16159 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16160 | .channel_mode = alc883_3ST_2ch_modes, |
| 16161 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16162 | .adc_nids = alc861_adc_nids, |
| 16163 | .input_mux = &alc861_capture_source, |
| 16164 | .unsol_event = alc861_toshiba_unsol_event, |
| 16165 | .init_hook = alc861_toshiba_automute, |
| 16166 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16167 | [ALC861_ASUS] = { |
| 16168 | .mixers = { alc861_asus_mixer }, |
| 16169 | .init_verbs = { alc861_asus_init_verbs }, |
| 16170 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16171 | .dac_nids = alc861_dac_nids, |
| 16172 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16173 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16174 | .channel_mode = alc861_asus_modes, |
| 16175 | .need_dac_fix = 1, |
| 16176 | .hp_nid = 0x06, |
| 16177 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16178 | .adc_nids = alc861_adc_nids, |
| 16179 | .input_mux = &alc861_capture_source, |
| 16180 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16181 | [ALC861_ASUS_LAPTOP] = { |
| 16182 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16183 | .init_verbs = { alc861_asus_init_verbs, |
| 16184 | alc861_asus_laptop_init_verbs }, |
| 16185 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16186 | .dac_nids = alc861_dac_nids, |
| 16187 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16188 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16189 | .channel_mode = alc883_3ST_2ch_modes, |
| 16190 | .need_dac_fix = 1, |
| 16191 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16192 | .adc_nids = alc861_adc_nids, |
| 16193 | .input_mux = &alc861_capture_source, |
| 16194 | }, |
| 16195 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16196 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16197 | /* Pin config fixes */ |
| 16198 | enum { |
| 16199 | PINFIX_FSC_AMILO_PI1505, |
| 16200 | }; |
| 16201 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16202 | static const struct alc_fixup alc861_fixups[] = { |
| 16203 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16204 | .type = ALC_FIXUP_PINS, |
| 16205 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16206 | { 0x0b, 0x0221101f }, /* HP */ |
| 16207 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16208 | { } |
| 16209 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16210 | }, |
| 16211 | }; |
| 16212 | |
| 16213 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16214 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16215 | {} |
| 16216 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16217 | |
| 16218 | static int patch_alc861(struct hda_codec *codec) |
| 16219 | { |
| 16220 | struct alc_spec *spec; |
| 16221 | int board_config; |
| 16222 | int err; |
| 16223 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16224 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16225 | if (spec == NULL) |
| 16226 | return -ENOMEM; |
| 16227 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16228 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16229 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16230 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16231 | alc861_models, |
| 16232 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16233 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16234 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16235 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16236 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16237 | board_config = ALC861_AUTO; |
| 16238 | } |
| 16239 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16240 | if (board_config == ALC861_AUTO) { |
| 16241 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16242 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16243 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16245 | if (board_config == ALC861_AUTO) { |
| 16246 | /* automatic parse from the BIOS config */ |
| 16247 | err = alc861_parse_auto_config(codec); |
| 16248 | if (err < 0) { |
| 16249 | alc_free(codec); |
| 16250 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16251 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16252 | printk(KERN_INFO |
| 16253 | "hda_codec: Cannot set up configuration " |
| 16254 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16255 | board_config = ALC861_3ST_DIG; |
| 16256 | } |
| 16257 | } |
| 16258 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16259 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16260 | if (err < 0) { |
| 16261 | alc_free(codec); |
| 16262 | return err; |
| 16263 | } |
| 16264 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16265 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16266 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16268 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16269 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16270 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16271 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16272 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16273 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16274 | if (!spec->cap_mixer) |
| 16275 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16276 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16277 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16278 | spec->vmaster_nid = 0x03; |
| 16279 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16280 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16281 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16282 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16283 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16284 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16286 | spec->power_hook = alc_power_eapd; |
| 16287 | #endif |
| 16288 | } |
| 16289 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16290 | if (!spec->loopback.amplist) |
| 16291 | spec->loopback.amplist = alc861_loopbacks; |
| 16292 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16293 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16294 | return 0; |
| 16295 | } |
| 16296 | |
| 16297 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16298 | * ALC861-VD support |
| 16299 | * |
| 16300 | * Based on ALC882 |
| 16301 | * |
| 16302 | * In addition, an independent DAC |
| 16303 | */ |
| 16304 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16305 | |
| 16306 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16307 | /* front, surr, clfe, side surr */ |
| 16308 | 0x02, 0x03, 0x04, 0x05 |
| 16309 | }; |
| 16310 | |
| 16311 | /* dac_nids for ALC660vd are in a different order - according to |
| 16312 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16313 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16314 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16315 | * - and it is the same as in 861vd. |
| 16316 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16317 | */ |
| 16318 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16319 | /* front, rear, clfe, rear_surr */ |
| 16320 | 0x02, 0x04, 0x03 |
| 16321 | }; |
| 16322 | |
| 16323 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16324 | /* ADC0 */ |
| 16325 | 0x09, |
| 16326 | }; |
| 16327 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16328 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16329 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16330 | /* input MUX */ |
| 16331 | /* FIXME: should be a matrix-type input source selection */ |
| 16332 | static struct hda_input_mux alc861vd_capture_source = { |
| 16333 | .num_items = 4, |
| 16334 | .items = { |
| 16335 | { "Mic", 0x0 }, |
| 16336 | { "Front Mic", 0x1 }, |
| 16337 | { "Line", 0x2 }, |
| 16338 | { "CD", 0x4 }, |
| 16339 | }, |
| 16340 | }; |
| 16341 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16342 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16343 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16344 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16345 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16346 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16347 | }, |
| 16348 | }; |
| 16349 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16350 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16351 | .num_items = 2, |
| 16352 | .items = { |
| 16353 | { "Front Mic", 0x0 }, |
| 16354 | { "ATAPI Mic", 0x1 }, |
| 16355 | }, |
| 16356 | }; |
| 16357 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16358 | /* |
| 16359 | * 2ch mode |
| 16360 | */ |
| 16361 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16362 | { 2, NULL } |
| 16363 | }; |
| 16364 | |
| 16365 | /* |
| 16366 | * 6ch mode |
| 16367 | */ |
| 16368 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16369 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16370 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16371 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16372 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16373 | { } /* end */ |
| 16374 | }; |
| 16375 | |
| 16376 | /* |
| 16377 | * 8ch mode |
| 16378 | */ |
| 16379 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16380 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16381 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16382 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16383 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16384 | { } /* end */ |
| 16385 | }; |
| 16386 | |
| 16387 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16388 | { 6, alc861vd_6stack_ch6_init }, |
| 16389 | { 8, alc861vd_6stack_ch8_init }, |
| 16390 | }; |
| 16391 | |
| 16392 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16393 | { |
| 16394 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16395 | .name = "Channel Mode", |
| 16396 | .info = alc_ch_mode_info, |
| 16397 | .get = alc_ch_mode_get, |
| 16398 | .put = alc_ch_mode_put, |
| 16399 | }, |
| 16400 | { } /* end */ |
| 16401 | }; |
| 16402 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16403 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16404 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16405 | */ |
| 16406 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16407 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16408 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16409 | |
| 16410 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16411 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16412 | |
| 16413 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16414 | HDA_OUTPUT), |
| 16415 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16416 | HDA_OUTPUT), |
| 16417 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16418 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16419 | |
| 16420 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16421 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16422 | |
| 16423 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16424 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16425 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16426 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16427 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16428 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16429 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16430 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16431 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16432 | |
| 16433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16434 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16435 | |
| 16436 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16437 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16438 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16439 | { } /* end */ |
| 16440 | }; |
| 16441 | |
| 16442 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16443 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16444 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16445 | |
| 16446 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16447 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16448 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16450 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16451 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16452 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16453 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16455 | |
| 16456 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16457 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16458 | |
| 16459 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16460 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16461 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16462 | { } /* end */ |
| 16463 | }; |
| 16464 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16465 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16466 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16467 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16468 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16469 | |
| 16470 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16471 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16472 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16473 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16474 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16475 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16476 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16477 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16478 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16479 | |
| 16480 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16481 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16482 | |
| 16483 | { } /* end */ |
| 16484 | }; |
| 16485 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16486 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16487 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16488 | */ |
| 16489 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16490 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16491 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16492 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16493 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16494 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16495 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16496 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16497 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16498 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16499 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16500 | { } /* end */ |
| 16501 | }; |
| 16502 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16503 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16504 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16505 | */ |
| 16506 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16507 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16508 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16509 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16510 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16511 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16512 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16513 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16514 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16515 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16516 | { } /* end */ |
| 16517 | }; |
| 16518 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16519 | /* |
| 16520 | * generic initialization of ADC, input mixers and output mixers |
| 16521 | */ |
| 16522 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16523 | /* |
| 16524 | * Unmute ADC0 and set the default input to mic-in |
| 16525 | */ |
| 16526 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16527 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16528 | |
| 16529 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16530 | * the analog-loopback mixer widget |
| 16531 | */ |
| 16532 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16533 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16534 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16535 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16536 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16537 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16538 | |
| 16539 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16542 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16543 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16544 | |
| 16545 | /* |
| 16546 | * Set up output mixers (0x02 - 0x05) |
| 16547 | */ |
| 16548 | /* set vol=0 to output mixers */ |
| 16549 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16550 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16551 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16552 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16553 | |
| 16554 | /* set up input amps for analog loopback */ |
| 16555 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16557 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16558 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16559 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16560 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16561 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16562 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16563 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16564 | |
| 16565 | { } |
| 16566 | }; |
| 16567 | |
| 16568 | /* |
| 16569 | * 3-stack pin configuration: |
| 16570 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16571 | */ |
| 16572 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16573 | /* |
| 16574 | * Set pin mode and muting |
| 16575 | */ |
| 16576 | /* set front pin widgets 0x14 for output */ |
| 16577 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16578 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16579 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16580 | |
| 16581 | /* Mic (rear) pin: input vref at 80% */ |
| 16582 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16583 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16584 | /* Front Mic pin: input vref at 80% */ |
| 16585 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16586 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16587 | /* Line In pin: input */ |
| 16588 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16589 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16590 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16591 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16592 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16593 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16594 | /* CD pin widget for input */ |
| 16595 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16596 | |
| 16597 | { } |
| 16598 | }; |
| 16599 | |
| 16600 | /* |
| 16601 | * 6-stack pin configuration: |
| 16602 | */ |
| 16603 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16604 | /* |
| 16605 | * Set pin mode and muting |
| 16606 | */ |
| 16607 | /* set front pin widgets 0x14 for output */ |
| 16608 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16609 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16610 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16611 | |
| 16612 | /* Rear Pin: output 1 (0x0d) */ |
| 16613 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16614 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16615 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16616 | /* CLFE Pin: output 2 (0x0e) */ |
| 16617 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16618 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16619 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16620 | /* Side Pin: output 3 (0x0f) */ |
| 16621 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16622 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16623 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16624 | |
| 16625 | /* Mic (rear) pin: input vref at 80% */ |
| 16626 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16627 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16628 | /* Front Mic pin: input vref at 80% */ |
| 16629 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16630 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16631 | /* Line In pin: input */ |
| 16632 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16633 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16634 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16635 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16636 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16637 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16638 | /* CD pin widget for input */ |
| 16639 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16640 | |
| 16641 | { } |
| 16642 | }; |
| 16643 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16644 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16645 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16646 | { } |
| 16647 | }; |
| 16648 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16649 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16650 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16651 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16652 | { } |
| 16653 | }; |
| 16654 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16655 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16657 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16659 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16660 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16661 | {} |
| 16662 | }; |
| 16663 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16664 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16665 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16666 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16667 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16668 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16669 | spec->automute = 1; |
| 16670 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16671 | } |
| 16672 | |
| 16673 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16674 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16675 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16676 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16677 | } |
| 16678 | |
| 16679 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16680 | unsigned int res) |
| 16681 | { |
| 16682 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16683 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16684 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16685 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16686 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16687 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16688 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16689 | } |
| 16690 | } |
| 16691 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16692 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16693 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16694 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16695 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16696 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16697 | |
| 16698 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16699 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16700 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16701 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16702 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16703 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16704 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16705 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16706 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16709 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16711 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16712 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16713 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16714 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16715 | |
| 16716 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16717 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16718 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16719 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16720 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16721 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16722 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16723 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16724 | |
| 16725 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16726 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16729 | |
| 16730 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16731 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16732 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16733 | |
| 16734 | { } /* end */ |
| 16735 | }; |
| 16736 | |
| 16737 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16738 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16739 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16740 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16741 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16742 | spec->autocfg.hp_pins[0] = 0x15; |
| 16743 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16744 | spec->automute = 1; |
| 16745 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16746 | } |
| 16747 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16748 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16749 | #define alc861vd_loopbacks alc880_loopbacks |
| 16750 | #endif |
| 16751 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16752 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16753 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16754 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16755 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16756 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16757 | |
| 16758 | /* |
| 16759 | * configuration and preset |
| 16760 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16761 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16762 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16763 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16764 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16765 | [ALC861VD_3ST] = "3stack", |
| 16766 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16767 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16768 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16769 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16770 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16771 | [ALC861VD_AUTO] = "auto", |
| 16772 | }; |
| 16773 | |
| 16774 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16775 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16776 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16777 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16778 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16779 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16780 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16781 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16782 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16783 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16784 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16785 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16786 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16787 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16788 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16789 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16790 | {} |
| 16791 | }; |
| 16792 | |
| 16793 | static struct alc_config_preset alc861vd_presets[] = { |
| 16794 | [ALC660VD_3ST] = { |
| 16795 | .mixers = { alc861vd_3st_mixer }, |
| 16796 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16797 | alc861vd_3stack_init_verbs }, |
| 16798 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16799 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16800 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16801 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16802 | .input_mux = &alc861vd_capture_source, |
| 16803 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16804 | [ALC660VD_3ST_DIG] = { |
| 16805 | .mixers = { alc861vd_3st_mixer }, |
| 16806 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16807 | alc861vd_3stack_init_verbs }, |
| 16808 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16809 | .dac_nids = alc660vd_dac_nids, |
| 16810 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16811 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16812 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16813 | .input_mux = &alc861vd_capture_source, |
| 16814 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16815 | [ALC861VD_3ST] = { |
| 16816 | .mixers = { alc861vd_3st_mixer }, |
| 16817 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16818 | alc861vd_3stack_init_verbs }, |
| 16819 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16820 | .dac_nids = alc861vd_dac_nids, |
| 16821 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16822 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16823 | .input_mux = &alc861vd_capture_source, |
| 16824 | }, |
| 16825 | [ALC861VD_3ST_DIG] = { |
| 16826 | .mixers = { alc861vd_3st_mixer }, |
| 16827 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16828 | alc861vd_3stack_init_verbs }, |
| 16829 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16830 | .dac_nids = alc861vd_dac_nids, |
| 16831 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16832 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16833 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16834 | .input_mux = &alc861vd_capture_source, |
| 16835 | }, |
| 16836 | [ALC861VD_6ST_DIG] = { |
| 16837 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16838 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16839 | alc861vd_6stack_init_verbs }, |
| 16840 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16841 | .dac_nids = alc861vd_dac_nids, |
| 16842 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16843 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16844 | .channel_mode = alc861vd_6stack_modes, |
| 16845 | .input_mux = &alc861vd_capture_source, |
| 16846 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16847 | [ALC861VD_LENOVO] = { |
| 16848 | .mixers = { alc861vd_lenovo_mixer }, |
| 16849 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16850 | alc861vd_3stack_init_verbs, |
| 16851 | alc861vd_eapd_verbs, |
| 16852 | alc861vd_lenovo_unsol_verbs }, |
| 16853 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16854 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16855 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16856 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16857 | .input_mux = &alc861vd_capture_source, |
| 16858 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16859 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16860 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16861 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16862 | [ALC861VD_DALLAS] = { |
| 16863 | .mixers = { alc861vd_dallas_mixer }, |
| 16864 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16865 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16866 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16867 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16868 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16869 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16870 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16871 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16872 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16873 | }, |
| 16874 | [ALC861VD_HP] = { |
| 16875 | .mixers = { alc861vd_hp_mixer }, |
| 16876 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16877 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16878 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16879 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16880 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16881 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16882 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16883 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16884 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16885 | .init_hook = alc_hp_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16886 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16887 | [ALC660VD_ASUS_V1S] = { |
| 16888 | .mixers = { alc861vd_lenovo_mixer }, |
| 16889 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16890 | alc861vd_3stack_init_verbs, |
| 16891 | alc861vd_eapd_verbs, |
| 16892 | alc861vd_lenovo_unsol_verbs }, |
| 16893 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16894 | .dac_nids = alc660vd_dac_nids, |
| 16895 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16896 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16897 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16898 | .input_mux = &alc861vd_capture_source, |
| 16899 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16900 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16901 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16902 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16903 | }; |
| 16904 | |
| 16905 | /* |
| 16906 | * BIOS auto configuration |
| 16907 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16908 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16909 | const struct auto_pin_cfg *cfg) |
| 16910 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 16911 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16912 | } |
| 16913 | |
| 16914 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16915 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16916 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16917 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16918 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16919 | } |
| 16920 | |
| 16921 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16922 | { |
| 16923 | struct alc_spec *spec = codec->spec; |
| 16924 | int i; |
| 16925 | |
| 16926 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16927 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16928 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16929 | if (nid) |
| 16930 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16931 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16932 | } |
| 16933 | } |
| 16934 | |
| 16935 | |
| 16936 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16937 | { |
| 16938 | struct alc_spec *spec = codec->spec; |
| 16939 | hda_nid_t pin; |
| 16940 | |
| 16941 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16942 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16943 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16944 | pin = spec->autocfg.speaker_pins[0]; |
| 16945 | if (pin) |
| 16946 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16947 | } |
| 16948 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16949 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16950 | |
| 16951 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16952 | { |
| 16953 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16954 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16955 | int i; |
| 16956 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16957 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16958 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16959 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16960 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16961 | if (nid != ALC861VD_PIN_CD_NID && |
| 16962 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16963 | snd_hda_codec_write(codec, nid, 0, |
| 16964 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16965 | AMP_OUT_MUTE); |
| 16966 | } |
| 16967 | } |
| 16968 | } |
| 16969 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16970 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16971 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16972 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16973 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16974 | |
| 16975 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 16976 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16977 | * different NIDs for mute/unmute switch and volume control */ |
| 16978 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16979 | const struct auto_pin_cfg *cfg) |
| 16980 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16981 | static const char * const chname[4] = { |
| 16982 | "Front", "Surround", "CLFE", "Side" |
| 16983 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16984 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16985 | hda_nid_t nid_v, nid_s; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16986 | int i, err, noutputs; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16987 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16988 | noutputs = cfg->line_outs; |
| 16989 | if (spec->multi_ios > 0) |
| 16990 | noutputs += spec->multi_ios; |
| 16991 | |
| 16992 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16993 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16994 | continue; |
| 16995 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16996 | alc880_dac_to_idx( |
| 16997 | spec->multiout.dac_nids[i])); |
| 16998 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16999 | alc880_dac_to_idx( |
| 17000 | spec->multiout.dac_nids[i])); |
| 17001 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17002 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17003 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17004 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17005 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17006 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17007 | HDA_OUTPUT)); |
| 17008 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17009 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17010 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17011 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17012 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17013 | HDA_OUTPUT)); |
| 17014 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17015 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17016 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17017 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17018 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17019 | HDA_INPUT)); |
| 17020 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17021 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17022 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17023 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17024 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17025 | HDA_INPUT)); |
| 17026 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17027 | return err; |
| 17028 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17029 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17030 | int index = i; |
| 17031 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17032 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17033 | index = 0; |
| 17034 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17035 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17036 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17037 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17038 | HDA_OUTPUT)); |
| 17039 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17040 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17041 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17042 | name, index, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17043 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17044 | HDA_INPUT)); |
| 17045 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17046 | return err; |
| 17047 | } |
| 17048 | } |
| 17049 | return 0; |
| 17050 | } |
| 17051 | |
| 17052 | /* add playback controls for speaker and HP outputs */ |
| 17053 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17054 | * different NIDs for mute/unmute switch and volume control */ |
| 17055 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17056 | hda_nid_t pin, const char *pfx) |
| 17057 | { |
| 17058 | hda_nid_t nid_v, nid_s; |
| 17059 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17060 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17061 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17062 | return 0; |
| 17063 | |
| 17064 | if (alc880_is_fixed_pin(pin)) { |
| 17065 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17066 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17067 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17068 | spec->multiout.hp_nid = nid_v; |
| 17069 | else |
| 17070 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17071 | /* control HP volume/switch on the output mixer amp */ |
| 17072 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17073 | alc880_fixed_pin_idx(pin)); |
| 17074 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17075 | alc880_fixed_pin_idx(pin)); |
| 17076 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17077 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17078 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17079 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17080 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17081 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17082 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17083 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17084 | return err; |
| 17085 | } else if (alc880_is_multi_pin(pin)) { |
| 17086 | /* set manual connection */ |
| 17087 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17088 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17089 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17090 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17091 | return err; |
| 17092 | } |
| 17093 | return 0; |
| 17094 | } |
| 17095 | |
| 17096 | /* parse the BIOS configuration and set up the alc_spec |
| 17097 | * return 1 if successful, 0 if the proper config is not found, |
| 17098 | * or a negative error code |
| 17099 | * Based on ALC880 version - had to change it to override |
| 17100 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17101 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17102 | { |
| 17103 | struct alc_spec *spec = codec->spec; |
| 17104 | int err; |
| 17105 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17106 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17107 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17108 | alc861vd_ignore); |
| 17109 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17110 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17111 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17112 | return 0; /* can't find valid BIOS pin config */ |
| 17113 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17114 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17115 | if (err < 0) |
| 17116 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17117 | err = alc_auto_add_multi_channel_mode(codec); |
| 17118 | if (err < 0) |
| 17119 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17120 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17121 | if (err < 0) |
| 17122 | return err; |
| 17123 | err = alc861vd_auto_create_extra_out(spec, |
| 17124 | spec->autocfg.speaker_pins[0], |
| 17125 | "Speaker"); |
| 17126 | if (err < 0) |
| 17127 | return err; |
| 17128 | err = alc861vd_auto_create_extra_out(spec, |
| 17129 | spec->autocfg.hp_pins[0], |
| 17130 | "Headphone"); |
| 17131 | if (err < 0) |
| 17132 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17133 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17134 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17135 | return err; |
| 17136 | |
| 17137 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17138 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17139 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17140 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17141 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17142 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17143 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17144 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17145 | |
| 17146 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17147 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17148 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17149 | err = alc_auto_add_mic_boost(codec); |
| 17150 | if (err < 0) |
| 17151 | return err; |
| 17152 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17153 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17154 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17155 | return 1; |
| 17156 | } |
| 17157 | |
| 17158 | /* additional initialization for auto-configuration model */ |
| 17159 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17160 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17161 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17162 | alc861vd_auto_init_multi_out(codec); |
| 17163 | alc861vd_auto_init_hp_out(codec); |
| 17164 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17165 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17166 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17167 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17168 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17169 | } |
| 17170 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17171 | enum { |
| 17172 | ALC660VD_FIX_ASUS_GPIO1 |
| 17173 | }; |
| 17174 | |
| 17175 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17176 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17177 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17178 | .type = ALC_FIXUP_VERBS, |
| 17179 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17180 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17181 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17182 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17183 | { } |
| 17184 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17185 | }, |
| 17186 | }; |
| 17187 | |
| 17188 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17189 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17190 | {} |
| 17191 | }; |
| 17192 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17193 | static int patch_alc861vd(struct hda_codec *codec) |
| 17194 | { |
| 17195 | struct alc_spec *spec; |
| 17196 | int err, board_config; |
| 17197 | |
| 17198 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17199 | if (spec == NULL) |
| 17200 | return -ENOMEM; |
| 17201 | |
| 17202 | codec->spec = spec; |
| 17203 | |
| 17204 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17205 | alc861vd_models, |
| 17206 | alc861vd_cfg_tbl); |
| 17207 | |
| 17208 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17209 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17210 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17211 | board_config = ALC861VD_AUTO; |
| 17212 | } |
| 17213 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17214 | if (board_config == ALC861VD_AUTO) { |
| 17215 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17216 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17217 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17218 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17219 | if (board_config == ALC861VD_AUTO) { |
| 17220 | /* automatic parse from the BIOS config */ |
| 17221 | err = alc861vd_parse_auto_config(codec); |
| 17222 | if (err < 0) { |
| 17223 | alc_free(codec); |
| 17224 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17225 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17226 | printk(KERN_INFO |
| 17227 | "hda_codec: Cannot set up configuration " |
| 17228 | "from BIOS. Using base mode...\n"); |
| 17229 | board_config = ALC861VD_3ST; |
| 17230 | } |
| 17231 | } |
| 17232 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17233 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17234 | if (err < 0) { |
| 17235 | alc_free(codec); |
| 17236 | return err; |
| 17237 | } |
| 17238 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17239 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17240 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17241 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17242 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17243 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17244 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17245 | } |
| 17246 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17247 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17248 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17249 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17250 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17251 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17252 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17253 | if (!spec->adc_nids) { |
| 17254 | spec->adc_nids = alc861vd_adc_nids; |
| 17255 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17256 | } |
| 17257 | if (!spec->capsrc_nids) |
| 17258 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17259 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17260 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17261 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17262 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17263 | spec->vmaster_nid = 0x02; |
| 17264 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17265 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17266 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17267 | codec->patch_ops = alc_patch_ops; |
| 17268 | |
| 17269 | if (board_config == ALC861VD_AUTO) |
| 17270 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 17271 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17272 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17273 | if (!spec->loopback.amplist) |
| 17274 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17275 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17276 | |
| 17277 | return 0; |
| 17278 | } |
| 17279 | |
| 17280 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17281 | * ALC662 support |
| 17282 | * |
| 17283 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17284 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17285 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17286 | * 6-channel independent captures. |
| 17287 | * |
| 17288 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17289 | * driver yet). |
| 17290 | */ |
| 17291 | #define ALC662_DIGOUT_NID 0x06 |
| 17292 | #define ALC662_DIGIN_NID 0x0a |
| 17293 | |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 17294 | static hda_nid_t alc662_dac_nids[3] = { |
| 17295 | /* front, rear, clfe */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17296 | 0x02, 0x03, 0x04 |
| 17297 | }; |
| 17298 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17299 | static hda_nid_t alc272_dac_nids[2] = { |
| 17300 | 0x02, 0x03 |
| 17301 | }; |
| 17302 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17303 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17304 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17305 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17306 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17307 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17308 | static hda_nid_t alc272_adc_nids[1] = { |
| 17309 | /* ADC1-2 */ |
| 17310 | 0x08, |
| 17311 | }; |
| 17312 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17313 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17314 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17315 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17316 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17317 | /* input MUX */ |
| 17318 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17319 | static struct hda_input_mux alc662_capture_source = { |
| 17320 | .num_items = 4, |
| 17321 | .items = { |
| 17322 | { "Mic", 0x0 }, |
| 17323 | { "Front Mic", 0x1 }, |
| 17324 | { "Line", 0x2 }, |
| 17325 | { "CD", 0x4 }, |
| 17326 | }, |
| 17327 | }; |
| 17328 | |
| 17329 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17330 | .num_items = 2, |
| 17331 | .items = { |
| 17332 | { "Mic", 0x1 }, |
| 17333 | { "Line", 0x2 }, |
| 17334 | }, |
| 17335 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17336 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17337 | static struct hda_input_mux alc663_capture_source = { |
| 17338 | .num_items = 3, |
| 17339 | .items = { |
| 17340 | { "Mic", 0x0 }, |
| 17341 | { "Front Mic", 0x1 }, |
| 17342 | { "Line", 0x2 }, |
| 17343 | }, |
| 17344 | }; |
| 17345 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17346 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17347 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17348 | .num_items = 16, |
| 17349 | .items = { |
| 17350 | { "Autoselect Mic", 0x0 }, |
| 17351 | { "Internal Mic", 0x1 }, |
| 17352 | { "In-0x02", 0x2 }, |
| 17353 | { "In-0x03", 0x3 }, |
| 17354 | { "In-0x04", 0x4 }, |
| 17355 | { "In-0x05", 0x5 }, |
| 17356 | { "In-0x06", 0x6 }, |
| 17357 | { "In-0x07", 0x7 }, |
| 17358 | { "In-0x08", 0x8 }, |
| 17359 | { "In-0x09", 0x9 }, |
| 17360 | { "In-0x0a", 0x0a }, |
| 17361 | { "In-0x0b", 0x0b }, |
| 17362 | { "In-0x0c", 0x0c }, |
| 17363 | { "In-0x0d", 0x0d }, |
| 17364 | { "In-0x0e", 0x0e }, |
| 17365 | { "In-0x0f", 0x0f }, |
| 17366 | }, |
| 17367 | }; |
| 17368 | #endif |
| 17369 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17370 | /* |
| 17371 | * 2ch mode |
| 17372 | */ |
| 17373 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17374 | { 2, NULL } |
| 17375 | }; |
| 17376 | |
| 17377 | /* |
| 17378 | * 2ch mode |
| 17379 | */ |
| 17380 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17381 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17382 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17383 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17384 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17385 | { } /* end */ |
| 17386 | }; |
| 17387 | |
| 17388 | /* |
| 17389 | * 6ch mode |
| 17390 | */ |
| 17391 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17392 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17393 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17394 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17395 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17396 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17397 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17398 | { } /* end */ |
| 17399 | }; |
| 17400 | |
| 17401 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17402 | { 2, alc662_3ST_ch2_init }, |
| 17403 | { 6, alc662_3ST_ch6_init }, |
| 17404 | }; |
| 17405 | |
| 17406 | /* |
| 17407 | * 2ch mode |
| 17408 | */ |
| 17409 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17410 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17411 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17412 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17413 | { } /* end */ |
| 17414 | }; |
| 17415 | |
| 17416 | /* |
| 17417 | * 6ch mode |
| 17418 | */ |
| 17419 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17420 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17421 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17422 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17423 | { } /* end */ |
| 17424 | }; |
| 17425 | |
| 17426 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17427 | { 2, alc662_sixstack_ch6_init }, |
| 17428 | { 6, alc662_sixstack_ch8_init }, |
| 17429 | }; |
| 17430 | |
| 17431 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17432 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17433 | */ |
| 17434 | |
| 17435 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17436 | /* output mixer control */ |
| 17437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17438 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17439 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17440 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17441 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17442 | 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] | 17443 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17444 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17445 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17446 | |
| 17447 | /*Input mixer control */ |
| 17448 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17449 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17450 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17451 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17453 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17454 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17455 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17456 | { } /* end */ |
| 17457 | }; |
| 17458 | |
| 17459 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17460 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17461 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17466 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17469 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17470 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17471 | { } /* end */ |
| 17472 | }; |
| 17473 | |
| 17474 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17475 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17476 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17477 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17478 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17479 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17480 | 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] | 17481 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17482 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17483 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17484 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17485 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17486 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17487 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17488 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17489 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17490 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17491 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17492 | { } /* end */ |
| 17493 | }; |
| 17494 | |
| 17495 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17496 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17497 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17498 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17499 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17500 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17501 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17502 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17504 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17505 | { } /* end */ |
| 17506 | }; |
| 17507 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17508 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17509 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17510 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17511 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17512 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17513 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17514 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17515 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17516 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17517 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17518 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17519 | { } /* end */ |
| 17520 | }; |
| 17521 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17522 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17523 | ALC262_HIPPO_MASTER_SWITCH, |
| 17524 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17525 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17526 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17527 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17528 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17529 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17530 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17533 | { } /* end */ |
| 17534 | }; |
| 17535 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17536 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17537 | .ops = &snd_hda_bind_vol, |
| 17538 | .values = { |
| 17539 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17540 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17541 | 0 |
| 17542 | }, |
| 17543 | }; |
| 17544 | |
| 17545 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17546 | .ops = &snd_hda_bind_sw, |
| 17547 | .values = { |
| 17548 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17549 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17550 | 0 |
| 17551 | }, |
| 17552 | }; |
| 17553 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17554 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17555 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17556 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17557 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17558 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17559 | { } /* end */ |
| 17560 | }; |
| 17561 | |
| 17562 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17563 | .ops = &snd_hda_bind_sw, |
| 17564 | .values = { |
| 17565 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17566 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17567 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17568 | 0 |
| 17569 | }, |
| 17570 | }; |
| 17571 | |
| 17572 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17573 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17574 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17575 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17576 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17577 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17578 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17579 | |
| 17580 | { } /* end */ |
| 17581 | }; |
| 17582 | |
| 17583 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17584 | .ops = &snd_hda_bind_sw, |
| 17585 | .values = { |
| 17586 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17587 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17588 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17589 | 0 |
| 17590 | }, |
| 17591 | }; |
| 17592 | |
| 17593 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17594 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17595 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17598 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17599 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17600 | { } /* end */ |
| 17601 | }; |
| 17602 | |
| 17603 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17604 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17605 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17606 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17607 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17608 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17609 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17610 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17611 | { } /* end */ |
| 17612 | }; |
| 17613 | |
| 17614 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17615 | .ops = &snd_hda_bind_vol, |
| 17616 | .values = { |
| 17617 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17618 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17619 | 0 |
| 17620 | }, |
| 17621 | }; |
| 17622 | |
| 17623 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17624 | .ops = &snd_hda_bind_sw, |
| 17625 | .values = { |
| 17626 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17627 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17628 | 0 |
| 17629 | }, |
| 17630 | }; |
| 17631 | |
| 17632 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17633 | HDA_BIND_VOL("Master Playback Volume", |
| 17634 | &alc663_asus_two_bind_master_vol), |
| 17635 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17636 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17637 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17640 | { } /* end */ |
| 17641 | }; |
| 17642 | |
| 17643 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17644 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17645 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17646 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17647 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17648 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17649 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17650 | { } /* end */ |
| 17651 | }; |
| 17652 | |
| 17653 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17654 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17655 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17656 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17657 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17658 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17659 | |
| 17660 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17661 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17662 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17663 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17664 | { } /* end */ |
| 17665 | }; |
| 17666 | |
| 17667 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17668 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17669 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17670 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17671 | |
| 17672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17674 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17675 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17676 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17677 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17678 | { } /* end */ |
| 17679 | }; |
| 17680 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17681 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17682 | .ops = &snd_hda_bind_sw, |
| 17683 | .values = { |
| 17684 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17685 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17686 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17687 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17688 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17689 | 0 |
| 17690 | }, |
| 17691 | }; |
| 17692 | |
| 17693 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17694 | .ops = &snd_hda_bind_sw, |
| 17695 | .values = { |
| 17696 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17697 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17698 | 0 |
| 17699 | }, |
| 17700 | }; |
| 17701 | |
| 17702 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17703 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17704 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17705 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17706 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17707 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17708 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17709 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17711 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17712 | { } /* end */ |
| 17713 | }; |
| 17714 | |
| 17715 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17716 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17717 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17718 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17719 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17720 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17722 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17723 | { } /* end */ |
| 17724 | }; |
| 17725 | |
| 17726 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17727 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17728 | { |
| 17729 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17730 | .name = "Channel Mode", |
| 17731 | .info = alc_ch_mode_info, |
| 17732 | .get = alc_ch_mode_get, |
| 17733 | .put = alc_ch_mode_put, |
| 17734 | }, |
| 17735 | { } /* end */ |
| 17736 | }; |
| 17737 | |
| 17738 | static struct hda_verb alc662_init_verbs[] = { |
| 17739 | /* ADC: mute amp left and right */ |
| 17740 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17741 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17742 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17743 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17745 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17746 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17747 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17749 | |
| 17750 | /* Front Pin: output 0 (0x0c) */ |
| 17751 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17752 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17753 | |
| 17754 | /* Rear Pin: output 1 (0x0d) */ |
| 17755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17756 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17757 | |
| 17758 | /* CLFE Pin: output 2 (0x0e) */ |
| 17759 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17760 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17761 | |
| 17762 | /* Mic (rear) pin: input vref at 80% */ |
| 17763 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17764 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17765 | /* Front Mic pin: input vref at 80% */ |
| 17766 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17767 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17768 | /* Line In pin: input */ |
| 17769 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17770 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17771 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17772 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17773 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17774 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17775 | /* CD pin widget for input */ |
| 17776 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17777 | |
| 17778 | /* FIXME: use matrix-type input source selection */ |
| 17779 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17780 | /* Input mixer */ |
| 17781 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17782 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17783 | |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 17784 | { } |
| 17785 | }; |
| 17786 | |
| 17787 | static struct hda_verb alc662_eapd_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17788 | /* always trun on EAPD */ |
| 17789 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17790 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17791 | { } |
| 17792 | }; |
| 17793 | |
| 17794 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17795 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17796 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17797 | {} |
| 17798 | }; |
| 17799 | |
| 17800 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17801 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17802 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17803 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17804 | }; |
| 17805 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17806 | /* Set Unsolicited Event*/ |
| 17807 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17808 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17809 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17810 | {} |
| 17811 | }; |
| 17812 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17813 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17815 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17816 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17817 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17818 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17820 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17821 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17822 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17823 | {} |
| 17824 | }; |
| 17825 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17826 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17827 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17828 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17829 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17830 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17832 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17833 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17834 | {} |
| 17835 | }; |
| 17836 | |
| 17837 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17838 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17839 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17840 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17841 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17843 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17844 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17845 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17846 | {} |
| 17847 | }; |
| 17848 | |
| 17849 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17850 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17851 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17852 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17853 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17854 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17855 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17856 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17857 | {} |
| 17858 | }; |
| 17859 | |
| 17860 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17861 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17862 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17863 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17864 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17865 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17867 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17870 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17871 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17872 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17873 | {} |
| 17874 | }; |
| 17875 | |
| 17876 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17877 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17878 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17879 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17880 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17881 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17883 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17886 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17887 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17888 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17889 | {} |
| 17890 | }; |
| 17891 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17892 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17893 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17894 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17895 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17896 | |
| 17897 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17898 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17899 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17900 | |
| 17901 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17902 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17903 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17904 | {} |
| 17905 | }; |
| 17906 | |
| 17907 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17908 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17909 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17910 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17911 | |
| 17912 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17913 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17914 | {} |
| 17915 | }; |
| 17916 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17917 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17918 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17919 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17920 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17921 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17922 | {} |
| 17923 | }; |
| 17924 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17925 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17926 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17927 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17929 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17930 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17931 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17932 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17935 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17936 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17937 | {} |
| 17938 | }; |
| 17939 | |
| 17940 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17941 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17942 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17943 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17944 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17945 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17946 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17947 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17948 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17949 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17950 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17951 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17952 | {} |
| 17953 | }; |
| 17954 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17955 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17957 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17958 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17959 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17960 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17961 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17962 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17963 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17964 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17965 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17968 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17969 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17970 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17971 | {} |
| 17972 | }; |
| 17973 | |
| 17974 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17975 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17977 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17978 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17979 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17980 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17981 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17983 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17984 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17985 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17986 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17988 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17989 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17990 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17991 | {} |
| 17992 | }; |
| 17993 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17994 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17995 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17996 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17997 | { } /* end */ |
| 17998 | }; |
| 17999 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18000 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18001 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18002 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18003 | { } /* end */ |
| 18004 | }; |
| 18005 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18006 | static void alc662_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18007 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18008 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18009 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18010 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18011 | spec->autocfg.line_out_pins[0] = 0x14; |
| 18012 | spec->autocfg.speaker_pins[0] = 0x15; |
| 18013 | spec->automute = 1; |
| 18014 | spec->detect_line = 1; |
| 18015 | spec->automute_lines = 1; |
| 18016 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18017 | } |
| 18018 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18019 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18020 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18021 | struct alc_spec *spec = codec->spec; |
| 18022 | |
| 18023 | alc262_hippo1_setup(codec); |
| 18024 | spec->ext_mic.pin = 0x18; |
| 18025 | spec->ext_mic.mux_idx = 0; |
| 18026 | spec->int_mic.pin = 0x19; |
| 18027 | spec->int_mic.mux_idx = 1; |
| 18028 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18029 | } |
| 18030 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18031 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18032 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18033 | struct alc_spec *spec = codec->spec; |
| 18034 | |
| 18035 | spec->autocfg.hp_pins[0] = 0x14; |
| 18036 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18037 | spec->automute = 1; |
| 18038 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18039 | } |
| 18040 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18041 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18042 | { |
| 18043 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18044 | spec->autocfg.hp_pins[0] = 0x21; |
| 18045 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18046 | spec->automute_mixer_nid[0] = 0x0c; |
| 18047 | spec->automute = 1; |
| 18048 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18049 | spec->ext_mic.pin = 0x18; |
| 18050 | spec->ext_mic.mux_idx = 0; |
| 18051 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18052 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18053 | spec->auto_mic = 1; |
| 18054 | } |
| 18055 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18056 | /* ***************** Mode1 ******************************/ |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18057 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18058 | { |
| 18059 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18060 | spec->autocfg.hp_pins[0] = 0x21; |
| 18061 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18062 | spec->automute_mixer_nid[0] = 0x0c; |
| 18063 | spec->automute = 1; |
| 18064 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18065 | spec->ext_mic.pin = 0x18; |
| 18066 | spec->ext_mic.mux_idx = 0; |
| 18067 | spec->int_mic.pin = 0x19; |
| 18068 | spec->int_mic.mux_idx = 1; |
| 18069 | spec->auto_mic = 1; |
| 18070 | } |
| 18071 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18072 | /* ***************** Mode2 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18073 | static void alc662_mode2_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18074 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18075 | struct alc_spec *spec = codec->spec; |
| 18076 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18077 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18078 | spec->automute = 1; |
| 18079 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18080 | spec->ext_mic.pin = 0x18; |
| 18081 | spec->ext_mic.mux_idx = 0; |
| 18082 | spec->int_mic.pin = 0x19; |
| 18083 | spec->int_mic.mux_idx = 1; |
| 18084 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18085 | } |
| 18086 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18087 | /* ***************** Mode3 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18088 | static void alc663_mode3_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18089 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18090 | struct alc_spec *spec = codec->spec; |
| 18091 | spec->autocfg.hp_pins[0] = 0x21; |
| 18092 | spec->autocfg.hp_pins[0] = 0x15; |
| 18093 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18094 | spec->automute = 1; |
| 18095 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18096 | spec->ext_mic.pin = 0x18; |
| 18097 | spec->ext_mic.mux_idx = 0; |
| 18098 | spec->int_mic.pin = 0x19; |
| 18099 | spec->int_mic.mux_idx = 1; |
| 18100 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18101 | } |
| 18102 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18103 | /* ***************** Mode4 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18104 | static void alc663_mode4_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18105 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18106 | struct alc_spec *spec = codec->spec; |
| 18107 | spec->autocfg.hp_pins[0] = 0x21; |
| 18108 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18109 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18110 | spec->automute_mixer_nid[0] = 0x0c; |
| 18111 | spec->automute_mixer_nid[1] = 0x0e; |
| 18112 | spec->automute = 1; |
| 18113 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18114 | spec->ext_mic.pin = 0x18; |
| 18115 | spec->ext_mic.mux_idx = 0; |
| 18116 | spec->int_mic.pin = 0x19; |
| 18117 | spec->int_mic.mux_idx = 1; |
| 18118 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18119 | } |
| 18120 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18121 | /* ***************** Mode5 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18122 | static void alc663_mode5_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18123 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18124 | struct alc_spec *spec = codec->spec; |
| 18125 | spec->autocfg.hp_pins[0] = 0x15; |
| 18126 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18127 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18128 | spec->automute_mixer_nid[0] = 0x0c; |
| 18129 | spec->automute_mixer_nid[1] = 0x0e; |
| 18130 | spec->automute = 1; |
| 18131 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18132 | spec->ext_mic.pin = 0x18; |
| 18133 | spec->ext_mic.mux_idx = 0; |
| 18134 | spec->int_mic.pin = 0x19; |
| 18135 | spec->int_mic.mux_idx = 1; |
| 18136 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18137 | } |
| 18138 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18139 | /* ***************** Mode6 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18140 | static void alc663_mode6_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18141 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18142 | struct alc_spec *spec = codec->spec; |
| 18143 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18144 | spec->autocfg.hp_pins[0] = 0x15; |
| 18145 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18146 | spec->automute_mixer_nid[0] = 0x0c; |
| 18147 | spec->automute = 1; |
| 18148 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18149 | spec->ext_mic.pin = 0x18; |
| 18150 | spec->ext_mic.mux_idx = 0; |
| 18151 | spec->int_mic.pin = 0x19; |
| 18152 | spec->int_mic.mux_idx = 1; |
| 18153 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18154 | } |
| 18155 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18156 | /* ***************** Mode7 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18157 | static void alc663_mode7_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18158 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18159 | struct alc_spec *spec = codec->spec; |
| 18160 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18161 | spec->autocfg.hp_pins[0] = 0x21; |
| 18162 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18163 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18164 | spec->automute = 1; |
| 18165 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18166 | spec->ext_mic.pin = 0x18; |
| 18167 | spec->ext_mic.mux_idx = 0; |
| 18168 | spec->int_mic.pin = 0x19; |
| 18169 | spec->int_mic.mux_idx = 1; |
| 18170 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18171 | } |
| 18172 | |
| 18173 | /* ***************** Mode8 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18174 | static void alc663_mode8_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18175 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18176 | struct alc_spec *spec = codec->spec; |
| 18177 | spec->autocfg.hp_pins[0] = 0x21; |
| 18178 | spec->autocfg.hp_pins[1] = 0x15; |
| 18179 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18180 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18181 | spec->automute = 1; |
| 18182 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18183 | spec->ext_mic.pin = 0x18; |
| 18184 | spec->ext_mic.mux_idx = 0; |
| 18185 | spec->int_mic.pin = 0x12; |
| 18186 | spec->int_mic.mux_idx = 9; |
| 18187 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18188 | } |
| 18189 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18190 | static void alc663_g71v_setup(struct hda_codec *codec) |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18191 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18192 | struct alc_spec *spec = codec->spec; |
| 18193 | spec->autocfg.hp_pins[0] = 0x21; |
| 18194 | spec->autocfg.line_out_pins[0] = 0x15; |
| 18195 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18196 | spec->automute = 1; |
| 18197 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
| 18198 | spec->detect_line = 1; |
| 18199 | spec->automute_lines = 1; |
| 18200 | spec->ext_mic.pin = 0x18; |
| 18201 | spec->ext_mic.mux_idx = 0; |
| 18202 | spec->int_mic.pin = 0x12; |
| 18203 | spec->int_mic.mux_idx = 9; |
| 18204 | spec->auto_mic = 1; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18205 | } |
| 18206 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18207 | #define alc663_g50v_setup alc663_m51va_setup |
| 18208 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18209 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18210 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18211 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18212 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18213 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18214 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18215 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18216 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18217 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18218 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18219 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18220 | { } /* end */ |
| 18221 | }; |
| 18222 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18223 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18224 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18225 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18226 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18227 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18228 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18229 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18232 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18233 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18234 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18235 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18236 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18237 | { } /* end */ |
| 18238 | }; |
| 18239 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18240 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18241 | #define alc662_loopbacks alc880_loopbacks |
| 18242 | #endif |
| 18243 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18244 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18245 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18246 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18247 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18248 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18249 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18250 | |
| 18251 | /* |
| 18252 | * configuration and preset |
| 18253 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18254 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18255 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18256 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18257 | [ALC662_3ST_6ch] = "3stack-6ch", |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 18258 | [ALC662_5ST_DIG] = "5stack-dig", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18259 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18260 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18261 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18262 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18263 | [ALC663_ASUS_M51VA] = "m51va", |
| 18264 | [ALC663_ASUS_G71V] = "g71v", |
| 18265 | [ALC663_ASUS_H13] = "h13", |
| 18266 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18267 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18268 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18269 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18270 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18271 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18272 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18273 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18274 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18275 | [ALC272_DELL] = "dell", |
| 18276 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18277 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18278 | [ALC662_AUTO] = "auto", |
| 18279 | }; |
| 18280 | |
| 18281 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18282 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18283 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18284 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18285 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18286 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18287 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18288 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18289 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18290 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18291 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18292 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18293 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18294 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18295 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18296 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18297 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18298 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18299 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18300 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18301 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18302 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18303 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18304 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18305 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18306 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18307 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18308 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18309 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18310 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18311 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18312 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18313 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18314 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18315 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18316 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18317 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18318 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18319 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18320 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18321 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18322 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18323 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18324 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18325 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18326 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18327 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18328 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18329 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18330 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18331 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18332 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18333 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18334 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18335 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18336 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18337 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18338 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18339 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18340 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18341 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18342 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18343 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18344 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18345 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18346 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18347 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18348 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18349 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18350 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18351 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18352 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18353 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18354 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18355 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18356 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18357 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18358 | {} |
| 18359 | }; |
| 18360 | |
| 18361 | static struct alc_config_preset alc662_presets[] = { |
| 18362 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18363 | .mixers = { alc662_3ST_2ch_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18364 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18365 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18366 | .dac_nids = alc662_dac_nids, |
| 18367 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18368 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18369 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18370 | .channel_mode = alc662_3ST_2ch_modes, |
| 18371 | .input_mux = &alc662_capture_source, |
| 18372 | }, |
| 18373 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18374 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18375 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18376 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18377 | .dac_nids = alc662_dac_nids, |
| 18378 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18379 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18380 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18381 | .channel_mode = alc662_3ST_6ch_modes, |
| 18382 | .need_dac_fix = 1, |
| 18383 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18384 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18385 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18386 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18387 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18388 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18389 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18390 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18391 | .channel_mode = alc662_3ST_6ch_modes, |
| 18392 | .need_dac_fix = 1, |
| 18393 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18394 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18395 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18396 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18397 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18398 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18399 | .dac_nids = alc662_dac_nids, |
| 18400 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18401 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18402 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18403 | .channel_mode = alc662_5stack_modes, |
| 18404 | .input_mux = &alc662_capture_source, |
| 18405 | }, |
| 18406 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18407 | .mixers = { alc662_lenovo_101e_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18408 | .init_verbs = { alc662_init_verbs, |
| 18409 | alc662_eapd_init_verbs, |
| 18410 | alc662_sue_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18411 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18412 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18413 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18414 | .channel_mode = alc662_3ST_2ch_modes, |
| 18415 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18416 | .unsol_event = alc_sku_unsol_event, |
| 18417 | .setup = alc662_lenovo_101e_setup, |
| 18418 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18419 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18420 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18421 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18422 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18423 | alc662_eapd_init_verbs, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18424 | alc662_eeepc_sue_init_verbs }, |
| 18425 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18426 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18427 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18428 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18429 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18430 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18431 | .init_hook = alc_inithook, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18432 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18433 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18434 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18435 | alc662_chmode_mixer }, |
| 18436 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18437 | alc662_eapd_init_verbs, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18438 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18439 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18440 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18441 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18442 | .channel_mode = alc662_3ST_6ch_modes, |
| 18443 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18444 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18445 | .setup = alc662_eeepc_ep20_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18446 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18447 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18448 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18449 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18450 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18451 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18452 | alc662_ecs_init_verbs }, |
| 18453 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18454 | .dac_nids = alc662_dac_nids, |
| 18455 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18456 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18457 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18458 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18459 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18460 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18461 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18462 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18463 | .init_verbs = { alc662_init_verbs, |
| 18464 | alc662_eapd_init_verbs, |
| 18465 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18466 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18467 | .dac_nids = alc662_dac_nids, |
| 18468 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18469 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18470 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18471 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18472 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18473 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18474 | }, |
| 18475 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18476 | .mixers = { alc663_g71v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18477 | .init_verbs = { alc662_init_verbs, |
| 18478 | alc662_eapd_init_verbs, |
| 18479 | alc663_g71v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18480 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18481 | .dac_nids = alc662_dac_nids, |
| 18482 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18483 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18484 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18485 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18486 | .setup = alc663_g71v_setup, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18487 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18488 | }, |
| 18489 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18490 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18491 | .init_verbs = { alc662_init_verbs, |
| 18492 | alc662_eapd_init_verbs, |
| 18493 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18494 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18495 | .dac_nids = alc662_dac_nids, |
| 18496 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18497 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18498 | .setup = alc663_m51va_setup, |
| 18499 | .unsol_event = alc_sku_unsol_event, |
| 18500 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18501 | }, |
| 18502 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18503 | .mixers = { alc663_g50v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18504 | .init_verbs = { alc662_init_verbs, |
| 18505 | alc662_eapd_init_verbs, |
| 18506 | alc663_g50v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18507 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18508 | .dac_nids = alc662_dac_nids, |
| 18509 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18510 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18511 | .channel_mode = alc662_3ST_6ch_modes, |
| 18512 | .input_mux = &alc663_capture_source, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18513 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18514 | .setup = alc663_g50v_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18515 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18516 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18517 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18518 | .mixers = { alc663_m51va_mixer }, |
| 18519 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18520 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18521 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18522 | alc663_21jd_amic_init_verbs }, |
| 18523 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18524 | .hp_nid = 0x03, |
| 18525 | .dac_nids = alc662_dac_nids, |
| 18526 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18527 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18528 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18529 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18530 | .setup = alc663_mode1_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18531 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18532 | }, |
| 18533 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18534 | .mixers = { alc662_1bjd_mixer }, |
| 18535 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18536 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18537 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18538 | alc662_1bjd_amic_init_verbs }, |
| 18539 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18540 | .dac_nids = alc662_dac_nids, |
| 18541 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18542 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18543 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18544 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18545 | .setup = alc662_mode2_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18546 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18547 | }, |
| 18548 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18549 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18550 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18551 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18552 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18553 | alc663_two_hp_amic_m1_init_verbs }, |
| 18554 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18555 | .hp_nid = 0x03, |
| 18556 | .dac_nids = alc662_dac_nids, |
| 18557 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18558 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18559 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18560 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18561 | .setup = alc663_mode3_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18562 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18563 | }, |
| 18564 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18565 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18566 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18567 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18568 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18569 | alc663_21jd_amic_init_verbs}, |
| 18570 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18571 | .hp_nid = 0x03, |
| 18572 | .dac_nids = alc662_dac_nids, |
| 18573 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18574 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18575 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18576 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18577 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18578 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18579 | }, |
| 18580 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18581 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18582 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18583 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18584 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18585 | alc663_15jd_amic_init_verbs }, |
| 18586 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18587 | .hp_nid = 0x03, |
| 18588 | .dac_nids = alc662_dac_nids, |
| 18589 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18590 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18591 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18592 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18593 | .setup = alc663_mode5_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18594 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18595 | }, |
| 18596 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18597 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18598 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18599 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18600 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18601 | alc663_two_hp_amic_m2_init_verbs }, |
| 18602 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18603 | .hp_nid = 0x03, |
| 18604 | .dac_nids = alc662_dac_nids, |
| 18605 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18606 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18607 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18608 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18609 | .setup = alc663_mode6_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18610 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18611 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18612 | [ALC663_ASUS_MODE7] = { |
| 18613 | .mixers = { alc663_mode7_mixer }, |
| 18614 | .cap_mixer = alc662_auto_capture_mixer, |
| 18615 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18616 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18617 | alc663_mode7_init_verbs }, |
| 18618 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18619 | .hp_nid = 0x03, |
| 18620 | .dac_nids = alc662_dac_nids, |
| 18621 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18622 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18623 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18624 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18625 | .setup = alc663_mode7_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18626 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18627 | }, |
| 18628 | [ALC663_ASUS_MODE8] = { |
| 18629 | .mixers = { alc663_mode8_mixer }, |
| 18630 | .cap_mixer = alc662_auto_capture_mixer, |
| 18631 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18632 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18633 | alc663_mode8_init_verbs }, |
| 18634 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18635 | .hp_nid = 0x03, |
| 18636 | .dac_nids = alc662_dac_nids, |
| 18637 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18638 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18639 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18640 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18641 | .setup = alc663_mode8_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18642 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18643 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18644 | [ALC272_DELL] = { |
| 18645 | .mixers = { alc663_m51va_mixer }, |
| 18646 | .cap_mixer = alc272_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18647 | .init_verbs = { alc662_init_verbs, |
| 18648 | alc662_eapd_init_verbs, |
| 18649 | alc272_dell_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18650 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18651 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18652 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18653 | .adc_nids = alc272_adc_nids, |
| 18654 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18655 | .capsrc_nids = alc272_capsrc_nids, |
| 18656 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18657 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18658 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18659 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18660 | }, |
| 18661 | [ALC272_DELL_ZM1] = { |
| 18662 | .mixers = { alc663_m51va_mixer }, |
| 18663 | .cap_mixer = alc662_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18664 | .init_verbs = { alc662_init_verbs, |
| 18665 | alc662_eapd_init_verbs, |
| 18666 | alc272_dell_zm1_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18667 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18668 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18669 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18670 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18671 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18672 | .capsrc_nids = alc662_capsrc_nids, |
| 18673 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18674 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18675 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18676 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18677 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18678 | [ALC272_SAMSUNG_NC10] = { |
| 18679 | .mixers = { alc272_nc10_mixer }, |
| 18680 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18681 | alc662_eapd_init_verbs, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18682 | alc663_21jd_amic_init_verbs }, |
| 18683 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18684 | .dac_nids = alc272_dac_nids, |
| 18685 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18686 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18687 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18688 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18689 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18690 | .init_hook = alc_inithook, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18691 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18692 | }; |
| 18693 | |
| 18694 | |
| 18695 | /* |
| 18696 | * BIOS auto configuration |
| 18697 | */ |
| 18698 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18699 | /* convert from MIX nid to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18700 | 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] | 18701 | { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18702 | hda_nid_t list[5]; |
Takashi Iwai | 1304ac8 | 2011-04-06 15:16:21 +0200 | [diff] [blame] | 18703 | int i, num; |
| 18704 | |
| 18705 | num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list)); |
| 18706 | for (i = 0; i < num; i++) { |
| 18707 | if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT) |
| 18708 | return list[i]; |
| 18709 | } |
| 18710 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18711 | } |
| 18712 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18713 | /* go down to the selector widget before the mixer */ |
| 18714 | static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin) |
| 18715 | { |
| 18716 | hda_nid_t srcs[5]; |
| 18717 | int num = snd_hda_get_connections(codec, pin, srcs, |
| 18718 | ARRAY_SIZE(srcs)); |
| 18719 | if (num != 1 || |
| 18720 | get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL) |
| 18721 | return pin; |
| 18722 | return srcs[0]; |
| 18723 | } |
| 18724 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18725 | /* get MIX nid connected to the given pin targeted to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18726 | 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] | 18727 | hda_nid_t dac) |
| 18728 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 18729 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18730 | int i, num; |
| 18731 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18732 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18733 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18734 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18735 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18736 | return mix[i]; |
| 18737 | } |
| 18738 | return 0; |
| 18739 | } |
| 18740 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18741 | /* select the connection from pin to DAC if needed */ |
| 18742 | static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin, |
| 18743 | hda_nid_t dac) |
| 18744 | { |
| 18745 | hda_nid_t mix[5]; |
| 18746 | int i, num; |
| 18747 | |
| 18748 | pin = alc_go_down_to_selector(codec, pin); |
| 18749 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18750 | if (num < 2) |
| 18751 | return 0; |
| 18752 | for (i = 0; i < num; i++) { |
| 18753 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) { |
| 18754 | snd_hda_codec_update_cache(codec, pin, 0, |
| 18755 | AC_VERB_SET_CONNECT_SEL, i); |
| 18756 | return 0; |
| 18757 | } |
| 18758 | } |
| 18759 | return 0; |
| 18760 | } |
| 18761 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18762 | /* look for an empty DAC slot */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18763 | 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] | 18764 | { |
| 18765 | struct alc_spec *spec = codec->spec; |
| 18766 | hda_nid_t srcs[5]; |
| 18767 | int i, j, num; |
| 18768 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18769 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18770 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18771 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18772 | hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18773 | if (!nid) |
| 18774 | continue; |
| 18775 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18776 | if (spec->multiout.dac_nids[j] == nid) |
| 18777 | break; |
| 18778 | if (j >= spec->multiout.num_dacs) |
| 18779 | return nid; |
| 18780 | } |
| 18781 | return 0; |
| 18782 | } |
| 18783 | |
| 18784 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18785 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18786 | const struct auto_pin_cfg *cfg) |
| 18787 | { |
| 18788 | struct alc_spec *spec = codec->spec; |
| 18789 | int i; |
| 18790 | hda_nid_t dac; |
| 18791 | |
| 18792 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18793 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18794 | dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18795 | if (!dac) |
| 18796 | continue; |
| 18797 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18798 | } |
| 18799 | return 0; |
| 18800 | } |
| 18801 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18802 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 18803 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18804 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18805 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18806 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18807 | } |
| 18808 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18809 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 18810 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18811 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18812 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18813 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18814 | } |
| 18815 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18816 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 18817 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 18818 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 18819 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18820 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18821 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18822 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18823 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18824 | |
| 18825 | /* add playback controls from the parsed DAC table */ |
| 18826 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18827 | const struct auto_pin_cfg *cfg) |
| 18828 | { |
| 18829 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18830 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18831 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18832 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18833 | const char *pfx = alc_get_line_out_pfx(spec, true); |
| 18834 | hda_nid_t nid, mix, pin; |
| 18835 | int i, err, noutputs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18836 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18837 | noutputs = cfg->line_outs; |
| 18838 | if (spec->multi_ios > 0) |
| 18839 | noutputs += spec->multi_ios; |
| 18840 | |
| 18841 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18842 | nid = spec->multiout.dac_nids[i]; |
| 18843 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18844 | continue; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18845 | if (i >= cfg->line_outs) |
| 18846 | pin = spec->multi_io[i - 1].pin; |
| 18847 | else |
| 18848 | pin = cfg->line_out_pins[i]; |
| 18849 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18850 | if (!mix) |
| 18851 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18852 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18853 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18854 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18855 | if (err < 0) |
| 18856 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18857 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18858 | if (err < 0) |
| 18859 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18860 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18861 | if (err < 0) |
| 18862 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18863 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18864 | if (err < 0) |
| 18865 | return err; |
| 18866 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18867 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18868 | int index = i; |
| 18869 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18870 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18871 | index = 0; |
| 18872 | } |
| 18873 | err = __alc662_add_vol_ctl(spec, name, nid, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18874 | if (err < 0) |
| 18875 | return err; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18876 | err = __alc662_add_sw_ctl(spec, name, mix, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18877 | if (err < 0) |
| 18878 | return err; |
| 18879 | } |
| 18880 | } |
| 18881 | return 0; |
| 18882 | } |
| 18883 | |
| 18884 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18885 | /* return DAC nid if any new DAC is assigned */ |
| 18886 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18887 | const char *pfx) |
| 18888 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18889 | struct alc_spec *spec = codec->spec; |
| 18890 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18891 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18892 | |
| 18893 | if (!pin) |
| 18894 | return 0; |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18895 | nid = alc_auto_look_for_dac(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18896 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18897 | /* the corresponding DAC is already occupied */ |
| 18898 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18899 | return 0; /* no way */ |
| 18900 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18901 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18902 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18903 | } |
| 18904 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18905 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18906 | if (!mix) |
| 18907 | return 0; |
| 18908 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18909 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18910 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18911 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18912 | if (err < 0) |
| 18913 | return err; |
| 18914 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18915 | } |
| 18916 | |
| 18917 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18918 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18919 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18920 | |
| 18921 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18922 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18923 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18924 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18925 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 18926 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18927 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18928 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18929 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18930 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18931 | if (alc_auto_mix_to_dac(codec, srcs[i]) != dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18932 | continue; |
Takashi Iwai | 0e53f34 | 2011-04-07 12:27:32 +0200 | [diff] [blame] | 18933 | /* need the manual connection? */ |
| 18934 | if (num > 1) |
| 18935 | snd_hda_codec_write(codec, nid, 0, |
| 18936 | AC_VERB_SET_CONNECT_SEL, i); |
| 18937 | /* unmute mixer widget inputs */ |
| 18938 | snd_hda_codec_write(codec, srcs[i], 0, |
| 18939 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18940 | AMP_IN_UNMUTE(0)); |
| 18941 | snd_hda_codec_write(codec, srcs[i], 0, |
| 18942 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18943 | AMP_IN_UNMUTE(1)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18944 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18945 | } |
| 18946 | } |
| 18947 | |
| 18948 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18949 | { |
| 18950 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18951 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18952 | int i; |
| 18953 | |
| 18954 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18955 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18956 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18957 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18958 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18959 | } |
| 18960 | } |
| 18961 | |
| 18962 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18963 | { |
| 18964 | struct alc_spec *spec = codec->spec; |
| 18965 | hda_nid_t pin; |
| 18966 | |
| 18967 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18968 | if (pin) |
| 18969 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18970 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18971 | pin = spec->autocfg.speaker_pins[0]; |
| 18972 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18973 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18974 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18975 | } |
| 18976 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18977 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18978 | |
| 18979 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18980 | { |
| 18981 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 18982 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18983 | int i; |
| 18984 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 18985 | for (i = 0; i < cfg->num_inputs; i++) { |
| 18986 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18987 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 18988 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18989 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18990 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18991 | snd_hda_codec_write(codec, nid, 0, |
| 18992 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18993 | AMP_OUT_MUTE); |
| 18994 | } |
| 18995 | } |
| 18996 | } |
| 18997 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18998 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18999 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19000 | /* |
| 19001 | * multi-io helper |
| 19002 | */ |
| 19003 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
| 19004 | unsigned int location) |
| 19005 | { |
| 19006 | struct alc_spec *spec = codec->spec; |
| 19007 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19008 | int type, i, num_pins = 0; |
| 19009 | |
| 19010 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
| 19011 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19012 | hda_nid_t nid = cfg->inputs[i].pin; |
| 19013 | hda_nid_t dac; |
| 19014 | unsigned int defcfg, caps; |
| 19015 | if (cfg->inputs[i].type != type) |
| 19016 | continue; |
| 19017 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 19018 | if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX) |
| 19019 | continue; |
| 19020 | if (location && get_defcfg_location(defcfg) != location) |
| 19021 | continue; |
| 19022 | caps = snd_hda_query_pin_caps(codec, nid); |
| 19023 | if (!(caps & AC_PINCAP_OUT)) |
| 19024 | continue; |
| 19025 | dac = alc_auto_look_for_dac(codec, nid); |
| 19026 | if (!dac) |
| 19027 | continue; |
| 19028 | spec->multi_io[num_pins].pin = nid; |
| 19029 | spec->multi_io[num_pins].dac = dac; |
| 19030 | num_pins++; |
| 19031 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19032 | } |
| 19033 | } |
| 19034 | spec->multiout.num_dacs = 1; |
| 19035 | if (num_pins < 2) |
| 19036 | return 0; |
| 19037 | return num_pins; |
| 19038 | } |
| 19039 | |
| 19040 | static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 19041 | struct snd_ctl_elem_info *uinfo) |
| 19042 | { |
| 19043 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19044 | struct alc_spec *spec = codec->spec; |
| 19045 | |
| 19046 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 19047 | uinfo->count = 1; |
| 19048 | uinfo->value.enumerated.items = spec->multi_ios + 1; |
| 19049 | if (uinfo->value.enumerated.item > spec->multi_ios) |
| 19050 | uinfo->value.enumerated.item = spec->multi_ios; |
| 19051 | sprintf(uinfo->value.enumerated.name, "%dch", |
| 19052 | (uinfo->value.enumerated.item + 1) * 2); |
| 19053 | return 0; |
| 19054 | } |
| 19055 | |
| 19056 | static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 19057 | struct snd_ctl_elem_value *ucontrol) |
| 19058 | { |
| 19059 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19060 | struct alc_spec *spec = codec->spec; |
| 19061 | ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2; |
| 19062 | return 0; |
| 19063 | } |
| 19064 | |
| 19065 | static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output) |
| 19066 | { |
| 19067 | struct alc_spec *spec = codec->spec; |
| 19068 | hda_nid_t nid = spec->multi_io[idx].pin; |
| 19069 | |
| 19070 | if (!spec->multi_io[idx].ctl_in) |
| 19071 | spec->multi_io[idx].ctl_in = |
| 19072 | snd_hda_codec_read(codec, nid, 0, |
| 19073 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 19074 | if (output) { |
| 19075 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19076 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19077 | PIN_OUT); |
| 19078 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19079 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19080 | HDA_AMP_MUTE, 0); |
| 19081 | alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac); |
| 19082 | } else { |
| 19083 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19084 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19085 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 19086 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19087 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19088 | spec->multi_io[idx].ctl_in); |
| 19089 | } |
| 19090 | return 0; |
| 19091 | } |
| 19092 | |
| 19093 | static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 19094 | struct snd_ctl_elem_value *ucontrol) |
| 19095 | { |
| 19096 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19097 | struct alc_spec *spec = codec->spec; |
| 19098 | int i, ch; |
| 19099 | |
| 19100 | ch = ucontrol->value.enumerated.item[0]; |
| 19101 | if (ch < 0 || ch > spec->multi_ios) |
| 19102 | return -EINVAL; |
| 19103 | if (ch == (spec->ext_channel_count - 1) / 2) |
| 19104 | return 0; |
| 19105 | spec->ext_channel_count = (ch + 1) * 2; |
| 19106 | for (i = 0; i < spec->multi_ios; i++) |
| 19107 | alc_set_multi_io(codec, i, i < ch); |
| 19108 | spec->multiout.max_channels = spec->ext_channel_count; |
| 19109 | return 1; |
| 19110 | } |
| 19111 | |
| 19112 | static struct snd_kcontrol_new alc_auto_channel_mode_enum = { |
| 19113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 19114 | .name = "Channel Mode", |
| 19115 | .info = alc_auto_ch_mode_info, |
| 19116 | .get = alc_auto_ch_mode_get, |
| 19117 | .put = alc_auto_ch_mode_put, |
| 19118 | }; |
| 19119 | |
| 19120 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec) |
| 19121 | { |
| 19122 | struct alc_spec *spec = codec->spec; |
| 19123 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19124 | unsigned int location, defcfg; |
| 19125 | int num_pins; |
| 19126 | |
| 19127 | if (cfg->line_outs != 1 || |
| 19128 | cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 19129 | return 0; |
| 19130 | |
| 19131 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
| 19132 | location = get_defcfg_location(defcfg); |
| 19133 | |
| 19134 | num_pins = alc_auto_fill_multi_ios(codec, location); |
| 19135 | if (num_pins > 0) { |
| 19136 | struct snd_kcontrol_new *knew; |
| 19137 | |
| 19138 | knew = alc_kcontrol_new(spec); |
| 19139 | if (!knew) |
| 19140 | return -ENOMEM; |
| 19141 | *knew = alc_auto_channel_mode_enum; |
| 19142 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); |
| 19143 | if (!knew->name) |
| 19144 | return -ENOMEM; |
| 19145 | |
| 19146 | spec->multi_ios = num_pins; |
| 19147 | spec->ext_channel_count = 2; |
| 19148 | spec->multiout.num_dacs = num_pins + 1; |
| 19149 | } |
| 19150 | return 0; |
| 19151 | } |
| 19152 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19153 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19154 | { |
| 19155 | struct alc_spec *spec = codec->spec; |
| 19156 | int err; |
| 19157 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19158 | |
| 19159 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19160 | alc662_ignore); |
| 19161 | if (err < 0) |
| 19162 | return err; |
| 19163 | if (!spec->autocfg.line_outs) |
| 19164 | return 0; /* can't find valid BIOS pin config */ |
| 19165 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19166 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19167 | if (err < 0) |
| 19168 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19169 | err = alc_auto_add_multi_channel_mode(codec); |
| 19170 | if (err < 0) |
| 19171 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19172 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19173 | if (err < 0) |
| 19174 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19175 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19176 | spec->autocfg.speaker_pins[0], |
| 19177 | "Speaker"); |
| 19178 | if (err < 0) |
| 19179 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19180 | if (err) |
| 19181 | spec->multiout.extra_out_nid[0] = err; |
| 19182 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19183 | "Headphone"); |
| 19184 | if (err < 0) |
| 19185 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19186 | if (err) |
| 19187 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19188 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19189 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19190 | return err; |
| 19191 | |
| 19192 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19193 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19194 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19195 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19196 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19197 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19198 | |
| 19199 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19200 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19201 | |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19202 | err = alc_auto_add_mic_boost(codec); |
| 19203 | if (err < 0) |
| 19204 | return err; |
| 19205 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19206 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19207 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19208 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19209 | else |
| 19210 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19211 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19212 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19213 | } |
| 19214 | |
| 19215 | /* additional initialization for auto-configuration model */ |
| 19216 | static void alc662_auto_init(struct hda_codec *codec) |
| 19217 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19218 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19219 | alc662_auto_init_multi_out(codec); |
| 19220 | alc662_auto_init_hp_out(codec); |
| 19221 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19222 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19223 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19224 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19225 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19226 | } |
| 19227 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19228 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19229 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19230 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19231 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19232 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19233 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19234 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19235 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19236 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19237 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19238 | printk(KERN_WARNING |
| 19239 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19240 | } |
| 19241 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19242 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19243 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19244 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19245 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19246 | ALC662_FIXUP_CZC_P10T, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19247 | ALC662_FIXUP_GIGABYTE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19248 | }; |
| 19249 | |
| 19250 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19251 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19252 | .type = ALC_FIXUP_PINS, |
| 19253 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19254 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19255 | { } |
| 19256 | } |
| 19257 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19258 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19259 | .type = ALC_FIXUP_PINS, |
| 19260 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19261 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19262 | { } |
| 19263 | } |
| 19264 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19265 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19266 | .type = ALC_FIXUP_FUNC, |
| 19267 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19268 | }, |
| 19269 | [ALC662_FIXUP_CZC_P10T] = { |
| 19270 | .type = ALC_FIXUP_VERBS, |
| 19271 | .v.verbs = (const struct hda_verb[]) { |
| 19272 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19273 | {} |
| 19274 | } |
| 19275 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19276 | [ALC662_FIXUP_GIGABYTE] = { |
| 19277 | .type = ALC_FIXUP_PINS, |
| 19278 | .v.pins = (const struct alc_pincfg[]) { |
| 19279 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 19280 | { } |
| 19281 | } |
| 19282 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19283 | }; |
| 19284 | |
| 19285 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19286 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19287 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19288 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19289 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19290 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19291 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19292 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19293 | {} |
| 19294 | }; |
| 19295 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19296 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19297 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19298 | {} |
| 19299 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19300 | |
| 19301 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19302 | static int patch_alc662(struct hda_codec *codec) |
| 19303 | { |
| 19304 | struct alc_spec *spec; |
| 19305 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19306 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19307 | |
| 19308 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19309 | if (!spec) |
| 19310 | return -ENOMEM; |
| 19311 | |
| 19312 | codec->spec = spec; |
| 19313 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19314 | alc_auto_parse_customize_define(codec); |
| 19315 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19316 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19317 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19318 | coef = alc_read_coef_idx(codec, 0); |
| 19319 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19320 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19321 | else if (coef & (1 << 14) && |
| 19322 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19323 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19324 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19325 | else if (coef == 0x4011) |
| 19326 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19327 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19328 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19329 | alc662_models, |
| 19330 | alc662_cfg_tbl); |
| 19331 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19332 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19333 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19334 | board_config = ALC662_AUTO; |
| 19335 | } |
| 19336 | |
| 19337 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19338 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19339 | alc662_fixup_tbl, alc662_fixups); |
| 19340 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19341 | /* automatic parse from the BIOS config */ |
| 19342 | err = alc662_parse_auto_config(codec); |
| 19343 | if (err < 0) { |
| 19344 | alc_free(codec); |
| 19345 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19346 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19347 | printk(KERN_INFO |
| 19348 | "hda_codec: Cannot set up configuration " |
| 19349 | "from BIOS. Using base mode...\n"); |
| 19350 | board_config = ALC662_3ST_2ch_DIG; |
| 19351 | } |
| 19352 | } |
| 19353 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19354 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19355 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19356 | if (err < 0) { |
| 19357 | alc_free(codec); |
| 19358 | return err; |
| 19359 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19360 | } |
| 19361 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19362 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19363 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19364 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19365 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19366 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19367 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19368 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19369 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19370 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19371 | if (!spec->adc_nids) { |
| 19372 | spec->adc_nids = alc662_adc_nids; |
| 19373 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19374 | } |
| 19375 | if (!spec->capsrc_nids) |
| 19376 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19377 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19378 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19379 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19380 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19381 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19382 | switch (codec->vendor_id) { |
| 19383 | case 0x10ec0662: |
| 19384 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19385 | break; |
| 19386 | case 0x10ec0272: |
| 19387 | case 0x10ec0663: |
| 19388 | case 0x10ec0665: |
| 19389 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19390 | break; |
| 19391 | case 0x10ec0273: |
| 19392 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19393 | break; |
| 19394 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19395 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19396 | spec->vmaster_nid = 0x02; |
| 19397 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19398 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19399 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19400 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19401 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19402 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 19403 | spec->shutup = alc_eapd_shutup; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19404 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19405 | alc_init_jacks(codec); |
| 19406 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19407 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19408 | if (!spec->loopback.amplist) |
| 19409 | spec->loopback.amplist = alc662_loopbacks; |
| 19410 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19411 | |
| 19412 | return 0; |
| 19413 | } |
| 19414 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19415 | static int patch_alc888(struct hda_codec *codec) |
| 19416 | { |
| 19417 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19418 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19419 | if (codec->vendor_id == 0x10ec0887) |
| 19420 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19421 | else |
| 19422 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19423 | if (!codec->chip_name) { |
| 19424 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19425 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19426 | } |
| 19427 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19428 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19429 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19430 | } |
| 19431 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19432 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19433 | * ALC680 support |
| 19434 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19435 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19436 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19437 | #define alc680_modes alc260_modes |
| 19438 | |
| 19439 | static hda_nid_t alc680_dac_nids[3] = { |
| 19440 | /* Lout1, Lout2, hp */ |
| 19441 | 0x02, 0x03, 0x04 |
| 19442 | }; |
| 19443 | |
| 19444 | static hda_nid_t alc680_adc_nids[3] = { |
| 19445 | /* ADC0-2 */ |
| 19446 | /* DMIC, MIC, Line-in*/ |
| 19447 | 0x07, 0x08, 0x09 |
| 19448 | }; |
| 19449 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19450 | /* |
| 19451 | * Analog capture ADC cgange |
| 19452 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19453 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19454 | { |
| 19455 | struct alc_spec *spec = codec->spec; |
| 19456 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19457 | int pin_found = 0; |
| 19458 | int type_found = AUTO_PIN_LAST; |
| 19459 | hda_nid_t nid; |
| 19460 | int i; |
| 19461 | |
| 19462 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19463 | nid = cfg->inputs[i].pin; |
| 19464 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19465 | AC_PINCAP_PRES_DETECT)) |
| 19466 | continue; |
| 19467 | if (snd_hda_jack_detect(codec, nid)) { |
| 19468 | if (cfg->inputs[i].type < type_found) { |
| 19469 | type_found = cfg->inputs[i].type; |
| 19470 | pin_found = nid; |
| 19471 | } |
| 19472 | } |
| 19473 | } |
| 19474 | |
| 19475 | nid = 0x07; |
| 19476 | if (pin_found) |
| 19477 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19478 | |
| 19479 | if (nid != spec->cur_adc) |
| 19480 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19481 | spec->cur_adc = nid; |
| 19482 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19483 | spec->cur_adc_format); |
| 19484 | } |
| 19485 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19486 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19487 | struct hda_codec *codec, |
| 19488 | unsigned int stream_tag, |
| 19489 | unsigned int format, |
| 19490 | struct snd_pcm_substream *substream) |
| 19491 | { |
| 19492 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19493 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19494 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19495 | spec->cur_adc_stream_tag = stream_tag; |
| 19496 | spec->cur_adc_format = format; |
| 19497 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19498 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19499 | return 0; |
| 19500 | } |
| 19501 | |
| 19502 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19503 | struct hda_codec *codec, |
| 19504 | struct snd_pcm_substream *substream) |
| 19505 | { |
| 19506 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19507 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19508 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19509 | return 0; |
| 19510 | } |
| 19511 | |
| 19512 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19513 | .substreams = 1, /* can be overridden */ |
| 19514 | .channels_min = 2, |
| 19515 | .channels_max = 2, |
| 19516 | /* NID is set in alc_build_pcms */ |
| 19517 | .ops = { |
| 19518 | .prepare = alc680_capture_pcm_prepare, |
| 19519 | .cleanup = alc680_capture_pcm_cleanup |
| 19520 | }, |
| 19521 | }; |
| 19522 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19523 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19524 | /* output mixer control */ |
| 19525 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19526 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19527 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19529 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19530 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19531 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19532 | { } |
| 19533 | }; |
| 19534 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19535 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19536 | .ops = &snd_hda_bind_vol, |
| 19537 | .values = { |
| 19538 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19539 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19540 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19541 | 0 |
| 19542 | }, |
| 19543 | }; |
| 19544 | |
| 19545 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19546 | .ops = &snd_hda_bind_sw, |
| 19547 | .values = { |
| 19548 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19549 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19550 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19551 | 0 |
| 19552 | }, |
| 19553 | }; |
| 19554 | |
| 19555 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19556 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19557 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19558 | { } /* end */ |
| 19559 | }; |
| 19560 | |
| 19561 | /* |
| 19562 | * generic initialization of ADC, input mixers and output mixers |
| 19563 | */ |
| 19564 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19565 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19566 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19567 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19568 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19569 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19570 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19571 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19572 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19573 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19574 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19575 | |
| 19576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19577 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19579 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19580 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19581 | |
| 19582 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19583 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19584 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19585 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19586 | { } |
| 19587 | }; |
| 19588 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19589 | /* toggle speaker-output according to the hp-jack state */ |
| 19590 | static void alc680_base_setup(struct hda_codec *codec) |
| 19591 | { |
| 19592 | struct alc_spec *spec = codec->spec; |
| 19593 | |
| 19594 | spec->autocfg.hp_pins[0] = 0x16; |
| 19595 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19596 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19597 | spec->autocfg.num_inputs = 2; |
| 19598 | spec->autocfg.inputs[0].pin = 0x18; |
| 19599 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19600 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19601 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19602 | spec->automute = 1; |
| 19603 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19604 | } |
| 19605 | |
| 19606 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19607 | unsigned int res) |
| 19608 | { |
| 19609 | if ((res >> 26) == ALC880_HP_EVENT) |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19610 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19611 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19612 | alc680_rec_autoswitch(codec); |
| 19613 | } |
| 19614 | |
| 19615 | static void alc680_inithook(struct hda_codec *codec) |
| 19616 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19617 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19618 | alc680_rec_autoswitch(codec); |
| 19619 | } |
| 19620 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19621 | /* create input playback/capture controls for the given pin */ |
| 19622 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19623 | const char *ctlname, int idx) |
| 19624 | { |
| 19625 | hda_nid_t dac; |
| 19626 | int err; |
| 19627 | |
| 19628 | switch (nid) { |
| 19629 | case 0x14: |
| 19630 | dac = 0x02; |
| 19631 | break; |
| 19632 | case 0x15: |
| 19633 | dac = 0x03; |
| 19634 | break; |
| 19635 | case 0x16: |
| 19636 | dac = 0x04; |
| 19637 | break; |
| 19638 | default: |
| 19639 | return 0; |
| 19640 | } |
| 19641 | if (spec->multiout.dac_nids[0] != dac && |
| 19642 | spec->multiout.dac_nids[1] != dac) { |
| 19643 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19644 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19645 | HDA_OUTPUT)); |
| 19646 | if (err < 0) |
| 19647 | return err; |
| 19648 | |
| 19649 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19650 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19651 | |
| 19652 | if (err < 0) |
| 19653 | return err; |
| 19654 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19655 | } |
| 19656 | |
| 19657 | return 0; |
| 19658 | } |
| 19659 | |
| 19660 | /* add playback controls from the parsed DAC table */ |
| 19661 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19662 | const struct auto_pin_cfg *cfg) |
| 19663 | { |
| 19664 | hda_nid_t nid; |
| 19665 | int err; |
| 19666 | |
| 19667 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19668 | |
| 19669 | nid = cfg->line_out_pins[0]; |
| 19670 | if (nid) { |
| 19671 | const char *name; |
| 19672 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19673 | name = "Speaker"; |
| 19674 | else |
| 19675 | name = "Front"; |
| 19676 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19677 | if (err < 0) |
| 19678 | return err; |
| 19679 | } |
| 19680 | |
| 19681 | nid = cfg->speaker_pins[0]; |
| 19682 | if (nid) { |
| 19683 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19684 | if (err < 0) |
| 19685 | return err; |
| 19686 | } |
| 19687 | nid = cfg->hp_pins[0]; |
| 19688 | if (nid) { |
| 19689 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19690 | if (err < 0) |
| 19691 | return err; |
| 19692 | } |
| 19693 | |
| 19694 | return 0; |
| 19695 | } |
| 19696 | |
| 19697 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19698 | hda_nid_t nid, int pin_type) |
| 19699 | { |
| 19700 | alc_set_pin_output(codec, nid, pin_type); |
| 19701 | } |
| 19702 | |
| 19703 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19704 | { |
| 19705 | struct alc_spec *spec = codec->spec; |
| 19706 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19707 | if (nid) { |
| 19708 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19709 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19710 | } |
| 19711 | } |
| 19712 | |
| 19713 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19714 | { |
| 19715 | struct alc_spec *spec = codec->spec; |
| 19716 | hda_nid_t pin; |
| 19717 | |
| 19718 | pin = spec->autocfg.hp_pins[0]; |
| 19719 | if (pin) |
| 19720 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19721 | pin = spec->autocfg.speaker_pins[0]; |
| 19722 | if (pin) |
| 19723 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19724 | } |
| 19725 | |
| 19726 | /* pcm configuration: identical with ALC880 */ |
| 19727 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19728 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19729 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19730 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19731 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19732 | |
| 19733 | /* |
| 19734 | * BIOS auto configuration |
| 19735 | */ |
| 19736 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19737 | { |
| 19738 | struct alc_spec *spec = codec->spec; |
| 19739 | int err; |
| 19740 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19741 | |
| 19742 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19743 | alc680_ignore); |
| 19744 | if (err < 0) |
| 19745 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19746 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19747 | if (!spec->autocfg.line_outs) { |
| 19748 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19749 | spec->multiout.max_channels = 2; |
| 19750 | spec->no_analog = 1; |
| 19751 | goto dig_only; |
| 19752 | } |
| 19753 | return 0; /* can't find valid BIOS pin config */ |
| 19754 | } |
| 19755 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19756 | if (err < 0) |
| 19757 | return err; |
| 19758 | |
| 19759 | spec->multiout.max_channels = 2; |
| 19760 | |
| 19761 | dig_only: |
| 19762 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19763 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19764 | if (spec->kctls.list) |
| 19765 | add_mixer(spec, spec->kctls.list); |
| 19766 | |
| 19767 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19768 | |
| 19769 | err = alc_auto_add_mic_boost(codec); |
| 19770 | if (err < 0) |
| 19771 | return err; |
| 19772 | |
| 19773 | return 1; |
| 19774 | } |
| 19775 | |
| 19776 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19777 | |
| 19778 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19779 | static void alc680_auto_init(struct hda_codec *codec) |
| 19780 | { |
| 19781 | struct alc_spec *spec = codec->spec; |
| 19782 | alc680_auto_init_multi_out(codec); |
| 19783 | alc680_auto_init_hp_out(codec); |
| 19784 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19785 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19786 | if (spec->unsol_event) |
| 19787 | alc_inithook(codec); |
| 19788 | } |
| 19789 | |
| 19790 | /* |
| 19791 | * configuration and preset |
| 19792 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19793 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19794 | [ALC680_BASE] = "base", |
| 19795 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19796 | }; |
| 19797 | |
| 19798 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19799 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19800 | {} |
| 19801 | }; |
| 19802 | |
| 19803 | static struct alc_config_preset alc680_presets[] = { |
| 19804 | [ALC680_BASE] = { |
| 19805 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19806 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19807 | .init_verbs = { alc680_init_verbs }, |
| 19808 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19809 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19810 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19811 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19812 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19813 | .unsol_event = alc680_unsol_event, |
| 19814 | .setup = alc680_base_setup, |
| 19815 | .init_hook = alc680_inithook, |
| 19816 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19817 | }, |
| 19818 | }; |
| 19819 | |
| 19820 | static int patch_alc680(struct hda_codec *codec) |
| 19821 | { |
| 19822 | struct alc_spec *spec; |
| 19823 | int board_config; |
| 19824 | int err; |
| 19825 | |
| 19826 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19827 | if (spec == NULL) |
| 19828 | return -ENOMEM; |
| 19829 | |
| 19830 | codec->spec = spec; |
| 19831 | |
| 19832 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19833 | alc680_models, |
| 19834 | alc680_cfg_tbl); |
| 19835 | |
| 19836 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19837 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19838 | codec->chip_name); |
| 19839 | board_config = ALC680_AUTO; |
| 19840 | } |
| 19841 | |
| 19842 | if (board_config == ALC680_AUTO) { |
| 19843 | /* automatic parse from the BIOS config */ |
| 19844 | err = alc680_parse_auto_config(codec); |
| 19845 | if (err < 0) { |
| 19846 | alc_free(codec); |
| 19847 | return err; |
| 19848 | } else if (!err) { |
| 19849 | printk(KERN_INFO |
| 19850 | "hda_codec: Cannot set up configuration " |
| 19851 | "from BIOS. Using base mode...\n"); |
| 19852 | board_config = ALC680_BASE; |
| 19853 | } |
| 19854 | } |
| 19855 | |
| 19856 | if (board_config != ALC680_AUTO) |
| 19857 | setup_preset(codec, &alc680_presets[board_config]); |
| 19858 | |
| 19859 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19860 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19861 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19862 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19863 | |
| 19864 | if (!spec->adc_nids) { |
| 19865 | spec->adc_nids = alc680_adc_nids; |
| 19866 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19867 | } |
| 19868 | |
| 19869 | if (!spec->cap_mixer) |
| 19870 | set_capture_mixer(codec); |
| 19871 | |
| 19872 | spec->vmaster_nid = 0x02; |
| 19873 | |
| 19874 | codec->patch_ops = alc_patch_ops; |
| 19875 | if (board_config == ALC680_AUTO) |
| 19876 | spec->init_hook = alc680_auto_init; |
| 19877 | |
| 19878 | return 0; |
| 19879 | } |
| 19880 | |
| 19881 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19882 | * patch entries |
| 19883 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19884 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19885 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19886 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19887 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19888 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19889 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19890 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19891 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19892 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19893 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19894 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19895 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19896 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19897 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19898 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19899 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19900 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19901 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19902 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19903 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19904 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19905 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19906 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19907 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19908 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19909 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19910 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19911 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19912 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19913 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19914 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19915 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19916 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19917 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19918 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19919 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19920 | {} /* terminator */ |
| 19921 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19922 | |
| 19923 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19924 | |
| 19925 | MODULE_LICENSE("GPL"); |
| 19926 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19927 | |
| 19928 | static struct hda_codec_preset_list realtek_list = { |
| 19929 | .preset = snd_hda_preset_realtek, |
| 19930 | .owner = THIS_MODULE, |
| 19931 | }; |
| 19932 | |
| 19933 | static int __init patch_realtek_init(void) |
| 19934 | { |
| 19935 | return snd_hda_add_codec_preset(&realtek_list); |
| 19936 | } |
| 19937 | |
| 19938 | static void __exit patch_realtek_exit(void) |
| 19939 | { |
| 19940 | snd_hda_delete_codec_preset(&realtek_list); |
| 19941 | } |
| 19942 | |
| 19943 | module_init(patch_realtek_init) |
| 19944 | module_exit(patch_realtek_exit) |