Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 297 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 298 | }; |
| 299 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 300 | struct alc_fixup; |
| 301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | struct alc_spec { |
| 303 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 304 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 306 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 307 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 309 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 310 | * don't forget NULL |
| 311 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 312 | */ |
| 313 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 315 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | struct hda_pcm_stream *stream_analog_playback; |
| 317 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 318 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 319 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 321 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | struct hda_pcm_stream *stream_digital_playback; |
| 323 | struct hda_pcm_stream *stream_digital_capture; |
| 324 | |
| 325 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 326 | struct hda_multi_out multiout; /* playback set-up |
| 327 | * max_channels, dacs must be set |
| 328 | * dig_out_nid and hp_nid are optional |
| 329 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 330 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 331 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 332 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | |
| 334 | /* capture */ |
| 335 | unsigned int num_adc_nids; |
| 336 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 337 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 338 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 340 | /* capture setup for dynamic dual-adc switch */ |
| 341 | unsigned int cur_adc_idx; |
| 342 | hda_nid_t cur_adc; |
| 343 | unsigned int cur_adc_stream_tag; |
| 344 | unsigned int cur_adc_format; |
| 345 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 347 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | const struct hda_input_mux *input_mux; |
| 349 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 350 | struct alc_mic_route ext_mic; |
| 351 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
| 353 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 354 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 356 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 357 | int const_channel_count; |
| 358 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | |
| 360 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 361 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 362 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 363 | /* dynamic controls, init_verbs and input_mux */ |
| 364 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 365 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 366 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 367 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 368 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 369 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 370 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 371 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 372 | /* hooks */ |
| 373 | void (*init_hook)(struct hda_codec *codec); |
| 374 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 376 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 377 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 378 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 379 | /* for pin sensing */ |
| 380 | unsigned int sense_updated: 1; |
| 381 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 382 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 383 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 384 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 385 | /* other flags */ |
| 386 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 387 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 388 | unsigned int single_input_src:1; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 389 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 390 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 391 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 392 | /* for virtual master */ |
| 393 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 394 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 395 | struct hda_loopback_check loopback; |
| 396 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 397 | |
| 398 | /* for PLL fix */ |
| 399 | hda_nid_t pll_nid; |
| 400 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 401 | |
| 402 | /* fix-up list */ |
| 403 | int fixup_id; |
| 404 | const struct alc_fixup *fixup_list; |
| 405 | const char *fixup_name; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 406 | }; |
| 407 | |
| 408 | /* |
| 409 | * configuration template - to be copied to the spec instance |
| 410 | */ |
| 411 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 412 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 413 | * with spec |
| 414 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 415 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 416 | const struct hda_verb *init_verbs[5]; |
| 417 | unsigned int num_dacs; |
| 418 | hda_nid_t *dac_nids; |
| 419 | hda_nid_t dig_out_nid; /* optional */ |
| 420 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 421 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 422 | unsigned int num_adc_nids; |
| 423 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 424 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 425 | hda_nid_t dig_in_nid; |
| 426 | unsigned int num_channel_mode; |
| 427 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 428 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 429 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 430 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 431 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 432 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 433 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 434 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 435 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 436 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 437 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 438 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | |
| 442 | /* |
| 443 | * input MUX handling |
| 444 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 445 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 446 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | { |
| 448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 449 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 450 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 451 | if (mux_idx >= spec->num_mux_defs) |
| 452 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 453 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 454 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 455 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
| 463 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 464 | |
| 465 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 466 | return 0; |
| 467 | } |
| 468 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 469 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 470 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | { |
| 472 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 473 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 474 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 476 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 477 | hda_nid_t nid = spec->capsrc_nids ? |
| 478 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 479 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 481 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 482 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 483 | if (!imux->num_items && mux_idx > 0) |
| 484 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 485 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 486 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 487 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 488 | /* Matrix-mixer style (e.g. ALC882) */ |
| 489 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 490 | unsigned int i, idx; |
| 491 | |
| 492 | idx = ucontrol->value.enumerated.item[0]; |
| 493 | if (idx >= imux->num_items) |
| 494 | idx = imux->num_items - 1; |
| 495 | if (*cur_val == idx) |
| 496 | return 0; |
| 497 | for (i = 0; i < imux->num_items; i++) { |
| 498 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 499 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 500 | imux->items[i].index, |
| 501 | HDA_AMP_MUTE, v); |
| 502 | } |
| 503 | *cur_val = idx; |
| 504 | return 1; |
| 505 | } else { |
| 506 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 507 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 508 | &spec->cur_mux[adc_idx]); |
| 509 | } |
| 510 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 511 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | /* |
| 513 | * channel mode setting |
| 514 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 515 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 516 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | { |
| 518 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 519 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 520 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 521 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | } |
| 523 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 524 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | { |
| 527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 528 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 529 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 531 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | } |
| 533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 535 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | { |
| 537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 538 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 539 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 540 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 541 | &spec->ext_channel_count); |
| 542 | if (err >= 0 && !spec->const_channel_count) { |
| 543 | spec->multiout.max_channels = spec->ext_channel_count; |
| 544 | if (spec->need_dac_fix) |
| 545 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 546 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 547 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | } |
| 549 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | * 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] | 552 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | * being part of a format specifier. Maximum allowed length of a value is |
| 554 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 555 | * |
| 556 | * Note: some retasking pin complexes seem to ignore requests for input |
| 557 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 558 | * are requested. Therefore order this list so that this behaviour will not |
| 559 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 560 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 561 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 564 | "Mic 50pc bias", "Mic 80pc bias", |
| 565 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | }; |
| 567 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 568 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 569 | }; |
| 570 | /* 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] | 571 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 572 | * addition, "input" pins may or may not process the mic bias option |
| 573 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 574 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 575 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 577 | #define ALC_PIN_DIR_IN 0x00 |
| 578 | #define ALC_PIN_DIR_OUT 0x01 |
| 579 | #define ALC_PIN_DIR_INOUT 0x02 |
| 580 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 581 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 583 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 584 | * For each direction the minimum and maximum values are given. |
| 585 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 586 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 587 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 588 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 589 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 590 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 591 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | }; |
| 593 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 594 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 595 | #define alc_pin_mode_n_items(_dir) \ |
| 596 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 597 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 598 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 599 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | unsigned int item_num = uinfo->value.enumerated.item; |
| 602 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 603 | |
| 604 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 605 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 606 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 607 | |
| 608 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 609 | item_num = alc_pin_mode_min(dir); |
| 610 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 611 | return 0; |
| 612 | } |
| 613 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 614 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 615 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 616 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 617 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 618 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 619 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 620 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 621 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 623 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 624 | 0x00); |
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 | /* Find enumerated value for current pinctl setting */ |
| 627 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 628 | 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] | 629 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 630 | *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] | 631 | return 0; |
| 632 | } |
| 633 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 634 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 635 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 636 | { |
| 637 | signed int change; |
| 638 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 639 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 640 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 641 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 643 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 644 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 645 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 646 | 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] | 647 | val = alc_pin_mode_min(dir); |
| 648 | |
| 649 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 650 | if (change) { |
| 651 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 652 | snd_hda_codec_write_cache(codec, nid, 0, |
| 653 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 654 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 655 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 656 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 657 | * for the requested pin mode. Enum values of 2 or less are |
| 658 | * input modes. |
| 659 | * |
| 660 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 661 | * reduces noise slightly (particularly on input) so we'll |
| 662 | * do it. However, having both input and output buffers |
| 663 | * enabled simultaneously doesn't seem to be problematic if |
| 664 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 665 | */ |
| 666 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 667 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 668 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 669 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 670 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 671 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 672 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 673 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 674 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 675 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 676 | } |
| 677 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 678 | return change; |
| 679 | } |
| 680 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 681 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 682 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 683 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 684 | .info = alc_pin_mode_info, \ |
| 685 | .get = alc_pin_mode_get, \ |
| 686 | .put = alc_pin_mode_put, \ |
| 687 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 688 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 689 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 690 | * together using a mask with more than one bit set. This control is |
| 691 | * currently used only by the ALC260 test model. At this stage they are not |
| 692 | * needed for any "production" models. |
| 693 | */ |
| 694 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 695 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 696 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 697 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 698 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 699 | { |
| 700 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 701 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 702 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 703 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 704 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 705 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 706 | |
| 707 | *valp = (val & mask) != 0; |
| 708 | return 0; |
| 709 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 710 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 711 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 712 | { |
| 713 | signed int change; |
| 714 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 715 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 716 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 717 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 718 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 719 | AC_VERB_GET_GPIO_DATA, |
| 720 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 721 | |
| 722 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 723 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 724 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 725 | gpio_data &= ~mask; |
| 726 | else |
| 727 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 728 | snd_hda_codec_write_cache(codec, nid, 0, |
| 729 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 730 | |
| 731 | return change; |
| 732 | } |
| 733 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 734 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 735 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 736 | .info = alc_gpio_data_info, \ |
| 737 | .get = alc_gpio_data_get, \ |
| 738 | .put = alc_gpio_data_put, \ |
| 739 | .private_value = nid | (mask<<16) } |
| 740 | #endif /* CONFIG_SND_DEBUG */ |
| 741 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 742 | /* A switch control to allow the enabling of the digital IO pins on the |
| 743 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 744 | * to provide something in the test model allowing digital outputs to be |
| 745 | * identified if present. If models are found which can utilise these |
| 746 | * outputs a more complete mixer control can be devised for those models if |
| 747 | * necessary. |
| 748 | */ |
| 749 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 750 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 751 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 752 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 753 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 754 | { |
| 755 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 756 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 757 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 758 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 759 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 760 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 761 | |
| 762 | *valp = (val & mask) != 0; |
| 763 | return 0; |
| 764 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 765 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 766 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 767 | { |
| 768 | signed int change; |
| 769 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 770 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 771 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 772 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 773 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 774 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 775 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 776 | |
| 777 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 778 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 779 | if (val==0) |
| 780 | ctrl_data &= ~mask; |
| 781 | else |
| 782 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 783 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 784 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 785 | |
| 786 | return change; |
| 787 | } |
| 788 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 789 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 790 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 791 | .info = alc_spdif_ctrl_info, \ |
| 792 | .get = alc_spdif_ctrl_get, \ |
| 793 | .put = alc_spdif_ctrl_put, \ |
| 794 | .private_value = nid | (mask<<16) } |
| 795 | #endif /* CONFIG_SND_DEBUG */ |
| 796 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 797 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 798 | * Again, this is only used in the ALC26x test models to help identify when |
| 799 | * the EAPD line must be asserted for features to work. |
| 800 | */ |
| 801 | #ifdef CONFIG_SND_DEBUG |
| 802 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 803 | |
| 804 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 805 | struct snd_ctl_elem_value *ucontrol) |
| 806 | { |
| 807 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 808 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 809 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 810 | long *valp = ucontrol->value.integer.value; |
| 811 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 812 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 813 | |
| 814 | *valp = (val & mask) != 0; |
| 815 | return 0; |
| 816 | } |
| 817 | |
| 818 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 819 | struct snd_ctl_elem_value *ucontrol) |
| 820 | { |
| 821 | int change; |
| 822 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 823 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 824 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 825 | long val = *ucontrol->value.integer.value; |
| 826 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 827 | AC_VERB_GET_EAPD_BTLENABLE, |
| 828 | 0x00); |
| 829 | |
| 830 | /* Set/unset the masked control bit(s) as needed */ |
| 831 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 832 | if (!val) |
| 833 | ctrl_data &= ~mask; |
| 834 | else |
| 835 | ctrl_data |= mask; |
| 836 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 837 | ctrl_data); |
| 838 | |
| 839 | return change; |
| 840 | } |
| 841 | |
| 842 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 843 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 844 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 845 | .info = alc_eapd_ctrl_info, \ |
| 846 | .get = alc_eapd_ctrl_get, \ |
| 847 | .put = alc_eapd_ctrl_put, \ |
| 848 | .private_value = nid | (mask<<16) } |
| 849 | #endif /* CONFIG_SND_DEBUG */ |
| 850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 851 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 852 | * set up the input pin config (depending on the given auto-pin type) |
| 853 | */ |
| 854 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 855 | int auto_pin_type) |
| 856 | { |
| 857 | unsigned int val = PIN_IN; |
| 858 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 859 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 860 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 861 | unsigned int oldval; |
| 862 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 863 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 864 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 865 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 866 | /* if the default pin setup is vref50, we give it priority */ |
| 867 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 868 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 869 | else if (pincap & AC_PINCAP_VREF_50) |
| 870 | val = PIN_VREF50; |
| 871 | else if (pincap & AC_PINCAP_VREF_100) |
| 872 | val = PIN_VREF100; |
| 873 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 874 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 875 | } |
| 876 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 877 | } |
| 878 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 879 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 880 | { |
| 881 | struct alc_spec *spec = codec->spec; |
| 882 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 883 | |
| 884 | if (!cfg->line_outs) { |
| 885 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 886 | cfg->line_out_pins[cfg->line_outs]) |
| 887 | cfg->line_outs++; |
| 888 | } |
| 889 | if (!cfg->speaker_outs) { |
| 890 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 891 | cfg->speaker_pins[cfg->speaker_outs]) |
| 892 | cfg->speaker_outs++; |
| 893 | } |
| 894 | if (!cfg->hp_outs) { |
| 895 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 896 | cfg->hp_pins[cfg->hp_outs]) |
| 897 | cfg->hp_outs++; |
| 898 | } |
| 899 | } |
| 900 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 901 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 902 | */ |
| 903 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 904 | { |
| 905 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 906 | return; |
| 907 | spec->mixers[spec->num_mixers++] = mix; |
| 908 | } |
| 909 | |
| 910 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 911 | { |
| 912 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 913 | return; |
| 914 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 915 | } |
| 916 | |
| 917 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 918 | * set up from the preset table |
| 919 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 920 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 921 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 922 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 923 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 924 | int i; |
| 925 | |
| 926 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 927 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 928 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 929 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 930 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 931 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 932 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 933 | spec->channel_mode = preset->channel_mode; |
| 934 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 935 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 936 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 937 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 938 | if (preset->const_channel_count) |
| 939 | spec->multiout.max_channels = preset->const_channel_count; |
| 940 | else |
| 941 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 942 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 943 | |
| 944 | spec->multiout.num_dacs = preset->num_dacs; |
| 945 | spec->multiout.dac_nids = preset->dac_nids; |
| 946 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 947 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 948 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 949 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 950 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 951 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 952 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 953 | spec->input_mux = preset->input_mux; |
| 954 | |
| 955 | spec->num_adc_nids = preset->num_adc_nids; |
| 956 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 957 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 958 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 959 | |
| 960 | spec->unsol_event = preset->unsol_event; |
| 961 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 962 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 963 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 964 | spec->loopback.amplist = preset->loopbacks; |
| 965 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 966 | |
| 967 | if (preset->setup) |
| 968 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 969 | |
| 970 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 971 | } |
| 972 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 973 | /* Enable GPIO mask and set output */ |
| 974 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 975 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 976 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 977 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 978 | { } |
| 979 | }; |
| 980 | |
| 981 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 982 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 983 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 984 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 985 | { } |
| 986 | }; |
| 987 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 988 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 989 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 990 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 991 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 992 | { } |
| 993 | }; |
| 994 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 995 | /* |
| 996 | * Fix hardware PLL issue |
| 997 | * On some codecs, the analog PLL gating control must be off while |
| 998 | * the default value is 1. |
| 999 | */ |
| 1000 | static void alc_fix_pll(struct hda_codec *codec) |
| 1001 | { |
| 1002 | struct alc_spec *spec = codec->spec; |
| 1003 | unsigned int val; |
| 1004 | |
| 1005 | if (!spec->pll_nid) |
| 1006 | return; |
| 1007 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1008 | spec->pll_coef_idx); |
| 1009 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1010 | AC_VERB_GET_PROC_COEF, 0); |
| 1011 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1012 | spec->pll_coef_idx); |
| 1013 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1014 | val & ~(1 << spec->pll_coef_bit)); |
| 1015 | } |
| 1016 | |
| 1017 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1018 | unsigned int coef_idx, unsigned int coef_bit) |
| 1019 | { |
| 1020 | struct alc_spec *spec = codec->spec; |
| 1021 | spec->pll_nid = nid; |
| 1022 | spec->pll_coef_idx = coef_idx; |
| 1023 | spec->pll_coef_bit = coef_bit; |
| 1024 | alc_fix_pll(codec); |
| 1025 | } |
| 1026 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1027 | static int alc_init_jacks(struct hda_codec *codec) |
| 1028 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1029 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1030 | struct alc_spec *spec = codec->spec; |
| 1031 | int err; |
| 1032 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1033 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1034 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1035 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1036 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1037 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1038 | if (err < 0) |
| 1039 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1040 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1041 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1042 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1043 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1044 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1045 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1046 | if (err < 0) |
| 1047 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1048 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1049 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1050 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1051 | return 0; |
| 1052 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1053 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1054 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1055 | { |
| 1056 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1057 | unsigned int mute; |
| 1058 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1059 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1060 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1061 | spec->jack_present = 0; |
| 1062 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1063 | nid = spec->autocfg.hp_pins[i]; |
| 1064 | if (!nid) |
| 1065 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1066 | snd_hda_input_jack_report(codec, nid); |
David Henningsson | f0ce279 | 2011-02-28 15:58:07 +0100 | [diff] [blame] | 1067 | spec->jack_present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1068 | } |
| 1069 | |
| 1070 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1071 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1072 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1073 | nid = spec->autocfg.speaker_pins[i]; |
| 1074 | if (!nid) |
| 1075 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1076 | if (pinctl) { |
| 1077 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1078 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1079 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1080 | } else { |
| 1081 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1082 | HDA_AMP_MUTE, mute); |
| 1083 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1084 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1085 | } |
| 1086 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1087 | static void alc_automute_pin(struct hda_codec *codec) |
| 1088 | { |
| 1089 | alc_automute_speaker(codec, 1); |
| 1090 | } |
| 1091 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1092 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1093 | hda_nid_t nid) |
| 1094 | { |
| 1095 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1096 | int i, nums; |
| 1097 | |
| 1098 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1099 | for (i = 0; i < nums; i++) |
| 1100 | if (conn[i] == nid) |
| 1101 | return i; |
| 1102 | return -1; |
| 1103 | } |
| 1104 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1105 | /* switch the current ADC according to the jack state */ |
| 1106 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1107 | { |
| 1108 | struct alc_spec *spec = codec->spec; |
| 1109 | unsigned int present; |
| 1110 | hda_nid_t new_adc; |
| 1111 | |
| 1112 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1113 | if (present) |
| 1114 | spec->cur_adc_idx = 1; |
| 1115 | else |
| 1116 | spec->cur_adc_idx = 0; |
| 1117 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1118 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1119 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1120 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1121 | spec->cur_adc = new_adc; |
| 1122 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1123 | spec->cur_adc_stream_tag, 0, |
| 1124 | spec->cur_adc_format); |
| 1125 | } |
| 1126 | } |
| 1127 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1128 | static void alc_mic_automute(struct hda_codec *codec) |
| 1129 | { |
| 1130 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1131 | struct alc_mic_route *dead, *alive; |
| 1132 | unsigned int present, type; |
| 1133 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1134 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1135 | if (!spec->auto_mic) |
| 1136 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1137 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1138 | return; |
| 1139 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1140 | return; |
| 1141 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1142 | if (spec->dual_adc_switch) { |
| 1143 | alc_dual_mic_adc_auto_switch(codec); |
| 1144 | return; |
| 1145 | } |
| 1146 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1147 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1148 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1149 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1150 | if (present) { |
| 1151 | alive = &spec->ext_mic; |
| 1152 | dead = &spec->int_mic; |
| 1153 | } else { |
| 1154 | alive = &spec->int_mic; |
| 1155 | dead = &spec->ext_mic; |
| 1156 | } |
| 1157 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1158 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1159 | if (type == AC_WID_AUD_MIX) { |
| 1160 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1161 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1162 | alive->mux_idx, |
| 1163 | HDA_AMP_MUTE, 0); |
| 1164 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1165 | dead->mux_idx, |
| 1166 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1167 | } else { |
| 1168 | /* MUX style (e.g. ALC880) */ |
| 1169 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1170 | AC_VERB_SET_CONNECT_SEL, |
| 1171 | alive->mux_idx); |
| 1172 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1173 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1174 | |
| 1175 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1176 | } |
| 1177 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1178 | /* unsolicited event for HP jack sensing */ |
| 1179 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1180 | { |
| 1181 | if (codec->vendor_id == 0x10ec0880) |
| 1182 | res >>= 28; |
| 1183 | else |
| 1184 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1185 | switch (res) { |
| 1186 | case ALC880_HP_EVENT: |
| 1187 | alc_automute_pin(codec); |
| 1188 | break; |
| 1189 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1190 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1191 | break; |
| 1192 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1193 | } |
| 1194 | |
| 1195 | static void alc_inithook(struct hda_codec *codec) |
| 1196 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1197 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1198 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1199 | } |
| 1200 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1201 | /* additional initialization for ALC888 variants */ |
| 1202 | static void alc888_coef_init(struct hda_codec *codec) |
| 1203 | { |
| 1204 | unsigned int tmp; |
| 1205 | |
| 1206 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1207 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1208 | 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] | 1209 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1210 | /* alc888S-VC */ |
| 1211 | snd_hda_codec_read(codec, 0x20, 0, |
| 1212 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1213 | else |
| 1214 | /* alc888-VB */ |
| 1215 | snd_hda_codec_read(codec, 0x20, 0, |
| 1216 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1217 | } |
| 1218 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1219 | static void alc889_coef_init(struct hda_codec *codec) |
| 1220 | { |
| 1221 | unsigned int tmp; |
| 1222 | |
| 1223 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1224 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1225 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1226 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1227 | } |
| 1228 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1229 | /* turn on/off EAPD control (only if available) */ |
| 1230 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1231 | { |
| 1232 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1233 | return; |
| 1234 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1235 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1236 | on ? 2 : 0); |
| 1237 | } |
| 1238 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1239 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1240 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1241 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1242 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1243 | switch (type) { |
| 1244 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1245 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1246 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1247 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1248 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1249 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1250 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1251 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1252 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1253 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1254 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1255 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1256 | set_eapd(codec, 0x0f, 1); |
| 1257 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1258 | break; |
| 1259 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1260 | case 0x10ec0267: |
| 1261 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1262 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1263 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1264 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1265 | case 0x10ec0660: |
| 1266 | case 0x10ec0662: |
| 1267 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1268 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1269 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1270 | set_eapd(codec, 0x14, 1); |
| 1271 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1272 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1273 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1274 | switch (codec->vendor_id) { |
| 1275 | case 0x10ec0260: |
| 1276 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1277 | AC_VERB_SET_COEF_INDEX, 7); |
| 1278 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1279 | AC_VERB_GET_PROC_COEF, 0); |
| 1280 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1281 | AC_VERB_SET_COEF_INDEX, 7); |
| 1282 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1283 | AC_VERB_SET_PROC_COEF, |
| 1284 | tmp | 0x2010); |
| 1285 | break; |
| 1286 | case 0x10ec0262: |
| 1287 | case 0x10ec0880: |
| 1288 | case 0x10ec0882: |
| 1289 | case 0x10ec0883: |
| 1290 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1291 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1292 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1293 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1294 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1295 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1296 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1297 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1298 | #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] | 1299 | case 0x10ec0267: |
| 1300 | case 0x10ec0268: |
| 1301 | snd_hda_codec_write(codec, 0x20, 0, |
| 1302 | AC_VERB_SET_COEF_INDEX, 7); |
| 1303 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1304 | AC_VERB_GET_PROC_COEF, 0); |
| 1305 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1306 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1307 | snd_hda_codec_write(codec, 0x20, 0, |
| 1308 | AC_VERB_SET_PROC_COEF, |
| 1309 | tmp | 0x3000); |
| 1310 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1311 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1312 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1313 | break; |
| 1314 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1315 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1316 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1317 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1318 | { |
| 1319 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1320 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1321 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1322 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1323 | if (!cfg->hp_pins[0]) { |
| 1324 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1325 | return; |
| 1326 | } |
| 1327 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1328 | if (!cfg->speaker_pins[0]) { |
| 1329 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1330 | return; |
| 1331 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1332 | sizeof(cfg->speaker_pins)); |
| 1333 | cfg->speaker_outs = cfg->line_outs; |
| 1334 | } |
| 1335 | |
| 1336 | if (!cfg->hp_pins[0]) { |
| 1337 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1338 | sizeof(cfg->hp_pins)); |
| 1339 | cfg->hp_outs = cfg->line_outs; |
| 1340 | } |
| 1341 | |
| 1342 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1343 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1344 | cfg->hp_pins[i]); |
| 1345 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1346 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1347 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1348 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1349 | spec->unsol_event = alc_sku_unsol_event; |
| 1350 | } |
| 1351 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1352 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1353 | { |
| 1354 | struct alc_spec *spec = codec->spec; |
| 1355 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1356 | hda_nid_t fixed, ext; |
| 1357 | int i; |
| 1358 | |
| 1359 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1360 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1361 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1362 | return; |
| 1363 | |
| 1364 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1365 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1366 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1367 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1368 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1369 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1370 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1371 | if (fixed) |
| 1372 | return; /* already occupied */ |
| 1373 | fixed = nid; |
| 1374 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1375 | case INPUT_PIN_ATTR_UNUSED: |
| 1376 | return; /* invalid entry */ |
| 1377 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1378 | if (ext) |
| 1379 | return; /* already occupied */ |
| 1380 | ext = nid; |
| 1381 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1382 | } |
| 1383 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1384 | if (!ext || !fixed) |
| 1385 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1386 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1387 | return; /* no unsol support */ |
| 1388 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1389 | ext, fixed); |
| 1390 | spec->ext_mic.pin = ext; |
| 1391 | spec->int_mic.pin = fixed; |
| 1392 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1393 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1394 | spec->auto_mic = 1; |
| 1395 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1396 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1397 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1398 | spec->unsol_event = alc_sku_unsol_event; |
| 1399 | } |
| 1400 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1401 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1402 | * the driver to ignore any present sku defines. |
| 1403 | */ |
| 1404 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1405 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1406 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1407 | { |
| 1408 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1409 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1410 | struct alc_spec *spec = codec->spec; |
| 1411 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1412 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1413 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1414 | if (spec->cdefine.fixup) { |
| 1415 | ass = spec->cdefine.sku_cfg; |
| 1416 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1417 | return -1; |
| 1418 | goto do_sku; |
| 1419 | } |
| 1420 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1421 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1422 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1423 | goto do_sku; |
| 1424 | |
| 1425 | nid = 0x1d; |
| 1426 | if (codec->vendor_id == 0x10ec0260) |
| 1427 | nid = 0x17; |
| 1428 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1429 | |
| 1430 | if (!(ass & 1)) { |
| 1431 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1432 | codec->chip_name, ass); |
| 1433 | return -1; |
| 1434 | } |
| 1435 | |
| 1436 | /* check sum */ |
| 1437 | tmp = 0; |
| 1438 | for (i = 1; i < 16; i++) { |
| 1439 | if ((ass >> i) & 1) |
| 1440 | tmp++; |
| 1441 | } |
| 1442 | if (((ass >> 16) & 0xf) != tmp) |
| 1443 | return -1; |
| 1444 | |
| 1445 | spec->cdefine.port_connectivity = ass >> 30; |
| 1446 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1447 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1448 | spec->cdefine.customization = ass >> 8; |
| 1449 | do_sku: |
| 1450 | spec->cdefine.sku_cfg = ass; |
| 1451 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1452 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1453 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1454 | spec->cdefine.override = ass & 0x1; |
| 1455 | |
| 1456 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1457 | nid, spec->cdefine.sku_cfg); |
| 1458 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1459 | spec->cdefine.port_connectivity); |
| 1460 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1461 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1462 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1463 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1464 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1465 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1466 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1467 | |
| 1468 | return 0; |
| 1469 | } |
| 1470 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1471 | /* check subsystem ID and set up device-specific initialization; |
| 1472 | * return 1 if initialized, 0 if invalid SSID |
| 1473 | */ |
| 1474 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1475 | * 31 ~ 16 : Manufacture ID |
| 1476 | * 15 ~ 8 : SKU ID |
| 1477 | * 7 ~ 0 : Assembly ID |
| 1478 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1479 | */ |
| 1480 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1481 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1482 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1483 | { |
| 1484 | unsigned int ass, tmp, i; |
| 1485 | unsigned nid; |
| 1486 | struct alc_spec *spec = codec->spec; |
| 1487 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1488 | if (spec->cdefine.fixup) { |
| 1489 | ass = spec->cdefine.sku_cfg; |
| 1490 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1491 | return 0; |
| 1492 | goto do_sku; |
| 1493 | } |
| 1494 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1495 | ass = codec->subsystem_id & 0xffff; |
| 1496 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1497 | goto do_sku; |
| 1498 | |
| 1499 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1500 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1501 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1502 | * 29~21 : reserve |
| 1503 | * 20 : PCBEEP input |
| 1504 | * 19~16 : Check sum (15:1) |
| 1505 | * 15~1 : Custom |
| 1506 | * 0 : override |
| 1507 | */ |
| 1508 | nid = 0x1d; |
| 1509 | if (codec->vendor_id == 0x10ec0260) |
| 1510 | nid = 0x17; |
| 1511 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1512 | snd_printd("realtek: No valid SSID, " |
| 1513 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1514 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1515 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1516 | return 0; |
| 1517 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1518 | return 0; |
| 1519 | |
| 1520 | /* check sum */ |
| 1521 | tmp = 0; |
| 1522 | for (i = 1; i < 16; i++) { |
| 1523 | if ((ass >> i) & 1) |
| 1524 | tmp++; |
| 1525 | } |
| 1526 | if (((ass >> 16) & 0xf) != tmp) |
| 1527 | return 0; |
| 1528 | do_sku: |
| 1529 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1530 | ass & 0xffff, codec->vendor_id); |
| 1531 | /* |
| 1532 | * 0 : override |
| 1533 | * 1 : Swap Jack |
| 1534 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1535 | * 3~5 : External Amplifier control |
| 1536 | * 7~6 : Reserved |
| 1537 | */ |
| 1538 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1539 | switch (tmp) { |
| 1540 | case 1: |
| 1541 | spec->init_amp = ALC_INIT_GPIO1; |
| 1542 | break; |
| 1543 | case 3: |
| 1544 | spec->init_amp = ALC_INIT_GPIO2; |
| 1545 | break; |
| 1546 | case 7: |
| 1547 | spec->init_amp = ALC_INIT_GPIO3; |
| 1548 | break; |
| 1549 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1550 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1551 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1552 | break; |
| 1553 | } |
| 1554 | |
| 1555 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1556 | * when the external headphone out jack is plugged" |
| 1557 | */ |
| 1558 | if (!(ass & 0x8000)) |
| 1559 | return 1; |
| 1560 | /* |
| 1561 | * 10~8 : Jack location |
| 1562 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1563 | * 14~13: Resvered |
| 1564 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1565 | * when the external headphone out jack is plugged" |
| 1566 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1567 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1568 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1569 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1570 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1571 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1572 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1573 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1574 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1575 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1576 | else if (tmp == 3) |
| 1577 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1578 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1579 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1580 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1581 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1582 | return 1; |
| 1583 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1584 | } |
| 1585 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1586 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1587 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1588 | return 1; |
| 1589 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1590 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1591 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1592 | hda_nid_t porta, hda_nid_t porte, |
| 1593 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1594 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1595 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1596 | struct alc_spec *spec = codec->spec; |
| 1597 | snd_printd("realtek: " |
| 1598 | "Enable default setup for auto mode as fallback\n"); |
| 1599 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1600 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1601 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1602 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1603 | } |
| 1604 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1605 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1606 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1607 | */ |
| 1608 | |
| 1609 | struct alc_pincfg { |
| 1610 | hda_nid_t nid; |
| 1611 | u32 val; |
| 1612 | }; |
| 1613 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1614 | struct alc_model_fixup { |
| 1615 | const int id; |
| 1616 | const char *name; |
| 1617 | }; |
| 1618 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1619 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1620 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1621 | bool chained; |
| 1622 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1623 | union { |
| 1624 | unsigned int sku; |
| 1625 | const struct alc_pincfg *pins; |
| 1626 | const struct hda_verb *verbs; |
| 1627 | void (*func)(struct hda_codec *codec, |
| 1628 | const struct alc_fixup *fix, |
| 1629 | int action); |
| 1630 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1631 | }; |
| 1632 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1633 | enum { |
| 1634 | ALC_FIXUP_INVALID, |
| 1635 | ALC_FIXUP_SKU, |
| 1636 | ALC_FIXUP_PINS, |
| 1637 | ALC_FIXUP_VERBS, |
| 1638 | ALC_FIXUP_FUNC, |
| 1639 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1640 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1641 | enum { |
| 1642 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1643 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1644 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1645 | }; |
| 1646 | |
| 1647 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1648 | { |
| 1649 | struct alc_spec *spec = codec->spec; |
| 1650 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1651 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1652 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1653 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1654 | int depth = 0; |
| 1655 | |
| 1656 | if (!spec->fixup_list) |
| 1657 | return; |
| 1658 | |
| 1659 | while (id >= 0) { |
| 1660 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1661 | const struct alc_pincfg *cfg; |
| 1662 | |
| 1663 | switch (fix->type) { |
| 1664 | case ALC_FIXUP_SKU: |
| 1665 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1666 | break;; |
| 1667 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1668 | "Apply sku override for %s\n", |
| 1669 | codec->chip_name, modelname); |
| 1670 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1671 | spec->cdefine.fixup = 1; |
| 1672 | break; |
| 1673 | case ALC_FIXUP_PINS: |
| 1674 | cfg = fix->v.pins; |
| 1675 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1676 | break; |
| 1677 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1678 | "Apply pincfg for %s\n", |
| 1679 | codec->chip_name, modelname); |
| 1680 | for (; cfg->nid; cfg++) |
| 1681 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1682 | cfg->val); |
| 1683 | break; |
| 1684 | case ALC_FIXUP_VERBS: |
| 1685 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1686 | break; |
| 1687 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1688 | "Apply fix-verbs for %s\n", |
| 1689 | codec->chip_name, modelname); |
| 1690 | add_verb(codec->spec, fix->v.verbs); |
| 1691 | break; |
| 1692 | case ALC_FIXUP_FUNC: |
| 1693 | if (!fix->v.func) |
| 1694 | break; |
| 1695 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1696 | "Apply fix-func for %s\n", |
| 1697 | codec->chip_name, modelname); |
| 1698 | fix->v.func(codec, fix, action); |
| 1699 | break; |
| 1700 | default: |
| 1701 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1702 | "Invalid fixup type %d\n", |
| 1703 | codec->chip_name, fix->type); |
| 1704 | break; |
| 1705 | } |
| 1706 | if (!fix[id].chained) |
| 1707 | break; |
| 1708 | if (++depth > 10) |
| 1709 | break; |
| 1710 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1711 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1712 | } |
| 1713 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1714 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1715 | const struct alc_model_fixup *models, |
| 1716 | const struct snd_pci_quirk *quirk, |
| 1717 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1718 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1719 | struct alc_spec *spec = codec->spec; |
| 1720 | int id = -1; |
| 1721 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1722 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1723 | if (codec->modelname && models) { |
| 1724 | while (models->name) { |
| 1725 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1726 | id = models->id; |
| 1727 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1728 | break; |
| 1729 | } |
| 1730 | models++; |
| 1731 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1732 | } |
| 1733 | if (id < 0) { |
| 1734 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1735 | if (quirk) { |
| 1736 | id = quirk->value; |
| 1737 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1738 | name = quirk->name; |
| 1739 | #endif |
| 1740 | } |
| 1741 | } |
| 1742 | |
| 1743 | spec->fixup_id = id; |
| 1744 | if (id >= 0) { |
| 1745 | spec->fixup_list = fixlist; |
| 1746 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1747 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1748 | } |
| 1749 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1750 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1751 | unsigned int coef_idx) |
| 1752 | { |
| 1753 | unsigned int val; |
| 1754 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1755 | coef_idx); |
| 1756 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1757 | AC_VERB_GET_PROC_COEF, 0); |
| 1758 | return val; |
| 1759 | } |
| 1760 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1761 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1762 | unsigned int coef_val) |
| 1763 | { |
| 1764 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1765 | coef_idx); |
| 1766 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1767 | coef_val); |
| 1768 | } |
| 1769 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1770 | /* set right pin controls for digital I/O */ |
| 1771 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1772 | { |
| 1773 | struct alc_spec *spec = codec->spec; |
| 1774 | int i; |
| 1775 | hda_nid_t pin; |
| 1776 | |
| 1777 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1778 | pin = spec->autocfg.dig_out_pins[i]; |
| 1779 | if (pin) { |
| 1780 | snd_hda_codec_write(codec, pin, 0, |
| 1781 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1782 | PIN_OUT); |
| 1783 | } |
| 1784 | } |
| 1785 | pin = spec->autocfg.dig_in_pin; |
| 1786 | if (pin) |
| 1787 | snd_hda_codec_write(codec, pin, 0, |
| 1788 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1789 | PIN_IN); |
| 1790 | } |
| 1791 | |
| 1792 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1793 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1794 | { |
| 1795 | struct alc_spec *spec = codec->spec; |
| 1796 | int i, err; |
| 1797 | hda_nid_t dig_nid; |
| 1798 | |
| 1799 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1800 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1801 | err = snd_hda_get_connections(codec, |
| 1802 | spec->autocfg.dig_out_pins[i], |
| 1803 | &dig_nid, 1); |
| 1804 | if (err < 0) |
| 1805 | continue; |
| 1806 | if (!i) { |
| 1807 | spec->multiout.dig_out_nid = dig_nid; |
| 1808 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1809 | } else { |
| 1810 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1811 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1812 | break; |
| 1813 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1814 | } |
| 1815 | } |
| 1816 | |
| 1817 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1818 | dig_nid = codec->start_nid; |
| 1819 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1820 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1821 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1822 | continue; |
| 1823 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1824 | continue; |
| 1825 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1826 | continue; |
| 1827 | err = get_connection_index(codec, dig_nid, |
| 1828 | spec->autocfg.dig_in_pin); |
| 1829 | if (err >= 0) { |
| 1830 | spec->dig_in_nid = dig_nid; |
| 1831 | break; |
| 1832 | } |
| 1833 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1834 | } |
| 1835 | } |
| 1836 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1837 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1838 | * ALC888 |
| 1839 | */ |
| 1840 | |
| 1841 | /* |
| 1842 | * 2ch mode |
| 1843 | */ |
| 1844 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1845 | /* Mic-in jack as mic in */ |
| 1846 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1847 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1848 | /* Line-in jack as Line in */ |
| 1849 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1850 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1851 | /* Line-Out as Front */ |
| 1852 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1853 | { } /* end */ |
| 1854 | }; |
| 1855 | |
| 1856 | /* |
| 1857 | * 4ch mode |
| 1858 | */ |
| 1859 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1860 | /* Mic-in jack as mic in */ |
| 1861 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1862 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1863 | /* Line-in jack as Surround */ |
| 1864 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1865 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1866 | /* Line-Out as Front */ |
| 1867 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1868 | { } /* end */ |
| 1869 | }; |
| 1870 | |
| 1871 | /* |
| 1872 | * 6ch mode |
| 1873 | */ |
| 1874 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1875 | /* Mic-in jack as CLFE */ |
| 1876 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1877 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1878 | /* Line-in jack as Surround */ |
| 1879 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1880 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1881 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1882 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1883 | { } /* end */ |
| 1884 | }; |
| 1885 | |
| 1886 | /* |
| 1887 | * 8ch mode |
| 1888 | */ |
| 1889 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1890 | /* Mic-in jack as CLFE */ |
| 1891 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1892 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1893 | /* Line-in jack as Surround */ |
| 1894 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1895 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1896 | /* Line-Out as Side */ |
| 1897 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1898 | { } /* end */ |
| 1899 | }; |
| 1900 | |
| 1901 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1902 | { 2, alc888_4ST_ch2_intel_init }, |
| 1903 | { 4, alc888_4ST_ch4_intel_init }, |
| 1904 | { 6, alc888_4ST_ch6_intel_init }, |
| 1905 | { 8, alc888_4ST_ch8_intel_init }, |
| 1906 | }; |
| 1907 | |
| 1908 | /* |
| 1909 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1910 | */ |
| 1911 | |
| 1912 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1913 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1914 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1915 | /* Connect Internal HP to Front */ |
| 1916 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1917 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1918 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1919 | /* Connect Bass HP to Front */ |
| 1920 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1921 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1922 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1923 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1924 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1925 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1926 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1927 | /* Connect Mic jack to CLFE */ |
| 1928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1930 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1931 | /* Connect Line-in jack to Surround */ |
| 1932 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1933 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1934 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1935 | /* Connect HP out jack to Front */ |
| 1936 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1937 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1938 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1939 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1940 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1941 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1942 | {} |
| 1943 | }; |
| 1944 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1945 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1946 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1947 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1948 | } |
| 1949 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1950 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1951 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1952 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1953 | if (codec->vendor_id == 0x10ec0880) |
| 1954 | res >>= 28; |
| 1955 | else |
| 1956 | res >>= 26; |
| 1957 | if (res == ALC880_HP_EVENT) |
| 1958 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1959 | } |
| 1960 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1961 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1962 | { |
| 1963 | struct alc_spec *spec = codec->spec; |
| 1964 | |
| 1965 | spec->autocfg.hp_pins[0] = 0x15; |
| 1966 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1967 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1968 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1969 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1970 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1971 | } |
| 1972 | |
| 1973 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1974 | { |
| 1975 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1976 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1977 | } |
| 1978 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1979 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1980 | { |
| 1981 | struct alc_spec *spec = codec->spec; |
| 1982 | |
| 1983 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1984 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1985 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1986 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1987 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1988 | |
| 1989 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1990 | * ALC888 Acer Aspire 4930G model |
| 1991 | */ |
| 1992 | |
| 1993 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1994 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1995 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1996 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1997 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1998 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1999 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2000 | /* Connect Internal HP to front */ |
| 2001 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2002 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2003 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2004 | /* Connect HP out to front */ |
| 2005 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2006 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2007 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2008 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2009 | { } |
| 2010 | }; |
| 2011 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2012 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2013 | * ALC888 Acer Aspire 6530G model |
| 2014 | */ |
| 2015 | |
| 2016 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2017 | /* Route to built-in subwoofer as well as speakers */ |
| 2018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2020 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2021 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2022 | /* Bias voltage on for external mic port */ |
| 2023 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2024 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2025 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2026 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2027 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2028 | /* Enable unsolicited event for HP jack */ |
| 2029 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2030 | /* Enable speaker output */ |
| 2031 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2033 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2034 | /* Enable headphone output */ |
| 2035 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2037 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2038 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2039 | { } |
| 2040 | }; |
| 2041 | |
| 2042 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2043 | *ALC888 Acer Aspire 7730G model |
| 2044 | */ |
| 2045 | |
| 2046 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2047 | /* Bias voltage on for external mic port */ |
| 2048 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2049 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2050 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2051 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2053 | /* Enable unsolicited event for HP jack */ |
| 2054 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2055 | /* Enable speaker output */ |
| 2056 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2057 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2058 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2059 | /* Enable headphone output */ |
| 2060 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2061 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2062 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2063 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2064 | /*Enable internal subwoofer */ |
| 2065 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2066 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2067 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2068 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2069 | { } |
| 2070 | }; |
| 2071 | |
| 2072 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2073 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2074 | */ |
| 2075 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2076 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2077 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2078 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2079 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2081 | /* Enable unsolicited event for HP jack */ |
| 2082 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2083 | /* Connect Internal Front to Front */ |
| 2084 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2085 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2086 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2087 | /* Connect Internal Rear to Rear */ |
| 2088 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2089 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2090 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2091 | /* Connect Internal CLFE to CLFE */ |
| 2092 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2093 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2094 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2095 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2096 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2097 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2098 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2099 | /* Enable all DACs */ |
| 2100 | /* DAC DISABLE/MUTE 1? */ |
| 2101 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2102 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2103 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2104 | /* DAC DISABLE/MUTE 2? */ |
| 2105 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2106 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2107 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2108 | /* DMIC fix |
| 2109 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2110 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2111 | * makes the signal become a difference/sum signal instead of standard |
| 2112 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2113 | * codec replicate the sum signal to both channels, turning it into a |
| 2114 | * normal mono mic. |
| 2115 | */ |
| 2116 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2117 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2118 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2119 | { } |
| 2120 | }; |
| 2121 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2122 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2123 | /* Front mic only available on one ADC */ |
| 2124 | { |
| 2125 | .num_items = 4, |
| 2126 | .items = { |
| 2127 | { "Mic", 0x0 }, |
| 2128 | { "Line", 0x2 }, |
| 2129 | { "CD", 0x4 }, |
| 2130 | { "Front Mic", 0xb }, |
| 2131 | }, |
| 2132 | }, |
| 2133 | { |
| 2134 | .num_items = 3, |
| 2135 | .items = { |
| 2136 | { "Mic", 0x0 }, |
| 2137 | { "Line", 0x2 }, |
| 2138 | { "CD", 0x4 }, |
| 2139 | }, |
| 2140 | } |
| 2141 | }; |
| 2142 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2143 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2144 | /* Interal mic only available on one ADC */ |
| 2145 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2146 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2147 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2148 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2149 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2150 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2151 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2152 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2153 | }, |
| 2154 | }, |
| 2155 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2156 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2157 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2158 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2159 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2160 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2161 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2162 | }, |
| 2163 | } |
| 2164 | }; |
| 2165 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2166 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2167 | /* Digital mic only available on first "ADC" */ |
| 2168 | { |
| 2169 | .num_items = 5, |
| 2170 | .items = { |
| 2171 | { "Mic", 0x0 }, |
| 2172 | { "Line", 0x2 }, |
| 2173 | { "CD", 0x4 }, |
| 2174 | { "Front Mic", 0xb }, |
| 2175 | { "Input Mix", 0xa }, |
| 2176 | }, |
| 2177 | }, |
| 2178 | { |
| 2179 | .num_items = 4, |
| 2180 | .items = { |
| 2181 | { "Mic", 0x0 }, |
| 2182 | { "Line", 0x2 }, |
| 2183 | { "CD", 0x4 }, |
| 2184 | { "Input Mix", 0xa }, |
| 2185 | }, |
| 2186 | }, |
| 2187 | { |
| 2188 | .num_items = 4, |
| 2189 | .items = { |
| 2190 | { "Mic", 0x0 }, |
| 2191 | { "Line", 0x2 }, |
| 2192 | { "CD", 0x4 }, |
| 2193 | { "Input Mix", 0xa }, |
| 2194 | }, |
| 2195 | } |
| 2196 | }; |
| 2197 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2198 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2199 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2200 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2201 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2202 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2203 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2204 | HDA_OUTPUT), |
| 2205 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2206 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2207 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2208 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2209 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2210 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2211 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2212 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2213 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2214 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2215 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2217 | { } /* end */ |
| 2218 | }; |
| 2219 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2220 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2221 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2222 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2223 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2224 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2225 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2226 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2227 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2228 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2229 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2230 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2231 | 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] | 2232 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2233 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2234 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2235 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2236 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2237 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2238 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2239 | { } /* end */ |
| 2240 | }; |
| 2241 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2242 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2243 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2244 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2245 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2246 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2247 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2248 | HDA_OUTPUT), |
| 2249 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2250 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2251 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2252 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2253 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2254 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2255 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2256 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2257 | { } /* end */ |
| 2258 | }; |
| 2259 | |
| 2260 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2261 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2262 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2263 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2264 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2265 | spec->autocfg.hp_pins[0] = 0x15; |
| 2266 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2267 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2268 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2269 | } |
| 2270 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2271 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2272 | { |
| 2273 | struct alc_spec *spec = codec->spec; |
| 2274 | |
| 2275 | spec->autocfg.hp_pins[0] = 0x15; |
| 2276 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2277 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2278 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2279 | } |
| 2280 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2281 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2282 | { |
| 2283 | struct alc_spec *spec = codec->spec; |
| 2284 | |
| 2285 | spec->autocfg.hp_pins[0] = 0x15; |
| 2286 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2287 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2288 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2289 | } |
| 2290 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2291 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2292 | { |
| 2293 | struct alc_spec *spec = codec->spec; |
| 2294 | |
| 2295 | spec->autocfg.hp_pins[0] = 0x15; |
| 2296 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2297 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2298 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2299 | } |
| 2300 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2301 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2302 | * ALC880 3-stack model |
| 2303 | * |
| 2304 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2305 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2306 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2307 | */ |
| 2308 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2309 | static hda_nid_t alc880_dac_nids[4] = { |
| 2310 | /* front, rear, clfe, rear_surr */ |
| 2311 | 0x02, 0x05, 0x04, 0x03 |
| 2312 | }; |
| 2313 | |
| 2314 | static hda_nid_t alc880_adc_nids[3] = { |
| 2315 | /* ADC0-2 */ |
| 2316 | 0x07, 0x08, 0x09, |
| 2317 | }; |
| 2318 | |
| 2319 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2320 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2321 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2322 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2323 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2324 | /* ADC1-2 */ |
| 2325 | 0x08, 0x09, |
| 2326 | }; |
| 2327 | |
| 2328 | #define ALC880_DIGOUT_NID 0x06 |
| 2329 | #define ALC880_DIGIN_NID 0x0a |
| 2330 | |
| 2331 | static struct hda_input_mux alc880_capture_source = { |
| 2332 | .num_items = 4, |
| 2333 | .items = { |
| 2334 | { "Mic", 0x0 }, |
| 2335 | { "Front Mic", 0x3 }, |
| 2336 | { "Line", 0x2 }, |
| 2337 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2338 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2339 | }; |
| 2340 | |
| 2341 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2342 | /* 2ch mode */ |
| 2343 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2344 | /* set line-in to input, mute it */ |
| 2345 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2346 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2347 | /* set mic-in to input vref 80%, mute it */ |
| 2348 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2349 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2350 | { } /* end */ |
| 2351 | }; |
| 2352 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2353 | /* 6ch mode */ |
| 2354 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2355 | /* set line-in to output, unmute it */ |
| 2356 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2357 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2358 | /* set mic-in to output, unmute it */ |
| 2359 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2360 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2361 | { } /* end */ |
| 2362 | }; |
| 2363 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2364 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2365 | { 2, alc880_threestack_ch2_init }, |
| 2366 | { 6, alc880_threestack_ch6_init }, |
| 2367 | }; |
| 2368 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2369 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2370 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2371 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2372 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2373 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2374 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2375 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2376 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2377 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2378 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2379 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2380 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2381 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2382 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2383 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2384 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2385 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2386 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2387 | { |
| 2388 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2389 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2390 | .info = alc_ch_mode_info, |
| 2391 | .get = alc_ch_mode_get, |
| 2392 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2393 | }, |
| 2394 | { } /* end */ |
| 2395 | }; |
| 2396 | |
| 2397 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2398 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2399 | struct snd_ctl_elem_info *uinfo) |
| 2400 | { |
| 2401 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2402 | struct alc_spec *spec = codec->spec; |
| 2403 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2404 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2405 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2406 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2407 | HDA_INPUT); |
| 2408 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2409 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2410 | return err; |
| 2411 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2412 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2413 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2414 | unsigned int size, unsigned int __user *tlv) |
| 2415 | { |
| 2416 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2417 | struct alc_spec *spec = codec->spec; |
| 2418 | int err; |
| 2419 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2420 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2421 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2422 | HDA_INPUT); |
| 2423 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2424 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2425 | return err; |
| 2426 | } |
| 2427 | |
| 2428 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2429 | struct snd_ctl_elem_value *ucontrol); |
| 2430 | |
| 2431 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2432 | struct snd_ctl_elem_value *ucontrol, |
| 2433 | getput_call_t func) |
| 2434 | { |
| 2435 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2436 | struct alc_spec *spec = codec->spec; |
| 2437 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2438 | int err; |
| 2439 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2440 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2441 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2442 | 3, 0, HDA_INPUT); |
| 2443 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2444 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2445 | return err; |
| 2446 | } |
| 2447 | |
| 2448 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2449 | struct snd_ctl_elem_value *ucontrol) |
| 2450 | { |
| 2451 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2452 | snd_hda_mixer_amp_volume_get); |
| 2453 | } |
| 2454 | |
| 2455 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2456 | struct snd_ctl_elem_value *ucontrol) |
| 2457 | { |
| 2458 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2459 | snd_hda_mixer_amp_volume_put); |
| 2460 | } |
| 2461 | |
| 2462 | /* capture mixer elements */ |
| 2463 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2464 | |
| 2465 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2466 | struct snd_ctl_elem_value *ucontrol) |
| 2467 | { |
| 2468 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2469 | snd_hda_mixer_amp_switch_get); |
| 2470 | } |
| 2471 | |
| 2472 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2473 | struct snd_ctl_elem_value *ucontrol) |
| 2474 | { |
| 2475 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2476 | snd_hda_mixer_amp_switch_put); |
| 2477 | } |
| 2478 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2479 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2480 | { \ |
| 2481 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2482 | .name = "Capture Switch", \ |
| 2483 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2484 | .count = num, \ |
| 2485 | .info = alc_cap_sw_info, \ |
| 2486 | .get = alc_cap_sw_get, \ |
| 2487 | .put = alc_cap_sw_put, \ |
| 2488 | }, \ |
| 2489 | { \ |
| 2490 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2491 | .name = "Capture Volume", \ |
| 2492 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2493 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2494 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2495 | .count = num, \ |
| 2496 | .info = alc_cap_vol_info, \ |
| 2497 | .get = alc_cap_vol_get, \ |
| 2498 | .put = alc_cap_vol_put, \ |
| 2499 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2500 | } |
| 2501 | |
| 2502 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2503 | { \ |
| 2504 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2505 | /* .name = "Capture Source", */ \ |
| 2506 | .name = "Input Source", \ |
| 2507 | .count = num, \ |
| 2508 | .info = alc_mux_enum_info, \ |
| 2509 | .get = alc_mux_enum_get, \ |
| 2510 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2511 | } |
| 2512 | |
| 2513 | #define DEFINE_CAPMIX(num) \ |
| 2514 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2515 | _DEFINE_CAPMIX(num), \ |
| 2516 | _DEFINE_CAPSRC(num), \ |
| 2517 | { } /* end */ \ |
| 2518 | } |
| 2519 | |
| 2520 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2521 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2522 | _DEFINE_CAPMIX(num), \ |
| 2523 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2524 | } |
| 2525 | |
| 2526 | /* up to three ADCs */ |
| 2527 | DEFINE_CAPMIX(1); |
| 2528 | DEFINE_CAPMIX(2); |
| 2529 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2530 | DEFINE_CAPMIX_NOSRC(1); |
| 2531 | DEFINE_CAPMIX_NOSRC(2); |
| 2532 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2533 | |
| 2534 | /* |
| 2535 | * ALC880 5-stack model |
| 2536 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2537 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2538 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2539 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2540 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2541 | */ |
| 2542 | |
| 2543 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2544 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2545 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2546 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2547 | { } /* end */ |
| 2548 | }; |
| 2549 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2550 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2551 | /* 6ch mode */ |
| 2552 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2553 | /* set line-in to input, mute it */ |
| 2554 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2555 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2556 | { } /* end */ |
| 2557 | }; |
| 2558 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2559 | /* 8ch mode */ |
| 2560 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2561 | /* set line-in to output, unmute it */ |
| 2562 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2563 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2564 | { } /* end */ |
| 2565 | }; |
| 2566 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2567 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2568 | { 6, alc880_fivestack_ch6_init }, |
| 2569 | { 8, alc880_fivestack_ch8_init }, |
| 2570 | }; |
| 2571 | |
| 2572 | |
| 2573 | /* |
| 2574 | * ALC880 6-stack model |
| 2575 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2576 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2577 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2578 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2579 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2580 | */ |
| 2581 | |
| 2582 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2583 | /* front, rear, clfe, rear_surr */ |
| 2584 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2585 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2586 | |
| 2587 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2588 | .num_items = 4, |
| 2589 | .items = { |
| 2590 | { "Mic", 0x0 }, |
| 2591 | { "Front Mic", 0x1 }, |
| 2592 | { "Line", 0x2 }, |
| 2593 | { "CD", 0x4 }, |
| 2594 | }, |
| 2595 | }; |
| 2596 | |
| 2597 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2598 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2599 | { 8, NULL }, |
| 2600 | }; |
| 2601 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2602 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2603 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2604 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2605 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2606 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2607 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2608 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2609 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2610 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2611 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2612 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2613 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2614 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2615 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2616 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2618 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2621 | { |
| 2622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2623 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2624 | .info = alc_ch_mode_info, |
| 2625 | .get = alc_ch_mode_get, |
| 2626 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2627 | }, |
| 2628 | { } /* end */ |
| 2629 | }; |
| 2630 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2631 | |
| 2632 | /* |
| 2633 | * ALC880 W810 model |
| 2634 | * |
| 2635 | * W810 has rear IO for: |
| 2636 | * Front (DAC 02) |
| 2637 | * Surround (DAC 03) |
| 2638 | * Center/LFE (DAC 04) |
| 2639 | * Digital out (06) |
| 2640 | * |
| 2641 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2642 | * 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] | 2643 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2644 | * There is a variable resistor to control the speaker or headphone |
| 2645 | * volume. This is a hardware-only device without a software API. |
| 2646 | * |
| 2647 | * Plugging headphones in will disable the internal speakers. This is |
| 2648 | * implemented in hardware, not via the driver using jack sense. In |
| 2649 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2650 | * disable both the speakers and headphones. |
| 2651 | * |
| 2652 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2653 | * These may not do anything useful with this driver yet, because I |
| 2654 | * haven't setup any initialization verbs for these yet... |
| 2655 | */ |
| 2656 | |
| 2657 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2658 | /* front, rear/surround, clfe */ |
| 2659 | 0x02, 0x03, 0x04 |
| 2660 | }; |
| 2661 | |
| 2662 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2663 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2664 | { 6, NULL } |
| 2665 | }; |
| 2666 | |
| 2667 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2668 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2669 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2670 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2671 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2672 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2673 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2674 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2675 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2676 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2678 | { } /* end */ |
| 2679 | }; |
| 2680 | |
| 2681 | |
| 2682 | /* |
| 2683 | * Z710V model |
| 2684 | * |
| 2685 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2686 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2687 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2688 | */ |
| 2689 | |
| 2690 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2691 | 0x02 |
| 2692 | }; |
| 2693 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2694 | |
| 2695 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2696 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2697 | { 2, NULL } |
| 2698 | }; |
| 2699 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2700 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +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 | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2703 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2704 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2705 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2706 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2709 | { } /* end */ |
| 2710 | }; |
| 2711 | |
| 2712 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2713 | /* |
| 2714 | * ALC880 F1734 model |
| 2715 | * |
| 2716 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2717 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2718 | */ |
| 2719 | |
| 2720 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2721 | 0x03 |
| 2722 | }; |
| 2723 | #define ALC880_F1734_HP_DAC 0x02 |
| 2724 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2725 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2726 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2727 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2728 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2729 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2730 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2731 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2734 | { } /* end */ |
| 2735 | }; |
| 2736 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2737 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2738 | .num_items = 2, |
| 2739 | .items = { |
| 2740 | { "Mic", 0x1 }, |
| 2741 | { "CD", 0x4 }, |
| 2742 | }, |
| 2743 | }; |
| 2744 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2745 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | /* |
| 2747 | * ALC880 ASUS model |
| 2748 | * |
| 2749 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2750 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2751 | * Mic = 0x18, Line = 0x1a |
| 2752 | */ |
| 2753 | |
| 2754 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2755 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2756 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2757 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2758 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2759 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2760 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2761 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2762 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2763 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2764 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2765 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2766 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2767 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2768 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2769 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2772 | { |
| 2773 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2774 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2775 | .info = alc_ch_mode_info, |
| 2776 | .get = alc_ch_mode_get, |
| 2777 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2778 | }, |
| 2779 | { } /* end */ |
| 2780 | }; |
| 2781 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2782 | /* |
| 2783 | * ALC880 ASUS W1V model |
| 2784 | * |
| 2785 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2786 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2787 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2788 | */ |
| 2789 | |
| 2790 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2791 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2792 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2793 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2794 | { } /* end */ |
| 2795 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2797 | /* TCL S700 */ |
| 2798 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2799 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2800 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2801 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2802 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2803 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2806 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2807 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2808 | { } /* end */ |
| 2809 | }; |
| 2810 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2811 | /* Uniwill */ |
| 2812 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2813 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2814 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2815 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2816 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2817 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2818 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2819 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2820 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2821 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2822 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2823 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2824 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2827 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2828 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2829 | { |
| 2830 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2831 | .name = "Channel Mode", |
| 2832 | .info = alc_ch_mode_info, |
| 2833 | .get = alc_ch_mode_get, |
| 2834 | .put = alc_ch_mode_put, |
| 2835 | }, |
| 2836 | { } /* end */ |
| 2837 | }; |
| 2838 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2839 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2840 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2841 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2842 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2843 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2844 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2845 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2846 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2847 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2848 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2849 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2850 | { } /* end */ |
| 2851 | }; |
| 2852 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2853 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2854 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2855 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2856 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2857 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2858 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2859 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2860 | { } /* end */ |
| 2861 | }; |
| 2862 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2863 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2864 | * virtual master controls |
| 2865 | */ |
| 2866 | |
| 2867 | /* |
| 2868 | * slave controls for virtual master |
| 2869 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2870 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2871 | "Front Playback Volume", |
| 2872 | "Surround Playback Volume", |
| 2873 | "Center Playback Volume", |
| 2874 | "LFE Playback Volume", |
| 2875 | "Side Playback Volume", |
| 2876 | "Headphone Playback Volume", |
| 2877 | "Speaker Playback Volume", |
| 2878 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2879 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2880 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2881 | NULL, |
| 2882 | }; |
| 2883 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2884 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2885 | "Front Playback Switch", |
| 2886 | "Surround Playback Switch", |
| 2887 | "Center Playback Switch", |
| 2888 | "LFE Playback Switch", |
| 2889 | "Side Playback Switch", |
| 2890 | "Headphone Playback Switch", |
| 2891 | "Speaker Playback Switch", |
| 2892 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2893 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2894 | "Line-Out Playback Switch", |
| 2895 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2896 | NULL, |
| 2897 | }; |
| 2898 | |
| 2899 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2900 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2901 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2902 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2903 | #define NID_MAPPING (-1) |
| 2904 | |
| 2905 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2906 | #define SUBDEV_HP_ (1 << 6) |
| 2907 | #define SUBDEV_LINE_ (2 << 6) |
| 2908 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2909 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2910 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2911 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2912 | static void alc_free_kctls(struct hda_codec *codec); |
| 2913 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2914 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2915 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2916 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2917 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2918 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2919 | { } /* end */ |
| 2920 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2921 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2922 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2923 | static int alc_build_controls(struct hda_codec *codec) |
| 2924 | { |
| 2925 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2926 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2927 | struct snd_kcontrol_new *knew; |
| 2928 | int i, j, err; |
| 2929 | unsigned int u; |
| 2930 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2931 | |
| 2932 | for (i = 0; i < spec->num_mixers; i++) { |
| 2933 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2934 | if (err < 0) |
| 2935 | return err; |
| 2936 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2937 | if (spec->cap_mixer) { |
| 2938 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2939 | if (err < 0) |
| 2940 | return err; |
| 2941 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2942 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2943 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2944 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2945 | if (err < 0) |
| 2946 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2947 | if (!spec->no_analog) { |
| 2948 | err = snd_hda_create_spdif_share_sw(codec, |
| 2949 | &spec->multiout); |
| 2950 | if (err < 0) |
| 2951 | return err; |
| 2952 | spec->multiout.share_spdif = 1; |
| 2953 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2954 | } |
| 2955 | if (spec->dig_in_nid) { |
| 2956 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2957 | if (err < 0) |
| 2958 | return err; |
| 2959 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2960 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2961 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2962 | /* create beep controls if needed */ |
| 2963 | if (spec->beep_amp) { |
| 2964 | struct snd_kcontrol_new *knew; |
| 2965 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2966 | struct snd_kcontrol *kctl; |
| 2967 | kctl = snd_ctl_new1(knew, codec); |
| 2968 | if (!kctl) |
| 2969 | return -ENOMEM; |
| 2970 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2971 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2972 | if (err < 0) |
| 2973 | return err; |
| 2974 | } |
| 2975 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2976 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2977 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2978 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2979 | if (!spec->no_analog && |
| 2980 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2981 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2982 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2983 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2984 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2985 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2986 | if (err < 0) |
| 2987 | return err; |
| 2988 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2989 | if (!spec->no_analog && |
| 2990 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2991 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2992 | NULL, alc_slave_sws); |
| 2993 | if (err < 0) |
| 2994 | return err; |
| 2995 | } |
| 2996 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2997 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2998 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2999 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3000 | if (!kctl) |
| 3001 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3002 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3003 | hda_nid_t *nids = spec->capsrc_nids; |
| 3004 | if (!nids) |
| 3005 | nids = spec->adc_nids; |
| 3006 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3007 | if (err < 0) |
| 3008 | return err; |
| 3009 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3010 | } |
| 3011 | if (spec->cap_mixer) { |
| 3012 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3013 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3014 | if (kname && strcmp(knew->name, kname) == 0) |
| 3015 | continue; |
| 3016 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3017 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3018 | err = snd_hda_add_nid(codec, kctl, i, |
| 3019 | spec->adc_nids[i]); |
| 3020 | if (err < 0) |
| 3021 | return err; |
| 3022 | } |
| 3023 | } |
| 3024 | } |
| 3025 | |
| 3026 | /* other nid->control mapping */ |
| 3027 | for (i = 0; i < spec->num_mixers; i++) { |
| 3028 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3029 | if (knew->iface != NID_MAPPING) |
| 3030 | continue; |
| 3031 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3032 | if (kctl == NULL) |
| 3033 | continue; |
| 3034 | u = knew->subdevice; |
| 3035 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3036 | nid = u & 0x3f; |
| 3037 | if (nid == 0) |
| 3038 | continue; |
| 3039 | switch (u & 0xc0) { |
| 3040 | case SUBDEV_SPEAKER_: |
| 3041 | nid = spec->autocfg.speaker_pins[nid]; |
| 3042 | break; |
| 3043 | case SUBDEV_LINE_: |
| 3044 | nid = spec->autocfg.line_out_pins[nid]; |
| 3045 | break; |
| 3046 | case SUBDEV_HP_: |
| 3047 | nid = spec->autocfg.hp_pins[nid]; |
| 3048 | break; |
| 3049 | default: |
| 3050 | continue; |
| 3051 | } |
| 3052 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3053 | if (err < 0) |
| 3054 | return err; |
| 3055 | } |
| 3056 | u = knew->private_value; |
| 3057 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3058 | nid = u & 0xff; |
| 3059 | if (nid == 0) |
| 3060 | continue; |
| 3061 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3062 | if (err < 0) |
| 3063 | return err; |
| 3064 | } |
| 3065 | } |
| 3066 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3067 | |
| 3068 | alc_free_kctls(codec); /* no longer needed */ |
| 3069 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3070 | return 0; |
| 3071 | } |
| 3072 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3074 | /* |
| 3075 | * initialize the codec volumes, etc |
| 3076 | */ |
| 3077 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3078 | /* |
| 3079 | * generic initialization of ADC, input mixers and output mixers |
| 3080 | */ |
| 3081 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3082 | /* |
| 3083 | * Unmute ADC0-2 and set the default input to mic-in |
| 3084 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3085 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3086 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3087 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3088 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3089 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3091 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3092 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3093 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3094 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3095 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3096 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3097 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3105 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3106 | /* |
| 3107 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3108 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3109 | /* set vol=0 to output mixers */ |
| 3110 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3111 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3112 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3113 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3114 | /* set up input amps for analog loopback */ |
| 3115 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3119 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3121 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3122 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3123 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3124 | |
| 3125 | { } |
| 3126 | }; |
| 3127 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3128 | /* |
| 3129 | * 3-stack pin configuration: |
| 3130 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3131 | */ |
| 3132 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3133 | /* |
| 3134 | * preset connection lists of input pins |
| 3135 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3136 | */ |
| 3137 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3138 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3139 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3140 | |
| 3141 | /* |
| 3142 | * Set pin mode and muting |
| 3143 | */ |
| 3144 | /* set front pin widgets 0x14 for output */ |
| 3145 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3146 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3147 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3148 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3149 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3150 | /* Mic2 (as headphone out) for HP output */ |
| 3151 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3152 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3153 | /* Line In pin widget for input */ |
| 3154 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3155 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3156 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3158 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3159 | /* CD pin widget for input */ |
| 3160 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3161 | |
| 3162 | { } |
| 3163 | }; |
| 3164 | |
| 3165 | /* |
| 3166 | * 5-stack pin configuration: |
| 3167 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3168 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3169 | */ |
| 3170 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3171 | /* |
| 3172 | * preset connection lists of input pins |
| 3173 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3174 | */ |
| 3175 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3176 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3177 | |
| 3178 | /* |
| 3179 | * Set pin mode and muting |
| 3180 | */ |
| 3181 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3182 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3183 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3184 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3185 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3186 | /* unmute pins for output (no gain on this amp) */ |
| 3187 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3189 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3190 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3192 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3193 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3194 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3195 | /* Mic2 (as headphone out) for HP output */ |
| 3196 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3197 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3198 | /* Line In pin widget for input */ |
| 3199 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3200 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3201 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3202 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3203 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3204 | /* CD pin widget for input */ |
| 3205 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3206 | |
| 3207 | { } |
| 3208 | }; |
| 3209 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3210 | /* |
| 3211 | * W810 pin configuration: |
| 3212 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3213 | */ |
| 3214 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3215 | /* hphone/speaker input selector: front DAC */ |
| 3216 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3217 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3221 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3222 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3223 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3224 | |
| 3225 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3226 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3227 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3228 | { } |
| 3229 | }; |
| 3230 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3231 | /* |
| 3232 | * Z71V pin configuration: |
| 3233 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3234 | */ |
| 3235 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3236 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3237 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3238 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3239 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3240 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3241 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3242 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3243 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3244 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3245 | |
| 3246 | { } |
| 3247 | }; |
| 3248 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3249 | /* |
| 3250 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3251 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3252 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3253 | */ |
| 3254 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3255 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3256 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3257 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3258 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3259 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3260 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3261 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3263 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3264 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3265 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3266 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3267 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3268 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3269 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3270 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3271 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3272 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3273 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3274 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3275 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3276 | { } |
| 3277 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3278 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3279 | /* |
| 3280 | * Uniwill pin configuration: |
| 3281 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3282 | * line = 0x1a |
| 3283 | */ |
| 3284 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3285 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3286 | |
| 3287 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3288 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3289 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3290 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3291 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3292 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3293 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3294 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3298 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3300 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3301 | |
| 3302 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3303 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3304 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3305 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3306 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3307 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3308 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3309 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3310 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3311 | |
| 3312 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3313 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3314 | |
| 3315 | { } |
| 3316 | }; |
| 3317 | |
| 3318 | /* |
| 3319 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3320 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3321 | */ |
| 3322 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3323 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3324 | |
| 3325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3326 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3327 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3328 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3329 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3330 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3332 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3333 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3334 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3335 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3336 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3337 | |
| 3338 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3339 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3340 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3341 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3342 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3343 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3344 | |
| 3345 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3346 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3347 | |
| 3348 | { } |
| 3349 | }; |
| 3350 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3351 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3352 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3353 | { } |
| 3354 | }; |
| 3355 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3356 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3357 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3358 | { |
| 3359 | unsigned int present; |
| 3360 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3361 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3362 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3363 | bits = present ? HDA_AMP_MUTE : 0; |
| 3364 | 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] | 3365 | } |
| 3366 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3367 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3368 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3369 | struct alc_spec *spec = codec->spec; |
| 3370 | |
| 3371 | spec->autocfg.hp_pins[0] = 0x14; |
| 3372 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3373 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3374 | } |
| 3375 | |
| 3376 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3377 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3378 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3379 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3380 | } |
| 3381 | |
| 3382 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3383 | unsigned int res) |
| 3384 | { |
| 3385 | /* Looks like the unsol event is incompatible with the standard |
| 3386 | * definition. 4bit tag is placed at 28 bit! |
| 3387 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3388 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3389 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3390 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3391 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3392 | default: |
| 3393 | alc_automute_amp_unsol_event(codec, res); |
| 3394 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3395 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3396 | } |
| 3397 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3398 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3399 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3400 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3401 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3402 | spec->autocfg.hp_pins[0] = 0x14; |
| 3403 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3404 | } |
| 3405 | |
| 3406 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3407 | { |
| 3408 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3409 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3410 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3411 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3412 | present &= HDA_AMP_VOLMASK; |
| 3413 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3414 | HDA_AMP_VOLMASK, present); |
| 3415 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3416 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3417 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3418 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3419 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3420 | unsigned int res) |
| 3421 | { |
| 3422 | /* Looks like the unsol event is incompatible with the standard |
| 3423 | * definition. 4bit tag is placed at 28 bit! |
| 3424 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3425 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3426 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3427 | else |
| 3428 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3429 | } |
| 3430 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3431 | /* |
| 3432 | * F1734 pin configuration: |
| 3433 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3434 | */ |
| 3435 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3436 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3437 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3438 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3439 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3440 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3441 | |
| 3442 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3443 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3444 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3445 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3446 | |
| 3447 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3448 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3449 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3450 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3451 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3452 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3453 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3454 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3455 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3456 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3457 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3458 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3459 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3460 | { } |
| 3461 | }; |
| 3462 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3463 | /* |
| 3464 | * ASUS pin configuration: |
| 3465 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3466 | */ |
| 3467 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3468 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3469 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3470 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3471 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3472 | |
| 3473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3474 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3475 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3476 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3477 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3478 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3479 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3480 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3481 | |
| 3482 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3484 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3485 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3486 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3488 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3489 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3490 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3491 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3492 | { } |
| 3493 | }; |
| 3494 | |
| 3495 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3496 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3497 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3498 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3500 | /* Clevo m520g init */ |
| 3501 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3502 | /* headphone output */ |
| 3503 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3504 | /* line-out */ |
| 3505 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3507 | /* Line-in */ |
| 3508 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3509 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3510 | /* CD */ |
| 3511 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3512 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3513 | /* Mic1 (rear panel) */ |
| 3514 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3515 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3516 | /* Mic2 (front panel) */ |
| 3517 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3518 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3519 | /* headphone */ |
| 3520 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3521 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3522 | /* change to EAPD mode */ |
| 3523 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3524 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3525 | |
| 3526 | { } |
| 3527 | }; |
| 3528 | |
| 3529 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3530 | /* change to EAPD mode */ |
| 3531 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3532 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3533 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3534 | /* Headphone output */ |
| 3535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3536 | /* Front output*/ |
| 3537 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3538 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3539 | |
| 3540 | /* Line In pin widget for input */ |
| 3541 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3542 | /* CD pin widget for input */ |
| 3543 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3544 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3545 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3546 | |
| 3547 | /* change to EAPD mode */ |
| 3548 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3549 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3550 | |
| 3551 | { } |
| 3552 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3553 | |
| 3554 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3555 | * LG m1 express dual |
| 3556 | * |
| 3557 | * Pin assignment: |
| 3558 | * Rear Line-In/Out (blue): 0x14 |
| 3559 | * Build-in Mic-In: 0x15 |
| 3560 | * Speaker-out: 0x17 |
| 3561 | * HP-Out (green): 0x1b |
| 3562 | * Mic-In/Out (red): 0x19 |
| 3563 | * SPDIF-Out: 0x1e |
| 3564 | */ |
| 3565 | |
| 3566 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3567 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3568 | 0x05, 0x02, 0x03 |
| 3569 | }; |
| 3570 | |
| 3571 | /* seems analog CD is not working */ |
| 3572 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3573 | .num_items = 3, |
| 3574 | .items = { |
| 3575 | { "Mic", 0x1 }, |
| 3576 | { "Line", 0x5 }, |
| 3577 | { "Internal Mic", 0x6 }, |
| 3578 | }, |
| 3579 | }; |
| 3580 | |
| 3581 | /* 2,4,6 channel modes */ |
| 3582 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3583 | /* set line-in and mic-in to input */ |
| 3584 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3585 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3586 | { } |
| 3587 | }; |
| 3588 | |
| 3589 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3590 | /* set line-in to out and mic-in to input */ |
| 3591 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3592 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3593 | { } |
| 3594 | }; |
| 3595 | |
| 3596 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3597 | /* set line-in and mic-in to output */ |
| 3598 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3599 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3600 | { } |
| 3601 | }; |
| 3602 | |
| 3603 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3604 | { 2, alc880_lg_ch2_init }, |
| 3605 | { 4, alc880_lg_ch4_init }, |
| 3606 | { 6, alc880_lg_ch6_init }, |
| 3607 | }; |
| 3608 | |
| 3609 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3610 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3611 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3612 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3613 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3614 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3615 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3616 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3617 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3620 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3621 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3622 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3623 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3624 | { |
| 3625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3626 | .name = "Channel Mode", |
| 3627 | .info = alc_ch_mode_info, |
| 3628 | .get = alc_ch_mode_get, |
| 3629 | .put = alc_ch_mode_put, |
| 3630 | }, |
| 3631 | { } /* end */ |
| 3632 | }; |
| 3633 | |
| 3634 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3635 | /* set capture source to mic-in */ |
| 3636 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3637 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3639 | /* mute all amp mixer inputs */ |
| 3640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3642 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3643 | /* line-in to input */ |
| 3644 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3645 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3646 | /* built-in mic */ |
| 3647 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3649 | /* speaker-out */ |
| 3650 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3651 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3652 | /* mic-in to input */ |
| 3653 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3654 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3655 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3656 | /* HP-out */ |
| 3657 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3658 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3659 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3660 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3661 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3662 | { } |
| 3663 | }; |
| 3664 | |
| 3665 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3666 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3667 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3668 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3669 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3670 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3671 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3672 | } |
| 3673 | |
| 3674 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3675 | * LG LW20 |
| 3676 | * |
| 3677 | * Pin assignment: |
| 3678 | * Speaker-out: 0x14 |
| 3679 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3680 | * Built-in Mic-In: 0x19 |
| 3681 | * Line-In: 0x1b |
| 3682 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3683 | * SPDIF-Out: 0x1e |
| 3684 | */ |
| 3685 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3686 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3687 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3688 | .items = { |
| 3689 | { "Mic", 0x0 }, |
| 3690 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3691 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3692 | }, |
| 3693 | }; |
| 3694 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3695 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3696 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3697 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3698 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3699 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3700 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3701 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3702 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3703 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3704 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3705 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3706 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3707 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3710 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3711 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3712 | { |
| 3713 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3714 | .name = "Channel Mode", |
| 3715 | .info = alc_ch_mode_info, |
| 3716 | .get = alc_ch_mode_get, |
| 3717 | .put = alc_ch_mode_put, |
| 3718 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3719 | { } /* end */ |
| 3720 | }; |
| 3721 | |
| 3722 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3723 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3724 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3725 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3726 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3727 | /* set capture source to mic-in */ |
| 3728 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3729 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3730 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3731 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3732 | /* speaker-out */ |
| 3733 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3734 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3735 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3736 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3737 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3738 | /* mic-in to input */ |
| 3739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3741 | /* built-in mic */ |
| 3742 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3743 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3744 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3745 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3746 | { } |
| 3747 | }; |
| 3748 | |
| 3749 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3750 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3751 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3752 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3753 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3754 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3755 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3756 | } |
| 3757 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3758 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3759 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3760 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3761 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3762 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3763 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3764 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3765 | { } /* end */ |
| 3766 | }; |
| 3767 | |
| 3768 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3769 | .num_items = 2, |
| 3770 | .items = { |
| 3771 | { "Mic", 0x0 }, |
| 3772 | { "Internal Mic", 0x1 }, |
| 3773 | }, |
| 3774 | }; |
| 3775 | |
| 3776 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3777 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3778 | |
| 3779 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3780 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3781 | |
| 3782 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3783 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3784 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3785 | /* Mic2 (as headphone out) for HP output */ |
| 3786 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3787 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3788 | /* Internal Speaker */ |
| 3789 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3790 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3791 | |
| 3792 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3793 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3794 | |
| 3795 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3796 | { } |
| 3797 | }; |
| 3798 | |
| 3799 | /* toggle speaker-output according to the hp-jack state */ |
| 3800 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3801 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3802 | struct alc_spec *spec = codec->spec; |
| 3803 | alc_automute_amp(codec); |
| 3804 | /* toggle EAPD */ |
| 3805 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3806 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3807 | else |
| 3808 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3809 | } |
| 3810 | |
| 3811 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3812 | unsigned int res) |
| 3813 | { |
| 3814 | /* Looks like the unsol event is incompatible with the standard |
| 3815 | * definition. 4bit tag is placed at 28 bit! |
| 3816 | */ |
| 3817 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3818 | alc880_medion_rim_automute(codec); |
| 3819 | } |
| 3820 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3821 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3822 | { |
| 3823 | struct alc_spec *spec = codec->spec; |
| 3824 | |
| 3825 | spec->autocfg.hp_pins[0] = 0x14; |
| 3826 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3827 | } |
| 3828 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3829 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3830 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3831 | { 0x0b, HDA_INPUT, 0 }, |
| 3832 | { 0x0b, HDA_INPUT, 1 }, |
| 3833 | { 0x0b, HDA_INPUT, 2 }, |
| 3834 | { 0x0b, HDA_INPUT, 3 }, |
| 3835 | { 0x0b, HDA_INPUT, 4 }, |
| 3836 | { } /* end */ |
| 3837 | }; |
| 3838 | |
| 3839 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3840 | { 0x0b, HDA_INPUT, 1 }, |
| 3841 | { 0x0b, HDA_INPUT, 6 }, |
| 3842 | { 0x0b, HDA_INPUT, 7 }, |
| 3843 | { } /* end */ |
| 3844 | }; |
| 3845 | #endif |
| 3846 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3847 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3848 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3849 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3850 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3851 | static void alc_init_special_input_src(struct hda_codec *codec); |
| 3852 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3853 | static int alc_init(struct hda_codec *codec) |
| 3854 | { |
| 3855 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3856 | unsigned int i; |
| 3857 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3858 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3859 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3860 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3861 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3862 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3863 | alc_init_special_input_src(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3864 | |
| 3865 | if (spec->init_hook) |
| 3866 | spec->init_hook(codec); |
| 3867 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3868 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3869 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3870 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3871 | return 0; |
| 3872 | } |
| 3873 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3874 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3875 | { |
| 3876 | struct alc_spec *spec = codec->spec; |
| 3877 | |
| 3878 | if (spec->unsol_event) |
| 3879 | spec->unsol_event(codec, res); |
| 3880 | } |
| 3881 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3882 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3883 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3884 | { |
| 3885 | struct alc_spec *spec = codec->spec; |
| 3886 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3887 | } |
| 3888 | #endif |
| 3889 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3890 | /* |
| 3891 | * Analog playback callbacks |
| 3892 | */ |
| 3893 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3894 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3895 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3896 | { |
| 3897 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3898 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3899 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3900 | } |
| 3901 | |
| 3902 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3903 | struct hda_codec *codec, |
| 3904 | unsigned int stream_tag, |
| 3905 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3906 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3907 | { |
| 3908 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3909 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3910 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3911 | } |
| 3912 | |
| 3913 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3914 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3915 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3916 | { |
| 3917 | struct alc_spec *spec = codec->spec; |
| 3918 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3919 | } |
| 3920 | |
| 3921 | /* |
| 3922 | * Digital out |
| 3923 | */ |
| 3924 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3925 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3926 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3927 | { |
| 3928 | struct alc_spec *spec = codec->spec; |
| 3929 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3930 | } |
| 3931 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3932 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3933 | struct hda_codec *codec, |
| 3934 | unsigned int stream_tag, |
| 3935 | unsigned int format, |
| 3936 | struct snd_pcm_substream *substream) |
| 3937 | { |
| 3938 | struct alc_spec *spec = codec->spec; |
| 3939 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3940 | stream_tag, format, substream); |
| 3941 | } |
| 3942 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3943 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3944 | struct hda_codec *codec, |
| 3945 | struct snd_pcm_substream *substream) |
| 3946 | { |
| 3947 | struct alc_spec *spec = codec->spec; |
| 3948 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3949 | } |
| 3950 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3951 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3952 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3953 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3954 | { |
| 3955 | struct alc_spec *spec = codec->spec; |
| 3956 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3957 | } |
| 3958 | |
| 3959 | /* |
| 3960 | * Analog capture |
| 3961 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3962 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3963 | struct hda_codec *codec, |
| 3964 | unsigned int stream_tag, |
| 3965 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3966 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3967 | { |
| 3968 | struct alc_spec *spec = codec->spec; |
| 3969 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3970 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3971 | stream_tag, 0, format); |
| 3972 | return 0; |
| 3973 | } |
| 3974 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3975 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3976 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3977 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3978 | { |
| 3979 | struct alc_spec *spec = codec->spec; |
| 3980 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3981 | snd_hda_codec_cleanup_stream(codec, |
| 3982 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3983 | return 0; |
| 3984 | } |
| 3985 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3986 | /* analog capture with dynamic dual-adc changes */ |
| 3987 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3988 | struct hda_codec *codec, |
| 3989 | unsigned int stream_tag, |
| 3990 | unsigned int format, |
| 3991 | struct snd_pcm_substream *substream) |
| 3992 | { |
| 3993 | struct alc_spec *spec = codec->spec; |
| 3994 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3995 | spec->cur_adc_stream_tag = stream_tag; |
| 3996 | spec->cur_adc_format = format; |
| 3997 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3998 | return 0; |
| 3999 | } |
| 4000 | |
| 4001 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4002 | struct hda_codec *codec, |
| 4003 | struct snd_pcm_substream *substream) |
| 4004 | { |
| 4005 | struct alc_spec *spec = codec->spec; |
| 4006 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4007 | spec->cur_adc = 0; |
| 4008 | return 0; |
| 4009 | } |
| 4010 | |
| 4011 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4012 | .substreams = 1, |
| 4013 | .channels_min = 2, |
| 4014 | .channels_max = 2, |
| 4015 | .nid = 0, /* fill later */ |
| 4016 | .ops = { |
| 4017 | .prepare = dualmic_capture_pcm_prepare, |
| 4018 | .cleanup = dualmic_capture_pcm_cleanup |
| 4019 | }, |
| 4020 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4021 | |
| 4022 | /* |
| 4023 | */ |
| 4024 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4025 | .substreams = 1, |
| 4026 | .channels_min = 2, |
| 4027 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4028 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4029 | .ops = { |
| 4030 | .open = alc880_playback_pcm_open, |
| 4031 | .prepare = alc880_playback_pcm_prepare, |
| 4032 | .cleanup = alc880_playback_pcm_cleanup |
| 4033 | }, |
| 4034 | }; |
| 4035 | |
| 4036 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4037 | .substreams = 1, |
| 4038 | .channels_min = 2, |
| 4039 | .channels_max = 2, |
| 4040 | /* NID is set in alc_build_pcms */ |
| 4041 | }; |
| 4042 | |
| 4043 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4044 | .substreams = 1, |
| 4045 | .channels_min = 2, |
| 4046 | .channels_max = 2, |
| 4047 | /* NID is set in alc_build_pcms */ |
| 4048 | }; |
| 4049 | |
| 4050 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4051 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4052 | .channels_min = 2, |
| 4053 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4054 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4055 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4056 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4057 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4058 | }, |
| 4059 | }; |
| 4060 | |
| 4061 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4062 | .substreams = 1, |
| 4063 | .channels_min = 2, |
| 4064 | .channels_max = 2, |
| 4065 | /* NID is set in alc_build_pcms */ |
| 4066 | .ops = { |
| 4067 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4068 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4069 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4070 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4071 | }, |
| 4072 | }; |
| 4073 | |
| 4074 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4075 | .substreams = 1, |
| 4076 | .channels_min = 2, |
| 4077 | .channels_max = 2, |
| 4078 | /* NID is set in alc_build_pcms */ |
| 4079 | }; |
| 4080 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4081 | /* 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] | 4082 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4083 | .substreams = 0, |
| 4084 | .channels_min = 0, |
| 4085 | .channels_max = 0, |
| 4086 | }; |
| 4087 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4088 | static int alc_build_pcms(struct hda_codec *codec) |
| 4089 | { |
| 4090 | struct alc_spec *spec = codec->spec; |
| 4091 | struct hda_pcm *info = spec->pcm_rec; |
| 4092 | int i; |
| 4093 | |
| 4094 | codec->num_pcms = 1; |
| 4095 | codec->pcm_info = info; |
| 4096 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4097 | if (spec->no_analog) |
| 4098 | goto skip_analog; |
| 4099 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4100 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4101 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4102 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4103 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4104 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4105 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4106 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4107 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4108 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4109 | } |
| 4110 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4111 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4112 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4113 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4114 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4115 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4116 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4117 | if (spec->channel_mode) { |
| 4118 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4119 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4120 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4121 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4122 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4123 | } |
| 4124 | } |
| 4125 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4126 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4127 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4128 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4129 | snprintf(spec->stream_name_digital, |
| 4130 | sizeof(spec->stream_name_digital), |
| 4131 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4132 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4133 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4134 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4135 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4136 | if (spec->dig_out_type) |
| 4137 | info->pcm_type = spec->dig_out_type; |
| 4138 | else |
| 4139 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4140 | if (spec->multiout.dig_out_nid && |
| 4141 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4142 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4143 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4144 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4145 | if (spec->dig_in_nid && |
| 4146 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4147 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4148 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4149 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4150 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4151 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4152 | } |
| 4153 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4154 | if (spec->no_analog) |
| 4155 | return 0; |
| 4156 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4157 | /* If the use of more than one ADC is requested for the current |
| 4158 | * model, configure a second analog capture-only PCM. |
| 4159 | */ |
| 4160 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4161 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4162 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4163 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4164 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4165 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4166 | if (spec->alt_dac_nid) { |
| 4167 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4168 | *spec->stream_analog_alt_playback; |
| 4169 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4170 | spec->alt_dac_nid; |
| 4171 | } else { |
| 4172 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4173 | alc_pcm_null_stream; |
| 4174 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4175 | } |
| 4176 | if (spec->num_adc_nids > 1) { |
| 4177 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4178 | *spec->stream_analog_alt_capture; |
| 4179 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4180 | spec->adc_nids[1]; |
| 4181 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4182 | spec->num_adc_nids - 1; |
| 4183 | } else { |
| 4184 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4185 | alc_pcm_null_stream; |
| 4186 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4187 | } |
| 4188 | } |
| 4189 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4190 | return 0; |
| 4191 | } |
| 4192 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4193 | static inline void alc_shutup(struct hda_codec *codec) |
| 4194 | { |
| 4195 | snd_hda_shutup_pins(codec); |
| 4196 | } |
| 4197 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4198 | static void alc_free_kctls(struct hda_codec *codec) |
| 4199 | { |
| 4200 | struct alc_spec *spec = codec->spec; |
| 4201 | |
| 4202 | if (spec->kctls.list) { |
| 4203 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4204 | int i; |
| 4205 | for (i = 0; i < spec->kctls.used; i++) |
| 4206 | kfree(kctl[i].name); |
| 4207 | } |
| 4208 | snd_array_free(&spec->kctls); |
| 4209 | } |
| 4210 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4211 | static void alc_free(struct hda_codec *codec) |
| 4212 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4214 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4215 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4216 | return; |
| 4217 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4218 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4219 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4220 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4221 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4222 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4223 | } |
| 4224 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4225 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4226 | static void alc_power_eapd(struct hda_codec *codec) |
| 4227 | { |
| 4228 | /* We currently only handle front, HP */ |
| 4229 | switch (codec->vendor_id) { |
| 4230 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4231 | set_eapd(codec, 0x0f, 0); |
| 4232 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4233 | break; |
| 4234 | case 0x10ec0262: |
| 4235 | case 0x10ec0267: |
| 4236 | case 0x10ec0268: |
| 4237 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4238 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4239 | case 0x10ec0272: |
| 4240 | case 0x10ec0660: |
| 4241 | case 0x10ec0662: |
| 4242 | case 0x10ec0663: |
| 4243 | case 0x10ec0862: |
| 4244 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4245 | set_eapd(codec, 0x14, 0); |
| 4246 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4247 | break; |
| 4248 | } |
| 4249 | } |
| 4250 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4251 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4252 | { |
| 4253 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4254 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4255 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4256 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4257 | return 0; |
| 4258 | } |
| 4259 | #endif |
| 4260 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4261 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4262 | static int alc_resume(struct hda_codec *codec) |
| 4263 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4264 | codec->patch_ops.init(codec); |
| 4265 | snd_hda_codec_resume_amp(codec); |
| 4266 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4267 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4268 | return 0; |
| 4269 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4270 | #endif |
| 4271 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4272 | /* |
| 4273 | */ |
| 4274 | static struct hda_codec_ops alc_patch_ops = { |
| 4275 | .build_controls = alc_build_controls, |
| 4276 | .build_pcms = alc_build_pcms, |
| 4277 | .init = alc_init, |
| 4278 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4279 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4280 | #ifdef SND_HDA_NEEDS_RESUME |
| 4281 | .resume = alc_resume, |
| 4282 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4283 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4284 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4285 | .check_power_status = alc_check_power_status, |
| 4286 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4287 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4288 | }; |
| 4289 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4290 | /* replace the codec chip_name with the given string */ |
| 4291 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4292 | { |
| 4293 | kfree(codec->chip_name); |
| 4294 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4295 | if (!codec->chip_name) { |
| 4296 | alc_free(codec); |
| 4297 | return -ENOMEM; |
| 4298 | } |
| 4299 | return 0; |
| 4300 | } |
| 4301 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4302 | /* |
| 4303 | * Test configuration for debugging |
| 4304 | * |
| 4305 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4306 | * enum controls. |
| 4307 | */ |
| 4308 | #ifdef CONFIG_SND_DEBUG |
| 4309 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4310 | 0x02, 0x03, 0x04, 0x05 |
| 4311 | }; |
| 4312 | |
| 4313 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4314 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4315 | .items = { |
| 4316 | { "In-1", 0x0 }, |
| 4317 | { "In-2", 0x1 }, |
| 4318 | { "In-3", 0x2 }, |
| 4319 | { "In-4", 0x3 }, |
| 4320 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4321 | { "Front", 0x5 }, |
| 4322 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4323 | }, |
| 4324 | }; |
| 4325 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4326 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4327 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4328 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4329 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4330 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4331 | }; |
| 4332 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4333 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4334 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4335 | { |
| 4336 | static char *texts[] = { |
| 4337 | "N/A", "Line Out", "HP Out", |
| 4338 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4339 | }; |
| 4340 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4341 | uinfo->count = 1; |
| 4342 | uinfo->value.enumerated.items = 8; |
| 4343 | if (uinfo->value.enumerated.item >= 8) |
| 4344 | uinfo->value.enumerated.item = 7; |
| 4345 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4346 | return 0; |
| 4347 | } |
| 4348 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4349 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4350 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4351 | { |
| 4352 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4353 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4354 | unsigned int pin_ctl, item = 0; |
| 4355 | |
| 4356 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4357 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4358 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4359 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4360 | item = 2; |
| 4361 | else |
| 4362 | item = 1; |
| 4363 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4364 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4365 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4366 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4367 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4368 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4369 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4370 | } |
| 4371 | } |
| 4372 | ucontrol->value.enumerated.item[0] = item; |
| 4373 | return 0; |
| 4374 | } |
| 4375 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4376 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4377 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4378 | { |
| 4379 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4380 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4381 | static unsigned int ctls[] = { |
| 4382 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4383 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4384 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4385 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4386 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4387 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4388 | }; |
| 4389 | unsigned int old_ctl, new_ctl; |
| 4390 | |
| 4391 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4392 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4393 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4394 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4395 | int val; |
| 4396 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4397 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4398 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4399 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4400 | HDA_AMP_MUTE : 0; |
| 4401 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4402 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4403 | return 1; |
| 4404 | } |
| 4405 | return 0; |
| 4406 | } |
| 4407 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4408 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4409 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4410 | { |
| 4411 | static char *texts[] = { |
| 4412 | "Front", "Surround", "CLFE", "Side" |
| 4413 | }; |
| 4414 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4415 | uinfo->count = 1; |
| 4416 | uinfo->value.enumerated.items = 4; |
| 4417 | if (uinfo->value.enumerated.item >= 4) |
| 4418 | uinfo->value.enumerated.item = 3; |
| 4419 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4420 | return 0; |
| 4421 | } |
| 4422 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4423 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4424 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4425 | { |
| 4426 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4427 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4428 | unsigned int sel; |
| 4429 | |
| 4430 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4431 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4432 | return 0; |
| 4433 | } |
| 4434 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4435 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4436 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4437 | { |
| 4438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4439 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4440 | unsigned int sel; |
| 4441 | |
| 4442 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4443 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4444 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4445 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4446 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4447 | return 1; |
| 4448 | } |
| 4449 | return 0; |
| 4450 | } |
| 4451 | |
| 4452 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4453 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4454 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4455 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4456 | .info = alc_test_pin_ctl_info, \ |
| 4457 | .get = alc_test_pin_ctl_get, \ |
| 4458 | .put = alc_test_pin_ctl_put, \ |
| 4459 | .private_value = nid \ |
| 4460 | } |
| 4461 | |
| 4462 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4463 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4464 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4465 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4466 | .info = alc_test_pin_src_info, \ |
| 4467 | .get = alc_test_pin_src_get, \ |
| 4468 | .put = alc_test_pin_src_put, \ |
| 4469 | .private_value = nid \ |
| 4470 | } |
| 4471 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4472 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4473 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4474 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4475 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4476 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4477 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4478 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4479 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4480 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4481 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4482 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4483 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4484 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4485 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4486 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4487 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4488 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4489 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4490 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4491 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4492 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4493 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4494 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4495 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4496 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4497 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4498 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4499 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4500 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4501 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4502 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4503 | { |
| 4504 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4505 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4506 | .info = alc_ch_mode_info, |
| 4507 | .get = alc_ch_mode_get, |
| 4508 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4509 | }, |
| 4510 | { } /* end */ |
| 4511 | }; |
| 4512 | |
| 4513 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4514 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4515 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4517 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4518 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4519 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4520 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4521 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4522 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4523 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4524 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4525 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4527 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4528 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4529 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4530 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4531 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4532 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4533 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4534 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4535 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4536 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4537 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4538 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4539 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4540 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4541 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4542 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4543 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4544 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4545 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4546 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4547 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4548 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4549 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4551 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4552 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4553 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4554 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4555 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4556 | /* Analog input/passthru */ |
| 4557 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4558 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4559 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4560 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4562 | { } |
| 4563 | }; |
| 4564 | #endif |
| 4565 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4566 | /* |
| 4567 | */ |
| 4568 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4569 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4570 | [ALC880_3ST] = "3stack", |
| 4571 | [ALC880_TCL_S700] = "tcl", |
| 4572 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4573 | [ALC880_CLEVO] = "clevo", |
| 4574 | [ALC880_5ST] = "5stack", |
| 4575 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4576 | [ALC880_W810] = "w810", |
| 4577 | [ALC880_Z71V] = "z71v", |
| 4578 | [ALC880_6ST] = "6stack", |
| 4579 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4580 | [ALC880_ASUS] = "asus", |
| 4581 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4582 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4583 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4584 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4585 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4586 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4587 | [ALC880_F1734] = "F1734", |
| 4588 | [ALC880_LG] = "lg", |
| 4589 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4590 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4591 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4592 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4593 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4594 | [ALC880_AUTO] = "auto", |
| 4595 | }; |
| 4596 | |
| 4597 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4598 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4599 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4600 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4601 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4602 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4603 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4604 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4605 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4606 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4607 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4608 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4609 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4610 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4611 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4612 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4613 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4614 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4615 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4616 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4617 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4618 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4619 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4620 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4621 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4622 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4623 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4624 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4625 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4626 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4627 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4628 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4629 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4630 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4631 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4632 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4633 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4634 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4635 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4636 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4637 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4638 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4639 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4640 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4641 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4642 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4643 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4644 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4645 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4646 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4647 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4648 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4649 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4650 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4651 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4652 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4653 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4654 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4655 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4656 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4657 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4658 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4659 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4660 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4661 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4662 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4663 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4664 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4665 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4666 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4667 | /* default Intel */ |
| 4668 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4669 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4670 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4671 | {} |
| 4672 | }; |
| 4673 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4674 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4675 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4676 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4677 | static struct alc_config_preset alc880_presets[] = { |
| 4678 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4679 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4680 | .init_verbs = { alc880_volume_init_verbs, |
| 4681 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4682 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4683 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4684 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4685 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4686 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4687 | .input_mux = &alc880_capture_source, |
| 4688 | }, |
| 4689 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4690 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4691 | .init_verbs = { alc880_volume_init_verbs, |
| 4692 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4693 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4694 | .dac_nids = alc880_dac_nids, |
| 4695 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4696 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4697 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4698 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4699 | .input_mux = &alc880_capture_source, |
| 4700 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4701 | [ALC880_TCL_S700] = { |
| 4702 | .mixers = { alc880_tcl_s700_mixer }, |
| 4703 | .init_verbs = { alc880_volume_init_verbs, |
| 4704 | alc880_pin_tcl_S700_init_verbs, |
| 4705 | alc880_gpio2_init_verbs }, |
| 4706 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4707 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4708 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4709 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4710 | .hp_nid = 0x03, |
| 4711 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4712 | .channel_mode = alc880_2_jack_modes, |
| 4713 | .input_mux = &alc880_capture_source, |
| 4714 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4715 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4716 | .mixers = { alc880_three_stack_mixer, |
| 4717 | alc880_five_stack_mixer}, |
| 4718 | .init_verbs = { alc880_volume_init_verbs, |
| 4719 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4720 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4721 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4722 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4723 | .channel_mode = alc880_fivestack_modes, |
| 4724 | .input_mux = &alc880_capture_source, |
| 4725 | }, |
| 4726 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4727 | .mixers = { alc880_three_stack_mixer, |
| 4728 | alc880_five_stack_mixer }, |
| 4729 | .init_verbs = { alc880_volume_init_verbs, |
| 4730 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4731 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4732 | .dac_nids = alc880_dac_nids, |
| 4733 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4734 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4735 | .channel_mode = alc880_fivestack_modes, |
| 4736 | .input_mux = &alc880_capture_source, |
| 4737 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4738 | [ALC880_6ST] = { |
| 4739 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4740 | .init_verbs = { alc880_volume_init_verbs, |
| 4741 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4742 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4743 | .dac_nids = alc880_6st_dac_nids, |
| 4744 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4745 | .channel_mode = alc880_sixstack_modes, |
| 4746 | .input_mux = &alc880_6stack_capture_source, |
| 4747 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4748 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4749 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4750 | .init_verbs = { alc880_volume_init_verbs, |
| 4751 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4752 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4753 | .dac_nids = alc880_6st_dac_nids, |
| 4754 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4755 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4756 | .channel_mode = alc880_sixstack_modes, |
| 4757 | .input_mux = &alc880_6stack_capture_source, |
| 4758 | }, |
| 4759 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4760 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4761 | .init_verbs = { alc880_volume_init_verbs, |
| 4762 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4763 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4764 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4765 | .dac_nids = alc880_w810_dac_nids, |
| 4766 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4767 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4768 | .channel_mode = alc880_w810_modes, |
| 4769 | .input_mux = &alc880_capture_source, |
| 4770 | }, |
| 4771 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4772 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4773 | .init_verbs = { alc880_volume_init_verbs, |
| 4774 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4775 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4776 | .dac_nids = alc880_z71v_dac_nids, |
| 4777 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4778 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4779 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4780 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4781 | .input_mux = &alc880_capture_source, |
| 4782 | }, |
| 4783 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4784 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4785 | .init_verbs = { alc880_volume_init_verbs, |
| 4786 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4787 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4788 | .dac_nids = alc880_f1734_dac_nids, |
| 4789 | .hp_nid = 0x02, |
| 4790 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4791 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4792 | .input_mux = &alc880_f1734_capture_source, |
| 4793 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4794 | .setup = alc880_uniwill_p53_setup, |
| 4795 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4796 | }, |
| 4797 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4798 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4799 | .init_verbs = { alc880_volume_init_verbs, |
| 4800 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4801 | alc880_gpio1_init_verbs }, |
| 4802 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4803 | .dac_nids = alc880_asus_dac_nids, |
| 4804 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4805 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4806 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4807 | .input_mux = &alc880_capture_source, |
| 4808 | }, |
| 4809 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4810 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4811 | .init_verbs = { alc880_volume_init_verbs, |
| 4812 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4813 | alc880_gpio1_init_verbs }, |
| 4814 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4815 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4816 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4817 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4818 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4819 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4820 | .input_mux = &alc880_capture_source, |
| 4821 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4822 | [ALC880_ASUS_DIG2] = { |
| 4823 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4824 | .init_verbs = { alc880_volume_init_verbs, |
| 4825 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4826 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4827 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4828 | .dac_nids = alc880_asus_dac_nids, |
| 4829 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4830 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4831 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4832 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4833 | .input_mux = &alc880_capture_source, |
| 4834 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4835 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4836 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4837 | .init_verbs = { alc880_volume_init_verbs, |
| 4838 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4839 | alc880_gpio1_init_verbs }, |
| 4840 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4841 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4842 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4843 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4844 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4845 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4846 | .input_mux = &alc880_capture_source, |
| 4847 | }, |
| 4848 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4849 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4850 | .init_verbs = { alc880_volume_init_verbs, |
| 4851 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4852 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4853 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4854 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4855 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4856 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4857 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4858 | .input_mux = &alc880_capture_source, |
| 4859 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4860 | [ALC880_UNIWILL] = { |
| 4861 | .mixers = { alc880_uniwill_mixer }, |
| 4862 | .init_verbs = { alc880_volume_init_verbs, |
| 4863 | alc880_uniwill_init_verbs }, |
| 4864 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4865 | .dac_nids = alc880_asus_dac_nids, |
| 4866 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4867 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4868 | .channel_mode = alc880_threestack_modes, |
| 4869 | .need_dac_fix = 1, |
| 4870 | .input_mux = &alc880_capture_source, |
| 4871 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4872 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4873 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4874 | }, |
| 4875 | [ALC880_UNIWILL_P53] = { |
| 4876 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4877 | .init_verbs = { alc880_volume_init_verbs, |
| 4878 | alc880_uniwill_p53_init_verbs }, |
| 4879 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4880 | .dac_nids = alc880_asus_dac_nids, |
| 4881 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4882 | .channel_mode = alc880_threestack_modes, |
| 4883 | .input_mux = &alc880_capture_source, |
| 4884 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4885 | .setup = alc880_uniwill_p53_setup, |
| 4886 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4887 | }, |
| 4888 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4889 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4890 | .init_verbs = { alc880_volume_init_verbs, |
| 4891 | alc880_uniwill_p53_init_verbs, |
| 4892 | alc880_beep_init_verbs }, |
| 4893 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4894 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4895 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4896 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4897 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4898 | .input_mux = &alc880_capture_source, |
| 4899 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4900 | .setup = alc880_uniwill_p53_setup, |
| 4901 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4902 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4903 | [ALC880_CLEVO] = { |
| 4904 | .mixers = { alc880_three_stack_mixer }, |
| 4905 | .init_verbs = { alc880_volume_init_verbs, |
| 4906 | alc880_pin_clevo_init_verbs }, |
| 4907 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4908 | .dac_nids = alc880_dac_nids, |
| 4909 | .hp_nid = 0x03, |
| 4910 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4911 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4912 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4913 | .input_mux = &alc880_capture_source, |
| 4914 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4915 | [ALC880_LG] = { |
| 4916 | .mixers = { alc880_lg_mixer }, |
| 4917 | .init_verbs = { alc880_volume_init_verbs, |
| 4918 | alc880_lg_init_verbs }, |
| 4919 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4920 | .dac_nids = alc880_lg_dac_nids, |
| 4921 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4922 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4923 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4924 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4925 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4926 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4927 | .setup = alc880_lg_setup, |
| 4928 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4929 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4930 | .loopbacks = alc880_lg_loopbacks, |
| 4931 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4932 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4933 | [ALC880_LG_LW] = { |
| 4934 | .mixers = { alc880_lg_lw_mixer }, |
| 4935 | .init_verbs = { alc880_volume_init_verbs, |
| 4936 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4937 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4938 | .dac_nids = alc880_dac_nids, |
| 4939 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4940 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4941 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4942 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4943 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4944 | .setup = alc880_lg_lw_setup, |
| 4945 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4946 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4947 | [ALC880_MEDION_RIM] = { |
| 4948 | .mixers = { alc880_medion_rim_mixer }, |
| 4949 | .init_verbs = { alc880_volume_init_verbs, |
| 4950 | alc880_medion_rim_init_verbs, |
| 4951 | alc_gpio2_init_verbs }, |
| 4952 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4953 | .dac_nids = alc880_dac_nids, |
| 4954 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4955 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4956 | .channel_mode = alc880_2_jack_modes, |
| 4957 | .input_mux = &alc880_medion_rim_capture_source, |
| 4958 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4959 | .setup = alc880_medion_rim_setup, |
| 4960 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4961 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4962 | #ifdef CONFIG_SND_DEBUG |
| 4963 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4964 | .mixers = { alc880_test_mixer }, |
| 4965 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4966 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4967 | .dac_nids = alc880_test_dac_nids, |
| 4968 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4969 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4970 | .channel_mode = alc880_test_modes, |
| 4971 | .input_mux = &alc880_test_capture_source, |
| 4972 | }, |
| 4973 | #endif |
| 4974 | }; |
| 4975 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4976 | /* |
| 4977 | * Automatic parse of I/O pins from the BIOS configuration |
| 4978 | */ |
| 4979 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4980 | enum { |
| 4981 | ALC_CTL_WIDGET_VOL, |
| 4982 | ALC_CTL_WIDGET_MUTE, |
| 4983 | ALC_CTL_BIND_MUTE, |
| 4984 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4985 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4986 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4987 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4988 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4989 | }; |
| 4990 | |
| 4991 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4992 | 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] | 4993 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4994 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4995 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4996 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4997 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4998 | knew = snd_array_new(&spec->kctls); |
| 4999 | if (!knew) |
| 5000 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5001 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5002 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5003 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5004 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5005 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5006 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5007 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5008 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5009 | return 0; |
| 5010 | } |
| 5011 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5012 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5013 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5014 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5015 | { |
| 5016 | char name[32]; |
| 5017 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5018 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5019 | } |
| 5020 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5021 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5022 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5023 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5024 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5025 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5026 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5027 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5028 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5029 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5030 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5031 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5032 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5033 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5034 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5035 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5036 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5037 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5038 | #define ALC880_PIN_CD_NID 0x1c |
| 5039 | |
| 5040 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5041 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5042 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5043 | { |
| 5044 | hda_nid_t nid; |
| 5045 | int assigned[4]; |
| 5046 | int i, j; |
| 5047 | |
| 5048 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5049 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5050 | |
| 5051 | /* check the pins hardwired to audio widget */ |
| 5052 | for (i = 0; i < cfg->line_outs; i++) { |
| 5053 | nid = cfg->line_out_pins[i]; |
| 5054 | if (alc880_is_fixed_pin(nid)) { |
| 5055 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5056 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5057 | assigned[idx] = 1; |
| 5058 | } |
| 5059 | } |
| 5060 | /* left pins can be connect to any audio widget */ |
| 5061 | for (i = 0; i < cfg->line_outs; i++) { |
| 5062 | nid = cfg->line_out_pins[i]; |
| 5063 | if (alc880_is_fixed_pin(nid)) |
| 5064 | continue; |
| 5065 | /* search for an empty channel */ |
| 5066 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5067 | if (!assigned[j]) { |
| 5068 | spec->multiout.dac_nids[i] = |
| 5069 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5070 | assigned[j] = 1; |
| 5071 | break; |
| 5072 | } |
| 5073 | } |
| 5074 | } |
| 5075 | spec->multiout.num_dacs = cfg->line_outs; |
| 5076 | return 0; |
| 5077 | } |
| 5078 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5079 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, |
| 5080 | bool can_be_master) |
| 5081 | { |
| 5082 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
| 5083 | return "Master"; |
| 5084 | |
| 5085 | switch (cfg->line_out_type) { |
| 5086 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5087 | if (cfg->line_outs == 1) |
| 5088 | return "Speaker"; |
| 5089 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5090 | case AUTO_PIN_HP_OUT: |
| 5091 | return "Headphone"; |
| 5092 | default: |
| 5093 | if (cfg->line_outs == 1) |
| 5094 | return "PCM"; |
| 5095 | break; |
| 5096 | } |
| 5097 | return NULL; |
| 5098 | } |
| 5099 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5100 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5101 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5102 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5103 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5104 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5105 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5106 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5107 | const char *pfx = alc_get_line_out_pfx(cfg, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5108 | hda_nid_t nid; |
| 5109 | int i, err; |
| 5110 | |
| 5111 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5112 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5113 | continue; |
| 5114 | 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] | 5115 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5116 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5117 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5118 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5119 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5120 | HDA_OUTPUT)); |
| 5121 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5122 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5123 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5124 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5125 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5126 | HDA_OUTPUT)); |
| 5127 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5128 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5129 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5130 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5131 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5132 | HDA_INPUT)); |
| 5133 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5134 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5135 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5136 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5137 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5138 | HDA_INPUT)); |
| 5139 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5140 | return err; |
| 5141 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5142 | const char *name = pfx; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5143 | int index = i; |
| 5144 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5145 | name = chname[i]; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5146 | index = 0; |
| 5147 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5148 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5149 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5150 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5151 | HDA_OUTPUT)); |
| 5152 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5153 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5154 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5155 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5156 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5157 | HDA_INPUT)); |
| 5158 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5159 | return err; |
| 5160 | } |
| 5161 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5162 | return 0; |
| 5163 | } |
| 5164 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5165 | /* add playback controls for speaker and HP outputs */ |
| 5166 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5167 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5168 | { |
| 5169 | hda_nid_t nid; |
| 5170 | int err; |
| 5171 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5172 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5173 | return 0; |
| 5174 | |
| 5175 | if (alc880_is_fixed_pin(pin)) { |
| 5176 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5177 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5178 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5179 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5180 | else |
| 5181 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5182 | /* control HP volume/switch on the output mixer amp */ |
| 5183 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5184 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5185 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5186 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5187 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5188 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5189 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5190 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5191 | return err; |
| 5192 | } else if (alc880_is_multi_pin(pin)) { |
| 5193 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5194 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5195 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5196 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5197 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5198 | return err; |
| 5199 | } |
| 5200 | return 0; |
| 5201 | } |
| 5202 | |
| 5203 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5204 | 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] | 5205 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5206 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5207 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5208 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5209 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5210 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5211 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5212 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5213 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5214 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5215 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5216 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5217 | return err; |
| 5218 | return 0; |
| 5219 | } |
| 5220 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5221 | 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] | 5222 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5223 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5224 | return (pincap & AC_PINCAP_IN) != 0; |
| 5225 | } |
| 5226 | |
| 5227 | /* create playback/capture controls for input pins */ |
| 5228 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5229 | const struct auto_pin_cfg *cfg, |
| 5230 | hda_nid_t mixer, |
| 5231 | hda_nid_t cap1, hda_nid_t cap2) |
| 5232 | { |
| 5233 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5234 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5235 | int i, err, idx, type_idx = 0; |
| 5236 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5237 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5238 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5239 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5240 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5241 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5242 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5243 | if (!alc_is_input_pin(codec, pin)) |
| 5244 | continue; |
| 5245 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5246 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5247 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5248 | type_idx++; |
| 5249 | else |
| 5250 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5251 | prev_label = label; |
| 5252 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5253 | if (mixer) { |
| 5254 | idx = get_connection_index(codec, mixer, pin); |
| 5255 | if (idx >= 0) { |
| 5256 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5257 | label, type_idx, |
| 5258 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5259 | if (err < 0) |
| 5260 | return err; |
| 5261 | } |
| 5262 | } |
| 5263 | |
| 5264 | if (!cap1) |
| 5265 | continue; |
| 5266 | idx = get_connection_index(codec, cap1, pin); |
| 5267 | if (idx < 0 && cap2) |
| 5268 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5269 | if (idx >= 0) |
| 5270 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5271 | } |
| 5272 | return 0; |
| 5273 | } |
| 5274 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5275 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5276 | const struct auto_pin_cfg *cfg) |
| 5277 | { |
| 5278 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5279 | } |
| 5280 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5281 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5282 | unsigned int pin_type) |
| 5283 | { |
| 5284 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5285 | pin_type); |
| 5286 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5287 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5288 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5289 | } |
| 5290 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5291 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5292 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5293 | int dac_idx) |
| 5294 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5295 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5296 | /* need the manual connection? */ |
| 5297 | if (alc880_is_multi_pin(nid)) { |
| 5298 | struct alc_spec *spec = codec->spec; |
| 5299 | int idx = alc880_multi_pin_idx(nid); |
| 5300 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5301 | AC_VERB_SET_CONNECT_SEL, |
| 5302 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5303 | } |
| 5304 | } |
| 5305 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5306 | static int get_pin_type(int line_out_type) |
| 5307 | { |
| 5308 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5309 | return PIN_HP; |
| 5310 | else |
| 5311 | return PIN_OUT; |
| 5312 | } |
| 5313 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5314 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5315 | { |
| 5316 | struct alc_spec *spec = codec->spec; |
| 5317 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5318 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5319 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5320 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5321 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5322 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5323 | } |
| 5324 | } |
| 5325 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5326 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5327 | { |
| 5328 | struct alc_spec *spec = codec->spec; |
| 5329 | hda_nid_t pin; |
| 5330 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5331 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5332 | if (pin) /* connect to front */ |
| 5333 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5334 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5335 | if (pin) /* connect to front */ |
| 5336 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5337 | } |
| 5338 | |
| 5339 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5340 | { |
| 5341 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5342 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5343 | int i; |
| 5344 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5345 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5346 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5347 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5348 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5349 | if (nid != ALC880_PIN_CD_NID && |
| 5350 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5351 | snd_hda_codec_write(codec, nid, 0, |
| 5352 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5353 | AMP_OUT_MUTE); |
| 5354 | } |
| 5355 | } |
| 5356 | } |
| 5357 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5358 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5359 | { |
| 5360 | struct alc_spec *spec = codec->spec; |
| 5361 | int c; |
| 5362 | |
| 5363 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5364 | unsigned int mux_idx; |
| 5365 | const struct hda_input_mux *imux; |
| 5366 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5367 | imux = &spec->input_mux[mux_idx]; |
| 5368 | if (!imux->num_items && mux_idx > 0) |
| 5369 | imux = &spec->input_mux[0]; |
| 5370 | if (imux) |
| 5371 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5372 | AC_VERB_SET_CONNECT_SEL, |
| 5373 | imux->items[0].index); |
| 5374 | } |
| 5375 | } |
| 5376 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5377 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5378 | /* return 1 if successful, 0 if the proper config is not found, |
| 5379 | * or a negative error code |
| 5380 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5381 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5382 | { |
| 5383 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5384 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5385 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5386 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5387 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5388 | alc880_ignore); |
| 5389 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5390 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5391 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5392 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5393 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5394 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5395 | if (err < 0) |
| 5396 | return err; |
| 5397 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5398 | if (err < 0) |
| 5399 | return err; |
| 5400 | err = alc880_auto_create_extra_out(spec, |
| 5401 | spec->autocfg.speaker_pins[0], |
| 5402 | "Speaker"); |
| 5403 | if (err < 0) |
| 5404 | return err; |
| 5405 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5406 | "Headphone"); |
| 5407 | if (err < 0) |
| 5408 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5409 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5410 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5411 | return err; |
| 5412 | |
| 5413 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5414 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5415 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5416 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5417 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5418 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5419 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5420 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5421 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5422 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5423 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5424 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5425 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5426 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5427 | return 1; |
| 5428 | } |
| 5429 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5430 | /* additional initialization for auto-configuration model */ |
| 5431 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5432 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5433 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5434 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5435 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5436 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5437 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5438 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5439 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5440 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5441 | } |
| 5442 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5443 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5444 | * one of two digital mic pins, e.g. on ALC272 |
| 5445 | */ |
| 5446 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5447 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5448 | struct alc_spec *spec = codec->spec; |
| 5449 | int i; |
| 5450 | |
| 5451 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5452 | hda_nid_t cap = spec->capsrc_nids ? |
| 5453 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5454 | int iidx, eidx; |
| 5455 | |
| 5456 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5457 | if (iidx < 0) |
| 5458 | continue; |
| 5459 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5460 | if (eidx < 0) |
| 5461 | continue; |
| 5462 | spec->int_mic.mux_idx = iidx; |
| 5463 | spec->ext_mic.mux_idx = eidx; |
| 5464 | if (spec->capsrc_nids) |
| 5465 | spec->capsrc_nids += i; |
| 5466 | spec->adc_nids += i; |
| 5467 | spec->num_adc_nids = 1; |
| 5468 | return; |
| 5469 | } |
| 5470 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5471 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5472 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5473 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5474 | } |
| 5475 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5476 | /* select or unmute the given capsrc route */ |
| 5477 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5478 | int idx) |
| 5479 | { |
| 5480 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5481 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5482 | HDA_AMP_MUTE, 0); |
| 5483 | } else { |
| 5484 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5485 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5486 | } |
| 5487 | } |
| 5488 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5489 | /* set the default connection to that pin */ |
| 5490 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5491 | { |
| 5492 | struct alc_spec *spec = codec->spec; |
| 5493 | int i; |
| 5494 | |
| 5495 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5496 | hda_nid_t cap = spec->capsrc_nids ? |
| 5497 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5498 | int idx; |
| 5499 | |
| 5500 | idx = get_connection_index(codec, cap, pin); |
| 5501 | if (idx < 0) |
| 5502 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5503 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5504 | return i; /* return the found index */ |
| 5505 | } |
| 5506 | return -1; /* not found */ |
| 5507 | } |
| 5508 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5509 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5510 | static void fixup_single_adc(struct hda_codec *codec) |
| 5511 | { |
| 5512 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5513 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5514 | int i; |
| 5515 | |
| 5516 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5517 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5518 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5519 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5520 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5521 | /* use only this ADC */ |
| 5522 | if (spec->capsrc_nids) |
| 5523 | spec->capsrc_nids += i; |
| 5524 | spec->adc_nids += i; |
| 5525 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5526 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5527 | } |
| 5528 | } |
| 5529 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5530 | /* initialize dual adcs */ |
| 5531 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5532 | { |
| 5533 | struct alc_spec *spec = codec->spec; |
| 5534 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5535 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5536 | } |
| 5537 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5538 | /* initialize some special cases for input sources */ |
| 5539 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5540 | { |
| 5541 | struct alc_spec *spec = codec->spec; |
| 5542 | if (spec->dual_adc_switch) |
| 5543 | fixup_dual_adc_switch(codec); |
| 5544 | else if (spec->single_input_src) |
| 5545 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5546 | } |
| 5547 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5548 | static void set_capture_mixer(struct hda_codec *codec) |
| 5549 | { |
| 5550 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5551 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5552 | { alc_capture_mixer_nosrc1, |
| 5553 | alc_capture_mixer_nosrc2, |
| 5554 | alc_capture_mixer_nosrc3 }, |
| 5555 | { alc_capture_mixer1, |
| 5556 | alc_capture_mixer2, |
| 5557 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5558 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5559 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5560 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5561 | int num_adcs = spec->num_adc_nids; |
| 5562 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5563 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5564 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5565 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5566 | else if (spec->input_mux) { |
| 5567 | if (spec->input_mux->num_items > 1) |
| 5568 | mux = 1; |
| 5569 | else if (spec->input_mux->num_items == 1) |
| 5570 | fixup_single_adc(codec); |
| 5571 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5572 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5573 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5574 | } |
| 5575 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5576 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5577 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5578 | int num_nids) |
| 5579 | { |
| 5580 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5581 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5582 | int n; |
| 5583 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5584 | |
| 5585 | for (n = 0; n < num_nids; n++) { |
| 5586 | hda_nid_t adc, cap; |
| 5587 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5588 | int nconns, i, j; |
| 5589 | |
| 5590 | adc = nids[n]; |
| 5591 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5592 | continue; |
| 5593 | cap = adc; |
| 5594 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5595 | ARRAY_SIZE(conn)); |
| 5596 | if (nconns == 1) { |
| 5597 | cap = conn[0]; |
| 5598 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5599 | ARRAY_SIZE(conn)); |
| 5600 | } |
| 5601 | if (nconns <= 0) |
| 5602 | continue; |
| 5603 | if (!fallback_adc) { |
| 5604 | fallback_adc = adc; |
| 5605 | fallback_cap = cap; |
| 5606 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5607 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5608 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5609 | for (j = 0; j < nconns; j++) { |
| 5610 | if (conn[j] == nid) |
| 5611 | break; |
| 5612 | } |
| 5613 | if (j >= nconns) |
| 5614 | break; |
| 5615 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5616 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5617 | int num_adcs = spec->num_adc_nids; |
| 5618 | spec->private_adc_nids[num_adcs] = adc; |
| 5619 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5620 | spec->num_adc_nids++; |
| 5621 | spec->adc_nids = spec->private_adc_nids; |
| 5622 | if (adc != cap) |
| 5623 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5624 | } |
| 5625 | } |
| 5626 | if (!spec->num_adc_nids) { |
| 5627 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5628 | " using fallback 0x%x\n", |
| 5629 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5630 | spec->private_adc_nids[0] = fallback_adc; |
| 5631 | spec->adc_nids = spec->private_adc_nids; |
| 5632 | if (fallback_adc != fallback_cap) { |
| 5633 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5634 | spec->capsrc_nids = spec->private_adc_nids; |
| 5635 | } |
| 5636 | } |
| 5637 | } |
| 5638 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5639 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5640 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5641 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5642 | |
| 5643 | static struct snd_pci_quirk beep_white_list[] = { |
| 5644 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5645 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5646 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5647 | {} |
| 5648 | }; |
| 5649 | |
| 5650 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5651 | { |
| 5652 | struct alc_spec *spec = codec->spec; |
| 5653 | const struct snd_pci_quirk *q; |
| 5654 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5655 | if (q) |
| 5656 | return q->value; |
| 5657 | return spec->cdefine.enable_pcbeep; |
| 5658 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5659 | #else |
| 5660 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5661 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5662 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5663 | |
| 5664 | /* |
| 5665 | * OK, here we have finally the patch for ALC880 |
| 5666 | */ |
| 5667 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5668 | static int patch_alc880(struct hda_codec *codec) |
| 5669 | { |
| 5670 | struct alc_spec *spec; |
| 5671 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5672 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5673 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5674 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5675 | if (spec == NULL) |
| 5676 | return -ENOMEM; |
| 5677 | |
| 5678 | codec->spec = spec; |
| 5679 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5680 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5681 | alc880_models, |
| 5682 | alc880_cfg_tbl); |
| 5683 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5684 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5685 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5686 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5687 | } |
| 5688 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5689 | if (board_config == ALC880_AUTO) { |
| 5690 | /* automatic parse from the BIOS config */ |
| 5691 | err = alc880_parse_auto_config(codec); |
| 5692 | if (err < 0) { |
| 5693 | alc_free(codec); |
| 5694 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5695 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5696 | printk(KERN_INFO |
| 5697 | "hda_codec: Cannot set up configuration " |
| 5698 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5699 | board_config = ALC880_3ST; |
| 5700 | } |
| 5701 | } |
| 5702 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5703 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5704 | if (err < 0) { |
| 5705 | alc_free(codec); |
| 5706 | return err; |
| 5707 | } |
| 5708 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5709 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5710 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5711 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5712 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5713 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5714 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5715 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5716 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5717 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5718 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5719 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5720 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5721 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5722 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5723 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5724 | if (wcap != AC_WID_AUD_IN) { |
| 5725 | spec->adc_nids = alc880_adc_nids_alt; |
| 5726 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5727 | } else { |
| 5728 | spec->adc_nids = alc880_adc_nids; |
| 5729 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5730 | } |
| 5731 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5732 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5733 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5734 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5735 | spec->vmaster_nid = 0x0c; |
| 5736 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5737 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5738 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5739 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5740 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5741 | if (!spec->loopback.amplist) |
| 5742 | spec->loopback.amplist = alc880_loopbacks; |
| 5743 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5744 | |
| 5745 | return 0; |
| 5746 | } |
| 5747 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5748 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5749 | /* |
| 5750 | * ALC260 support |
| 5751 | */ |
| 5752 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5753 | static hda_nid_t alc260_dac_nids[1] = { |
| 5754 | /* front */ |
| 5755 | 0x02, |
| 5756 | }; |
| 5757 | |
| 5758 | static hda_nid_t alc260_adc_nids[1] = { |
| 5759 | /* ADC0 */ |
| 5760 | 0x04, |
| 5761 | }; |
| 5762 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5763 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5764 | /* ADC1 */ |
| 5765 | 0x05, |
| 5766 | }; |
| 5767 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5768 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5769 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5770 | */ |
| 5771 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5772 | /* ADC0, ADC1 */ |
| 5773 | 0x04, 0x05 |
| 5774 | }; |
| 5775 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5776 | #define ALC260_DIGOUT_NID 0x03 |
| 5777 | #define ALC260_DIGIN_NID 0x06 |
| 5778 | |
| 5779 | static struct hda_input_mux alc260_capture_source = { |
| 5780 | .num_items = 4, |
| 5781 | .items = { |
| 5782 | { "Mic", 0x0 }, |
| 5783 | { "Front Mic", 0x1 }, |
| 5784 | { "Line", 0x2 }, |
| 5785 | { "CD", 0x4 }, |
| 5786 | }, |
| 5787 | }; |
| 5788 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5789 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5790 | * headphone jack and the internal CD lines since these are the only pins at |
| 5791 | * which audio can appear. For flexibility, also allow the option of |
| 5792 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5793 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5794 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5795 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5796 | { |
| 5797 | .num_items = 3, |
| 5798 | .items = { |
| 5799 | { "Mic/Line", 0x0 }, |
| 5800 | { "CD", 0x4 }, |
| 5801 | { "Headphone", 0x2 }, |
| 5802 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5803 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5804 | { |
| 5805 | .num_items = 4, |
| 5806 | .items = { |
| 5807 | { "Mic/Line", 0x0 }, |
| 5808 | { "CD", 0x4 }, |
| 5809 | { "Headphone", 0x2 }, |
| 5810 | { "Mixer", 0x5 }, |
| 5811 | }, |
| 5812 | }, |
| 5813 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5814 | }; |
| 5815 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5816 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5817 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5818 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5819 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5820 | { |
| 5821 | .num_items = 4, |
| 5822 | .items = { |
| 5823 | { "Mic", 0x0 }, |
| 5824 | { "Line", 0x2 }, |
| 5825 | { "CD", 0x4 }, |
| 5826 | { "Headphone", 0x5 }, |
| 5827 | }, |
| 5828 | }, |
| 5829 | { |
| 5830 | .num_items = 5, |
| 5831 | .items = { |
| 5832 | { "Mic", 0x0 }, |
| 5833 | { "Line", 0x2 }, |
| 5834 | { "CD", 0x4 }, |
| 5835 | { "Headphone", 0x6 }, |
| 5836 | { "Mixer", 0x5 }, |
| 5837 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5838 | }, |
| 5839 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5840 | |
| 5841 | /* Maxdata Favorit 100XS */ |
| 5842 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5843 | { |
| 5844 | .num_items = 2, |
| 5845 | .items = { |
| 5846 | { "Line/Mic", 0x0 }, |
| 5847 | { "CD", 0x4 }, |
| 5848 | }, |
| 5849 | }, |
| 5850 | { |
| 5851 | .num_items = 3, |
| 5852 | .items = { |
| 5853 | { "Line/Mic", 0x0 }, |
| 5854 | { "CD", 0x4 }, |
| 5855 | { "Mixer", 0x5 }, |
| 5856 | }, |
| 5857 | }, |
| 5858 | }; |
| 5859 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5860 | /* |
| 5861 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5862 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5863 | * element which allows changing the channel mode, so the verb list is |
| 5864 | * never used. |
| 5865 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5866 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5867 | { 2, NULL }, |
| 5868 | }; |
| 5869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | |
| 5871 | /* Mixer combinations |
| 5872 | * |
| 5873 | * basic: base_output + input + pc_beep + capture |
| 5874 | * HP: base_output + input + capture_alt |
| 5875 | * HP_3013: hp_3013 + input + capture |
| 5876 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5877 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5878 | */ |
| 5879 | |
| 5880 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5881 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5882 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5883 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5884 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5885 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5886 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5887 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5888 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5889 | |
| 5890 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5891 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5892 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5893 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5894 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5897 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5898 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5899 | { } /* end */ |
| 5900 | }; |
| 5901 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5902 | /* update HP, line and mono out pins according to the master switch */ |
| 5903 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5904 | hda_nid_t hp, hda_nid_t line, |
| 5905 | hda_nid_t mono) |
| 5906 | { |
| 5907 | struct alc_spec *spec = codec->spec; |
| 5908 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5909 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5910 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5911 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5912 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5913 | val); |
| 5914 | /* mono (speaker) depending on the HP jack sense */ |
| 5915 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5916 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5917 | val); |
| 5918 | } |
| 5919 | |
| 5920 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5921 | struct snd_ctl_elem_value *ucontrol) |
| 5922 | { |
| 5923 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5924 | struct alc_spec *spec = codec->spec; |
| 5925 | *ucontrol->value.integer.value = spec->master_sw; |
| 5926 | return 0; |
| 5927 | } |
| 5928 | |
| 5929 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5930 | struct snd_ctl_elem_value *ucontrol) |
| 5931 | { |
| 5932 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5933 | struct alc_spec *spec = codec->spec; |
| 5934 | int val = !!*ucontrol->value.integer.value; |
| 5935 | hda_nid_t hp, line, mono; |
| 5936 | |
| 5937 | if (val == spec->master_sw) |
| 5938 | return 0; |
| 5939 | spec->master_sw = val; |
| 5940 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5941 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5942 | mono = kcontrol->private_value & 0xff; |
| 5943 | alc260_hp_master_update(codec, hp, line, mono); |
| 5944 | return 1; |
| 5945 | } |
| 5946 | |
| 5947 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5948 | { |
| 5949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5950 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5951 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5952 | .info = snd_ctl_boolean_mono_info, |
| 5953 | .get = alc260_hp_master_sw_get, |
| 5954 | .put = alc260_hp_master_sw_put, |
| 5955 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5956 | }, |
| 5957 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5958 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5959 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5960 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5961 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5962 | HDA_OUTPUT), |
| 5963 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5964 | { } /* end */ |
| 5965 | }; |
| 5966 | |
| 5967 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5968 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5969 | {}, |
| 5970 | }; |
| 5971 | |
| 5972 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5973 | { |
| 5974 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5975 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5976 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5977 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5978 | } |
| 5979 | |
| 5980 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5981 | { |
| 5982 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5983 | alc260_hp_automute(codec); |
| 5984 | } |
| 5985 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5986 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5987 | { |
| 5988 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5989 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5990 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5991 | .info = snd_ctl_boolean_mono_info, |
| 5992 | .get = alc260_hp_master_sw_get, |
| 5993 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5994 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5995 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5997 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5998 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5999 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6000 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6001 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6002 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6003 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6004 | { } /* end */ |
| 6005 | }; |
| 6006 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6007 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6008 | .ops = &snd_hda_bind_vol, |
| 6009 | .values = { |
| 6010 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6011 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6012 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6013 | 0 |
| 6014 | }, |
| 6015 | }; |
| 6016 | |
| 6017 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6018 | .ops = &snd_hda_bind_sw, |
| 6019 | .values = { |
| 6020 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6021 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6022 | 0 |
| 6023 | }, |
| 6024 | }; |
| 6025 | |
| 6026 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6027 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6028 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6029 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6030 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6031 | { } /* end */ |
| 6032 | }; |
| 6033 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6034 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6035 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6036 | {}, |
| 6037 | }; |
| 6038 | |
| 6039 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 6040 | { |
| 6041 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6042 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6043 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6044 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6045 | } |
| 6046 | |
| 6047 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6048 | unsigned int res) |
| 6049 | { |
| 6050 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6051 | alc260_hp_3013_automute(codec); |
| 6052 | } |
| 6053 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6054 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6055 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6056 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6057 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6058 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6059 | bits); |
| 6060 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6061 | bits); |
| 6062 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6063 | bits); |
| 6064 | } |
| 6065 | |
| 6066 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6067 | unsigned int res) |
| 6068 | { |
| 6069 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6070 | alc260_hp_3012_automute(codec); |
| 6071 | } |
| 6072 | |
| 6073 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6074 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6075 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6076 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6077 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6078 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6079 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6080 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6081 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6082 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6083 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6084 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6085 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6086 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6087 | { } /* end */ |
| 6088 | }; |
| 6089 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6090 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6091 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6092 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6093 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6094 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6095 | * revisions available in early 2006. Therefore for now allow the |
| 6096 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6097 | * that the lack of mic bias for this NID is intentional we could change the |
| 6098 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6099 | * |
| 6100 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6101 | * don't appear to make the mic bias available from the "line" jack, even |
| 6102 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6103 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6104 | * and the output jack. If this turns out to be the case for all such |
| 6105 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6106 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6107 | * |
| 6108 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6109 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6110 | * controls for such models. On models without a "mono speaker" the control |
| 6111 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6112 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6113 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6114 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6115 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6116 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6117 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6118 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6119 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6120 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6121 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6122 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6125 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6126 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6127 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6128 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6129 | { } /* end */ |
| 6130 | }; |
| 6131 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6132 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6133 | */ |
| 6134 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6135 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6136 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6137 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6138 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6139 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6140 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6141 | { } /* end */ |
| 6142 | }; |
| 6143 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6144 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6145 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6146 | */ |
| 6147 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6148 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6149 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6151 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6152 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6153 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6154 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6155 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6157 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6158 | { } /* end */ |
| 6159 | }; |
| 6160 | |
| 6161 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6162 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6163 | */ |
| 6164 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6165 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6166 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6168 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6169 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6170 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6171 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6172 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6173 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6174 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6175 | { } /* end */ |
| 6176 | }; |
| 6177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6178 | /* |
| 6179 | * initialization verbs |
| 6180 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6181 | static struct hda_verb alc260_init_verbs[] = { |
| 6182 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6183 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6184 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6185 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6186 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6187 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6188 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6189 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6190 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6191 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6192 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6193 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6194 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6195 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6196 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6197 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6198 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6199 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6200 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6201 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6202 | /* set connection select to line in (default select for this ADC) */ |
| 6203 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6204 | /* mute capture amp left and right */ |
| 6205 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6206 | /* set connection select to line in (default select for this ADC) */ |
| 6207 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6208 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6209 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6210 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6211 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6212 | /* set vol=0 HP mixer amp left and right */ |
| 6213 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6214 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6215 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6216 | /* set vol=0 Mono mixer amp left and right */ |
| 6217 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6218 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6219 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6220 | /* unmute LINE-2 out pin */ |
| 6221 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6222 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6223 | * Line In 2 = 0x03 |
| 6224 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6225 | /* mute analog inputs */ |
| 6226 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6231 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6232 | /* mute Front out path */ |
| 6233 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6235 | /* mute Headphone out path */ |
| 6236 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6238 | /* mute Mono out path */ |
| 6239 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6240 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6241 | { } |
| 6242 | }; |
| 6243 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6244 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6245 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6246 | /* Headphone and output */ |
| 6247 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6248 | /* mono output */ |
| 6249 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6250 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6251 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6252 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6253 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6254 | /* Line In pin widget for input */ |
| 6255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6256 | /* Line-2 pin widget for output */ |
| 6257 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6258 | /* CD pin widget for input */ |
| 6259 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6260 | /* unmute amp left and right */ |
| 6261 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6262 | /* set connection select to line in (default select for this ADC) */ |
| 6263 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6264 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6266 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6267 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6268 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6270 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6271 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6272 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6273 | * Line In 2 = 0x03 |
| 6274 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6275 | /* mute analog inputs */ |
| 6276 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6281 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6282 | /* Unmute Front out path */ |
| 6283 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6284 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6285 | /* Unmute Headphone out path */ |
| 6286 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6287 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6288 | /* Unmute Mono out path */ |
| 6289 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6290 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6291 | { } |
| 6292 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6293 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6294 | |
| 6295 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6296 | /* Line out and output */ |
| 6297 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6298 | /* mono output */ |
| 6299 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6300 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6301 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6302 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6303 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6304 | /* Line In pin widget for input */ |
| 6305 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6306 | /* Headphone pin widget for output */ |
| 6307 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6308 | /* CD pin widget for input */ |
| 6309 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6310 | /* unmute amp left and right */ |
| 6311 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6312 | /* set connection select to line in (default select for this ADC) */ |
| 6313 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6314 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6316 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6317 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6318 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6320 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6321 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6322 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6323 | * Line In 2 = 0x03 |
| 6324 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6325 | /* mute analog inputs */ |
| 6326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6330 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6331 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6332 | /* Unmute Front out path */ |
| 6333 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6335 | /* Unmute Headphone out path */ |
| 6336 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6337 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6338 | /* Unmute Mono out path */ |
| 6339 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6340 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6341 | { } |
| 6342 | }; |
| 6343 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6344 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6345 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6346 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6347 | */ |
| 6348 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6349 | /* Disable all GPIOs */ |
| 6350 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6351 | /* Internal speaker is connected to headphone pin */ |
| 6352 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6353 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6354 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6355 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6356 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6357 | /* Ensure all other unused pins are disabled and muted. */ |
| 6358 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6359 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6360 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6361 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6362 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6363 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6364 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6365 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6366 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6367 | /* Disable digital (SPDIF) pins */ |
| 6368 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6369 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6370 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6371 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6372 | * when acting as an output. |
| 6373 | */ |
| 6374 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6375 | |
| 6376 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6379 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6380 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6381 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6382 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6383 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6384 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6385 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6386 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6387 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6388 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6389 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6390 | * If the pin mode is changed by the user the pin mode control will |
| 6391 | * take care of enabling the pin's input/output buffers as needed. |
| 6392 | * Therefore there's no need to enable the input buffer at this |
| 6393 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6394 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6395 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6396 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6397 | * mixer ctrl) |
| 6398 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6399 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6400 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6401 | /* Mute capture amp left and right */ |
| 6402 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6403 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6404 | * in (on mic1 pin) |
| 6405 | */ |
| 6406 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6407 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6408 | /* Do the same for the second ADC: mute capture input amp and |
| 6409 | * set ADC connection to line in (on mic1 pin) |
| 6410 | */ |
| 6411 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6412 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6413 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6414 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6416 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6417 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6418 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6419 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6420 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6422 | {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] | 6423 | |
| 6424 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6425 | }; |
| 6426 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6427 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6428 | * similar laptops (adapted from Fujitsu init verbs). |
| 6429 | */ |
| 6430 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6431 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6432 | * the headphone jack. Turn this on and rely on the standard mute |
| 6433 | * methods whenever the user wants to turn these outputs off. |
| 6434 | */ |
| 6435 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6436 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6437 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6438 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6439 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6440 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6441 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6442 | /* Line In jack is connected to Line1 pin */ |
| 6443 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6444 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6445 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6446 | /* Ensure all other unused pins are disabled and muted. */ |
| 6447 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6448 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6449 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6450 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6453 | /* Disable digital (SPDIF) pins */ |
| 6454 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6455 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6456 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6457 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6458 | * bus when acting as outputs. |
| 6459 | */ |
| 6460 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6461 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6462 | |
| 6463 | /* Start with output sum widgets muted and their output gains at min */ |
| 6464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6466 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6468 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6469 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6471 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6472 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6473 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6474 | /* Unmute Line-out pin widget amp left and right |
| 6475 | * (no equiv mixer ctrl) |
| 6476 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6477 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6478 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6479 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6480 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6481 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6482 | * will take care of enabling the pin's input/output buffers as needed. |
| 6483 | * Therefore there's no need to enable the input buffer at this |
| 6484 | * stage. |
| 6485 | */ |
| 6486 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6488 | |
| 6489 | /* Mute capture amp left and right */ |
| 6490 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6491 | /* Set ADC connection select to match default mixer setting - mic |
| 6492 | * (on mic1 pin) |
| 6493 | */ |
| 6494 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6495 | |
| 6496 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6497 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6498 | */ |
| 6499 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6500 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6501 | |
| 6502 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6506 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6509 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6510 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6511 | |
| 6512 | { } |
| 6513 | }; |
| 6514 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6515 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6516 | * (adapted from Acer init verbs). |
| 6517 | */ |
| 6518 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6519 | /* GPIO 0 enables the output jack. |
| 6520 | * Turn this on and rely on the standard mute |
| 6521 | * methods whenever the user wants to turn these outputs off. |
| 6522 | */ |
| 6523 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6524 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6525 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6526 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6527 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6528 | /* Ensure all other unused pins are disabled and muted. */ |
| 6529 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6530 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6531 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6532 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6533 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6534 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6536 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6537 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6538 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6539 | /* Disable digital (SPDIF) pins */ |
| 6540 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6541 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6542 | |
| 6543 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6544 | * bus when acting as outputs. |
| 6545 | */ |
| 6546 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6547 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6548 | |
| 6549 | /* Start with output sum widgets muted and their output gains at min */ |
| 6550 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6551 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6552 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6553 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6554 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6555 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6556 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6557 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6558 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6559 | |
| 6560 | /* Unmute Line-out pin widget amp left and right |
| 6561 | * (no equiv mixer ctrl) |
| 6562 | */ |
| 6563 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6564 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6565 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6566 | * will take care of enabling the pin's input/output buffers as needed. |
| 6567 | * Therefore there's no need to enable the input buffer at this |
| 6568 | * stage. |
| 6569 | */ |
| 6570 | {0x12, 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 |
| 6580 | * set ADC connection to mic to match ALSA's default state. |
| 6581 | */ |
| 6582 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6583 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 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 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6598 | static struct hda_verb alc260_will_verbs[] = { |
| 6599 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6600 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6601 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6602 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6603 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6604 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6605 | {} |
| 6606 | }; |
| 6607 | |
| 6608 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6609 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6610 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6611 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6612 | |
| 6613 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6614 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6615 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6616 | |
| 6617 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6618 | {} |
| 6619 | }; |
| 6620 | |
| 6621 | /* toggle speaker-output according to the hp-jack state */ |
| 6622 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6623 | { |
| 6624 | unsigned int present; |
| 6625 | |
| 6626 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6627 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6628 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6629 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6630 | AC_VERB_SET_GPIO_DATA, 1); |
| 6631 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6632 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6633 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6634 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6635 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6636 | AC_VERB_SET_GPIO_DATA, 0); |
| 6637 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6638 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6639 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6640 | } |
| 6641 | } |
| 6642 | |
| 6643 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6644 | unsigned int res) |
| 6645 | { |
| 6646 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6647 | alc260_replacer_672v_automute(codec); |
| 6648 | } |
| 6649 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6650 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6651 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6652 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6653 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6654 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6655 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6656 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6657 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6658 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6659 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6660 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6661 | {} |
| 6662 | }; |
| 6663 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6664 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6665 | * configuration. |
| 6666 | */ |
| 6667 | #ifdef CONFIG_SND_DEBUG |
| 6668 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6669 | 0x02, |
| 6670 | }; |
| 6671 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6672 | 0x04, 0x05, |
| 6673 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6674 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6675 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6676 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6677 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6678 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6679 | { |
| 6680 | .num_items = 7, |
| 6681 | .items = { |
| 6682 | { "MIC1 pin", 0x0 }, |
| 6683 | { "MIC2 pin", 0x1 }, |
| 6684 | { "LINE1 pin", 0x2 }, |
| 6685 | { "LINE2 pin", 0x3 }, |
| 6686 | { "CD pin", 0x4 }, |
| 6687 | { "LINE-OUT pin", 0x5 }, |
| 6688 | { "HP-OUT pin", 0x6 }, |
| 6689 | }, |
| 6690 | }, |
| 6691 | { |
| 6692 | .num_items = 8, |
| 6693 | .items = { |
| 6694 | { "MIC1 pin", 0x0 }, |
| 6695 | { "MIC2 pin", 0x1 }, |
| 6696 | { "LINE1 pin", 0x2 }, |
| 6697 | { "LINE2 pin", 0x3 }, |
| 6698 | { "CD pin", 0x4 }, |
| 6699 | { "Mixer", 0x5 }, |
| 6700 | { "LINE-OUT pin", 0x6 }, |
| 6701 | { "HP-OUT pin", 0x7 }, |
| 6702 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6703 | }, |
| 6704 | }; |
| 6705 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6706 | /* Output driver widgets */ |
| 6707 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6708 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6709 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6710 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6711 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6712 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6713 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6714 | /* Modes for retasking pin widgets |
| 6715 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6716 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6717 | * mention this restriction. At this stage it's not clear whether |
| 6718 | * this behaviour is intentional or is a hardware bug in chip |
| 6719 | * revisions available at least up until early 2006. Therefore for |
| 6720 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6721 | * choices, but if it turns out that the lack of mic bias for these |
| 6722 | * NIDs is intentional we could change their modes from |
| 6723 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6724 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6725 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6726 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6727 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6728 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6729 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6730 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6731 | |
| 6732 | /* Loopback mixer controls */ |
| 6733 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6734 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6735 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6736 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6737 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6738 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6739 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6740 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6741 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6742 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6743 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6744 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6745 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6746 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6747 | |
| 6748 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6749 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6750 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6751 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6752 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6753 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6754 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6755 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6756 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6757 | */ |
| 6758 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6759 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6760 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6761 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6762 | * this output to turn on an external amplifier. |
| 6763 | */ |
| 6764 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6765 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6766 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6767 | { } /* end */ |
| 6768 | }; |
| 6769 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6770 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6771 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6772 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6773 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6774 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6775 | /* Enable retasking pins as output, initially without power amp */ |
| 6776 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6777 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6778 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6779 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6780 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6781 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6782 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6783 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6784 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6785 | * payload also sets the generation to 0, output to be in "consumer" |
| 6786 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6787 | * control. |
| 6788 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6789 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6790 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6791 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6792 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6793 | * OUT1 sum bus when acting as an output. |
| 6794 | */ |
| 6795 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6796 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6797 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6798 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6799 | |
| 6800 | /* Start with output sum widgets muted and their output gains at min */ |
| 6801 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6803 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6804 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6805 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6806 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6807 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6808 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6809 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6810 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6811 | /* Unmute retasking pin widget output buffers since the default |
| 6812 | * state appears to be output. As the pin mode is changed by the |
| 6813 | * user the pin mode control will take care of enabling the pin's |
| 6814 | * input/output buffers as needed. |
| 6815 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6816 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6817 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6818 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6819 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6820 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6821 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6822 | /* Also unmute the mono-out pin widget */ |
| 6823 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6824 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6825 | /* Mute capture amp left and right */ |
| 6826 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6827 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6828 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6829 | */ |
| 6830 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6831 | |
| 6832 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6833 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6834 | */ |
| 6835 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6836 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6837 | |
| 6838 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6839 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6840 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6841 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6842 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6843 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6844 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6845 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6846 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6847 | |
| 6848 | { } |
| 6849 | }; |
| 6850 | #endif |
| 6851 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6852 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6853 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6854 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6855 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6856 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6857 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6858 | /* |
| 6859 | * for BIOS auto-configuration |
| 6860 | */ |
| 6861 | |
| 6862 | 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] | 6863 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6864 | { |
| 6865 | hda_nid_t nid_vol; |
| 6866 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6867 | int err; |
| 6868 | |
| 6869 | if (nid >= 0x0f && nid < 0x11) { |
| 6870 | nid_vol = nid - 0x7; |
| 6871 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6872 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6873 | } else if (nid == 0x11) { |
| 6874 | nid_vol = nid - 0x7; |
| 6875 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6876 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6877 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6878 | nid_vol = 0x08; |
| 6879 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6880 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6881 | } else |
| 6882 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6883 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6884 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6885 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6886 | 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] | 6887 | if (err < 0) |
| 6888 | return err; |
| 6889 | *vol_bits |= (1 << nid_vol); |
| 6890 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6891 | 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] | 6892 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6893 | return err; |
| 6894 | return 1; |
| 6895 | } |
| 6896 | |
| 6897 | /* add playback controls from the parsed DAC table */ |
| 6898 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6899 | const struct auto_pin_cfg *cfg) |
| 6900 | { |
| 6901 | hda_nid_t nid; |
| 6902 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6903 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6904 | |
| 6905 | spec->multiout.num_dacs = 1; |
| 6906 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6907 | spec->multiout.dac_nids[0] = 0x02; |
| 6908 | |
| 6909 | nid = cfg->line_out_pins[0]; |
| 6910 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6911 | const char *pfx; |
| 6912 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6913 | pfx = "Master"; |
| 6914 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6915 | pfx = "Speaker"; |
| 6916 | else |
| 6917 | pfx = "Front"; |
| 6918 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6919 | if (err < 0) |
| 6920 | return err; |
| 6921 | } |
| 6922 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6923 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6924 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6925 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6926 | if (err < 0) |
| 6927 | return err; |
| 6928 | } |
| 6929 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6930 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6931 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6932 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6933 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6934 | if (err < 0) |
| 6935 | return err; |
| 6936 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6937 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6938 | } |
| 6939 | |
| 6940 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6941 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6942 | const struct auto_pin_cfg *cfg) |
| 6943 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6944 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6945 | } |
| 6946 | |
| 6947 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6948 | hda_nid_t nid, int pin_type, |
| 6949 | int sel_idx) |
| 6950 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6951 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6952 | /* need the manual connection? */ |
| 6953 | if (nid >= 0x12) { |
| 6954 | int idx = nid - 0x12; |
| 6955 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6956 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6957 | } |
| 6958 | } |
| 6959 | |
| 6960 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6961 | { |
| 6962 | struct alc_spec *spec = codec->spec; |
| 6963 | hda_nid_t nid; |
| 6964 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6965 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6966 | if (nid) { |
| 6967 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6968 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6969 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6970 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6971 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6972 | if (nid) |
| 6973 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6974 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6975 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6976 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6977 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6978 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6979 | |
| 6980 | #define ALC260_PIN_CD_NID 0x16 |
| 6981 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6982 | { |
| 6983 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6984 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6985 | int i; |
| 6986 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6987 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6988 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6989 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 6990 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6991 | if (nid != ALC260_PIN_CD_NID && |
| 6992 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6993 | snd_hda_codec_write(codec, nid, 0, |
| 6994 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6995 | AMP_OUT_MUTE); |
| 6996 | } |
| 6997 | } |
| 6998 | } |
| 6999 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7000 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7001 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7002 | /* |
| 7003 | * generic initialization of ADC, input mixers and output mixers |
| 7004 | */ |
| 7005 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7006 | /* |
| 7007 | * Unmute ADC0-1 and set the default input to mic-in |
| 7008 | */ |
| 7009 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7010 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7011 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7012 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7013 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7014 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7015 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7016 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7017 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7018 | */ |
| 7019 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7020 | /* mute analog inputs */ |
| 7021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7022 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7026 | |
| 7027 | /* |
| 7028 | * Set up output mixers (0x08 - 0x0a) |
| 7029 | */ |
| 7030 | /* set vol=0 to output mixers */ |
| 7031 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7032 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7033 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7034 | /* set up input amps for analog loopback */ |
| 7035 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7036 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7037 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7038 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7039 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7040 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7041 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7042 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7043 | { } |
| 7044 | }; |
| 7045 | |
| 7046 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7047 | { |
| 7048 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7049 | int err; |
| 7050 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7051 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7052 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7053 | alc260_ignore); |
| 7054 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7055 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7056 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7057 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7058 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7059 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7060 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7061 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7062 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7063 | return err; |
| 7064 | |
| 7065 | spec->multiout.max_channels = 2; |
| 7066 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7067 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7068 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7069 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7070 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7071 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7072 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7073 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7074 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7075 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7076 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7077 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7078 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7079 | return 1; |
| 7080 | } |
| 7081 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7082 | /* additional initialization for auto-configuration model */ |
| 7083 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7084 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7085 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7086 | alc260_auto_init_multi_out(codec); |
| 7087 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7088 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7089 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7090 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7091 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7092 | } |
| 7093 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7094 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7095 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7096 | { 0x07, HDA_INPUT, 0 }, |
| 7097 | { 0x07, HDA_INPUT, 1 }, |
| 7098 | { 0x07, HDA_INPUT, 2 }, |
| 7099 | { 0x07, HDA_INPUT, 3 }, |
| 7100 | { 0x07, HDA_INPUT, 4 }, |
| 7101 | { } /* end */ |
| 7102 | }; |
| 7103 | #endif |
| 7104 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7105 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7106 | * Pin config fixes |
| 7107 | */ |
| 7108 | enum { |
| 7109 | PINFIX_HP_DC5750, |
| 7110 | }; |
| 7111 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7112 | static const struct alc_fixup alc260_fixups[] = { |
| 7113 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7114 | .type = ALC_FIXUP_PINS, |
| 7115 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7116 | { 0x11, 0x90130110 }, /* speaker */ |
| 7117 | { } |
| 7118 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7119 | }, |
| 7120 | }; |
| 7121 | |
| 7122 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7123 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7124 | {} |
| 7125 | }; |
| 7126 | |
| 7127 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7128 | * ALC260 configurations |
| 7129 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7130 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7131 | [ALC260_BASIC] = "basic", |
| 7132 | [ALC260_HP] = "hp", |
| 7133 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7134 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7135 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7136 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7137 | [ALC260_WILL] = "will", |
| 7138 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7139 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7140 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7141 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7142 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7143 | [ALC260_AUTO] = "auto", |
| 7144 | }; |
| 7145 | |
| 7146 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7147 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7148 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7149 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7150 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7151 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7152 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7153 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7154 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7155 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7156 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7157 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7158 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7159 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7160 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7161 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7162 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7163 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7164 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7165 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7166 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7167 | {} |
| 7168 | }; |
| 7169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7170 | static struct alc_config_preset alc260_presets[] = { |
| 7171 | [ALC260_BASIC] = { |
| 7172 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7173 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7174 | .init_verbs = { alc260_init_verbs }, |
| 7175 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7176 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7177 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7178 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7179 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7180 | .channel_mode = alc260_modes, |
| 7181 | .input_mux = &alc260_capture_source, |
| 7182 | }, |
| 7183 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7184 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7185 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7186 | .init_verbs = { alc260_init_verbs, |
| 7187 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7188 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7189 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7190 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7191 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7192 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7193 | .channel_mode = alc260_modes, |
| 7194 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7195 | .unsol_event = alc260_hp_unsol_event, |
| 7196 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7197 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7198 | [ALC260_HP_DC7600] = { |
| 7199 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7200 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7201 | .init_verbs = { alc260_init_verbs, |
| 7202 | alc260_hp_dc7600_verbs }, |
| 7203 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7204 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7205 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7206 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7207 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7208 | .channel_mode = alc260_modes, |
| 7209 | .input_mux = &alc260_capture_source, |
| 7210 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7211 | .init_hook = alc260_hp_3012_automute, |
| 7212 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7213 | [ALC260_HP_3013] = { |
| 7214 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7215 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7216 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7217 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7218 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7219 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7220 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7221 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7222 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7223 | .channel_mode = alc260_modes, |
| 7224 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7225 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7226 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7227 | }, |
| 7228 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7229 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7230 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7231 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7232 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7233 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7234 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7235 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7236 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7237 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7238 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7239 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7240 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7241 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7242 | .init_verbs = { alc260_acer_init_verbs }, |
| 7243 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7244 | .dac_nids = alc260_dac_nids, |
| 7245 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7246 | .adc_nids = alc260_dual_adc_nids, |
| 7247 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7248 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7249 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7250 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7251 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7252 | [ALC260_FAVORIT100] = { |
| 7253 | .mixers = { alc260_favorit100_mixer }, |
| 7254 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7255 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7256 | .dac_nids = alc260_dac_nids, |
| 7257 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7258 | .adc_nids = alc260_dual_adc_nids, |
| 7259 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7260 | .channel_mode = alc260_modes, |
| 7261 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7262 | .input_mux = alc260_favorit100_capture_sources, |
| 7263 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7264 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7265 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7266 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7267 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7268 | .dac_nids = alc260_dac_nids, |
| 7269 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7270 | .adc_nids = alc260_adc_nids, |
| 7271 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7272 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7273 | .channel_mode = alc260_modes, |
| 7274 | .input_mux = &alc260_capture_source, |
| 7275 | }, |
| 7276 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7277 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7278 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7279 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7280 | .dac_nids = alc260_dac_nids, |
| 7281 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7282 | .adc_nids = alc260_adc_nids, |
| 7283 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7284 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7285 | .channel_mode = alc260_modes, |
| 7286 | .input_mux = &alc260_capture_source, |
| 7287 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7288 | .init_hook = alc260_replacer_672v_automute, |
| 7289 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7290 | #ifdef CONFIG_SND_DEBUG |
| 7291 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7292 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7293 | .init_verbs = { alc260_test_init_verbs }, |
| 7294 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7295 | .dac_nids = alc260_test_dac_nids, |
| 7296 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7297 | .adc_nids = alc260_test_adc_nids, |
| 7298 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7299 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7300 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7301 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7302 | }, |
| 7303 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7304 | }; |
| 7305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7306 | static int patch_alc260(struct hda_codec *codec) |
| 7307 | { |
| 7308 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7309 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7310 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7311 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7312 | if (spec == NULL) |
| 7313 | return -ENOMEM; |
| 7314 | |
| 7315 | codec->spec = spec; |
| 7316 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7317 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7318 | alc260_models, |
| 7319 | alc260_cfg_tbl); |
| 7320 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7321 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7322 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7323 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7324 | } |
| 7325 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7326 | if (board_config == ALC260_AUTO) { |
| 7327 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7328 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7329 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7330 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7331 | if (board_config == ALC260_AUTO) { |
| 7332 | /* automatic parse from the BIOS config */ |
| 7333 | err = alc260_parse_auto_config(codec); |
| 7334 | if (err < 0) { |
| 7335 | alc_free(codec); |
| 7336 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7337 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7338 | printk(KERN_INFO |
| 7339 | "hda_codec: Cannot set up configuration " |
| 7340 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7341 | board_config = ALC260_BASIC; |
| 7342 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7343 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7344 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7345 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7346 | if (err < 0) { |
| 7347 | alc_free(codec); |
| 7348 | return err; |
| 7349 | } |
| 7350 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7351 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7352 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7353 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7354 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7355 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7356 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7357 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7358 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7359 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7360 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7361 | if (!spec->adc_nids && spec->input_mux) { |
| 7362 | /* check whether NID 0x04 is valid */ |
| 7363 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7364 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7365 | /* get type */ |
| 7366 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7367 | spec->adc_nids = alc260_adc_nids_alt; |
| 7368 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7369 | } else { |
| 7370 | spec->adc_nids = alc260_adc_nids; |
| 7371 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7372 | } |
| 7373 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7374 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7375 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7376 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7377 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7378 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7379 | spec->vmaster_nid = 0x08; |
| 7380 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7381 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7382 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7383 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7384 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7385 | if (!spec->loopback.amplist) |
| 7386 | spec->loopback.amplist = alc260_loopbacks; |
| 7387 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7388 | |
| 7389 | return 0; |
| 7390 | } |
| 7391 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7392 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7393 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7394 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7395 | * |
| 7396 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7397 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7398 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7399 | * 6-channel independent captures. |
| 7400 | * |
| 7401 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7402 | * driver yet). |
| 7403 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7404 | #define ALC882_DIGOUT_NID 0x06 |
| 7405 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7406 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7407 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7408 | #define ALC1200_DIGOUT_NID 0x10 |
| 7409 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7410 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7411 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7412 | { 8, NULL } |
| 7413 | }; |
| 7414 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7415 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7416 | static hda_nid_t alc882_dac_nids[4] = { |
| 7417 | /* front, rear, clfe, rear_surr */ |
| 7418 | 0x02, 0x03, 0x04, 0x05 |
| 7419 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7420 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7421 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7422 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7423 | #define alc882_adc_nids alc880_adc_nids |
| 7424 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7425 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7426 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7427 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7428 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7429 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7430 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7431 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7432 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7433 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7434 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7436 | /* input MUX */ |
| 7437 | /* FIXME: should be a matrix-type input source selection */ |
| 7438 | |
| 7439 | static struct hda_input_mux alc882_capture_source = { |
| 7440 | .num_items = 4, |
| 7441 | .items = { |
| 7442 | { "Mic", 0x0 }, |
| 7443 | { "Front Mic", 0x1 }, |
| 7444 | { "Line", 0x2 }, |
| 7445 | { "CD", 0x4 }, |
| 7446 | }, |
| 7447 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7448 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7449 | #define alc883_capture_source alc882_capture_source |
| 7450 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7451 | static struct hda_input_mux alc889_capture_source = { |
| 7452 | .num_items = 3, |
| 7453 | .items = { |
| 7454 | { "Front Mic", 0x0 }, |
| 7455 | { "Mic", 0x3 }, |
| 7456 | { "Line", 0x2 }, |
| 7457 | }, |
| 7458 | }; |
| 7459 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7460 | static struct hda_input_mux mb5_capture_source = { |
| 7461 | .num_items = 3, |
| 7462 | .items = { |
| 7463 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7464 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7465 | { "CD", 0x4 }, |
| 7466 | }, |
| 7467 | }; |
| 7468 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7469 | static struct hda_input_mux macmini3_capture_source = { |
| 7470 | .num_items = 2, |
| 7471 | .items = { |
| 7472 | { "Line", 0x2 }, |
| 7473 | { "CD", 0x4 }, |
| 7474 | }, |
| 7475 | }; |
| 7476 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7477 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7478 | .num_items = 4, |
| 7479 | .items = { |
| 7480 | { "Mic", 0x1 }, |
| 7481 | { "Front Mic", 0x0 }, |
| 7482 | { "Line", 0x2 }, |
| 7483 | { "CD", 0x4 }, |
| 7484 | }, |
| 7485 | }; |
| 7486 | |
| 7487 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7488 | .num_items = 2, |
| 7489 | .items = { |
| 7490 | { "Mic", 0x1 }, |
| 7491 | { "Line", 0x2 }, |
| 7492 | }, |
| 7493 | }; |
| 7494 | |
| 7495 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7496 | .num_items = 4, |
| 7497 | .items = { |
| 7498 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7499 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7500 | { "Line", 0x2 }, |
| 7501 | { "CD", 0x4 }, |
| 7502 | }, |
| 7503 | }; |
| 7504 | |
| 7505 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7506 | .num_items = 2, |
| 7507 | .items = { |
| 7508 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7509 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7510 | }, |
| 7511 | }; |
| 7512 | |
| 7513 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7514 | .num_items = 3, |
| 7515 | .items = { |
| 7516 | { "Mic", 0x0 }, |
| 7517 | { "Front Mic", 0x1 }, |
| 7518 | { "Line", 0x4 }, |
| 7519 | }, |
| 7520 | }; |
| 7521 | |
| 7522 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7523 | .num_items = 2, |
| 7524 | .items = { |
| 7525 | { "Mic", 0x0 }, |
| 7526 | { "Line", 0x2 }, |
| 7527 | }, |
| 7528 | }; |
| 7529 | |
| 7530 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7531 | .num_items = 2, |
| 7532 | .items = { |
| 7533 | { "Mic", 0x0 }, |
| 7534 | /* Front Mic (0x01) unused */ |
| 7535 | { "Line", 0x2 }, |
| 7536 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7537 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7538 | }, |
| 7539 | }; |
| 7540 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7541 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7542 | .num_items = 2, |
| 7543 | .items = { |
| 7544 | { "Mic", 0x01 }, |
| 7545 | { "Line", 0x2 }, /* Not sure! */ |
| 7546 | }, |
| 7547 | }; |
| 7548 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7549 | /* |
| 7550 | * 2ch mode |
| 7551 | */ |
| 7552 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7553 | { 2, NULL } |
| 7554 | }; |
| 7555 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7556 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7557 | * 2ch mode |
| 7558 | */ |
| 7559 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7560 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7561 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7562 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7563 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7564 | { } /* end */ |
| 7565 | }; |
| 7566 | |
| 7567 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7568 | * 4ch mode |
| 7569 | */ |
| 7570 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7571 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7572 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7573 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7574 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7575 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7576 | { } /* end */ |
| 7577 | }; |
| 7578 | |
| 7579 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7580 | * 6ch mode |
| 7581 | */ |
| 7582 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7583 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7584 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7585 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7586 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7587 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7588 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7589 | { } /* end */ |
| 7590 | }; |
| 7591 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7592 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7593 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7594 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7595 | { 6, alc882_3ST_ch6_init }, |
| 7596 | }; |
| 7597 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7598 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7599 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7600 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7601 | * 2ch mode |
| 7602 | */ |
| 7603 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7604 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7605 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7606 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7607 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7608 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7609 | { } /* end */ |
| 7610 | }; |
| 7611 | |
| 7612 | /* |
| 7613 | * 4ch mode |
| 7614 | */ |
| 7615 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7616 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7617 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7618 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7619 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7620 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7621 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7622 | { } /* end */ |
| 7623 | }; |
| 7624 | |
| 7625 | /* |
| 7626 | * 6ch mode |
| 7627 | */ |
| 7628 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7629 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7630 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7631 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7632 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7635 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7636 | { } /* end */ |
| 7637 | }; |
| 7638 | |
| 7639 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7640 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7641 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7642 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7643 | }; |
| 7644 | |
| 7645 | |
| 7646 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7647 | * 6ch mode |
| 7648 | */ |
| 7649 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7650 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7651 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7652 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7653 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7654 | { } /* end */ |
| 7655 | }; |
| 7656 | |
| 7657 | /* |
| 7658 | * 8ch mode |
| 7659 | */ |
| 7660 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7661 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7662 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7663 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7664 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7665 | { } /* end */ |
| 7666 | }; |
| 7667 | |
| 7668 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7669 | { 6, alc882_sixstack_ch6_init }, |
| 7670 | { 8, alc882_sixstack_ch8_init }, |
| 7671 | }; |
| 7672 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7673 | |
| 7674 | /* Macbook Air 2,1 */ |
| 7675 | |
| 7676 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7677 | { 2, NULL }, |
| 7678 | }; |
| 7679 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7680 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7681 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7682 | */ |
| 7683 | |
| 7684 | /* |
| 7685 | * 2ch mode |
| 7686 | */ |
| 7687 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7688 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7689 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7690 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7691 | { } /* end */ |
| 7692 | }; |
| 7693 | |
| 7694 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7695 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7696 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7697 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7698 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7699 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7700 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7701 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7702 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7703 | { } /* end */ |
| 7704 | }; |
| 7705 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7706 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7707 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7708 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7709 | }; |
| 7710 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7711 | /* |
| 7712 | * 2ch |
| 7713 | * Speakers/Woofer/HP = Front |
| 7714 | * LineIn = Input |
| 7715 | */ |
| 7716 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7718 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7719 | { } /* end */ |
| 7720 | }; |
| 7721 | |
| 7722 | /* |
| 7723 | * 6ch mode |
| 7724 | * Speakers/HP = Front |
| 7725 | * Woofer = LFE |
| 7726 | * LineIn = Surround |
| 7727 | */ |
| 7728 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7731 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7732 | { } /* end */ |
| 7733 | }; |
| 7734 | |
| 7735 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7736 | { 2, alc885_mb5_ch2_init }, |
| 7737 | { 6, alc885_mb5_ch6_init }, |
| 7738 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7739 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7740 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7741 | |
| 7742 | /* |
| 7743 | * 2ch mode |
| 7744 | */ |
| 7745 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7746 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7747 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7748 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7749 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7750 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7751 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7752 | { } /* end */ |
| 7753 | }; |
| 7754 | |
| 7755 | /* |
| 7756 | * 4ch mode |
| 7757 | */ |
| 7758 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7759 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7760 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7761 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7762 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7763 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7764 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7765 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7766 | { } /* end */ |
| 7767 | }; |
| 7768 | |
| 7769 | /* |
| 7770 | * 6ch mode |
| 7771 | */ |
| 7772 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7773 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7774 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7775 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7776 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7777 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7778 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7779 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7780 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7781 | { } /* end */ |
| 7782 | }; |
| 7783 | |
| 7784 | /* |
| 7785 | * 8ch mode |
| 7786 | */ |
| 7787 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7788 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7789 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7790 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7791 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7792 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7793 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7794 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7795 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7796 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7797 | { } /* end */ |
| 7798 | }; |
| 7799 | |
| 7800 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7801 | { 2, alc883_4ST_ch2_init }, |
| 7802 | { 4, alc883_4ST_ch4_init }, |
| 7803 | { 6, alc883_4ST_ch6_init }, |
| 7804 | { 8, alc883_4ST_ch8_init }, |
| 7805 | }; |
| 7806 | |
| 7807 | |
| 7808 | /* |
| 7809 | * 2ch mode |
| 7810 | */ |
| 7811 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7812 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7813 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7814 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7815 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7816 | { } /* end */ |
| 7817 | }; |
| 7818 | |
| 7819 | /* |
| 7820 | * 4ch mode |
| 7821 | */ |
| 7822 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7823 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7824 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7825 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7826 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7827 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7828 | { } /* end */ |
| 7829 | }; |
| 7830 | |
| 7831 | /* |
| 7832 | * 6ch mode |
| 7833 | */ |
| 7834 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7835 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7836 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7837 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7838 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7839 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7840 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7841 | { } /* end */ |
| 7842 | }; |
| 7843 | |
| 7844 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7845 | { 2, alc883_3ST_ch2_intel_init }, |
| 7846 | { 4, alc883_3ST_ch4_intel_init }, |
| 7847 | { 6, alc883_3ST_ch6_intel_init }, |
| 7848 | }; |
| 7849 | |
| 7850 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7851 | * 2ch mode |
| 7852 | */ |
| 7853 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7854 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7855 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7856 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7857 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7858 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7859 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7860 | { } /* end */ |
| 7861 | }; |
| 7862 | |
| 7863 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7864 | * 6ch mode |
| 7865 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7866 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7867 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7868 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7869 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7870 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7871 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7872 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7873 | { } /* end */ |
| 7874 | }; |
| 7875 | |
| 7876 | /* |
| 7877 | * 8ch mode |
| 7878 | */ |
| 7879 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7880 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7881 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7882 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7883 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7884 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7885 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7886 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7887 | { } /* end */ |
| 7888 | }; |
| 7889 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7890 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7891 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7892 | { 6, alc889_ch6_intel_init }, |
| 7893 | { 8, alc889_ch8_intel_init }, |
| 7894 | }; |
| 7895 | |
| 7896 | /* |
| 7897 | * 6ch mode |
| 7898 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7899 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7900 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7901 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7902 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7903 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7904 | { } /* end */ |
| 7905 | }; |
| 7906 | |
| 7907 | /* |
| 7908 | * 8ch mode |
| 7909 | */ |
| 7910 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7911 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7912 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7913 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7914 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7915 | { } /* end */ |
| 7916 | }; |
| 7917 | |
| 7918 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7919 | { 6, alc883_sixstack_ch6_init }, |
| 7920 | { 8, alc883_sixstack_ch8_init }, |
| 7921 | }; |
| 7922 | |
| 7923 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7924 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7925 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7926 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7927 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7928 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7929 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7930 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7931 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7932 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7933 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7934 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7935 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7936 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7937 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7938 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7939 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7940 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7941 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7942 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7943 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7944 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7946 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7947 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7948 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7949 | { } /* end */ |
| 7950 | }; |
| 7951 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7952 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7953 | |
| 7954 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7955 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7956 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7957 | { } |
| 7958 | }; |
| 7959 | |
| 7960 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7961 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7962 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7963 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7964 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7965 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7966 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7968 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7970 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7971 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 7972 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7973 | { } /* end */ |
| 7974 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7975 | |
| 7976 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7977 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7978 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7980 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7982 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7983 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7984 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7985 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7986 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7987 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7988 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7989 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 7990 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7991 | { } /* end */ |
| 7992 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7993 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7994 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7995 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7996 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7997 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7998 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7999 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8000 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8001 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8002 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8003 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8004 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8005 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8006 | { } /* end */ |
| 8007 | }; |
| 8008 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8009 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8010 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8011 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8012 | { } /* end */ |
| 8013 | }; |
| 8014 | |
| 8015 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8016 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8017 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8018 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8019 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8020 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8021 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8022 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8024 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8025 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8026 | { } /* end */ |
| 8027 | }; |
| 8028 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8029 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8030 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8031 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8034 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8035 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8036 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8038 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8039 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8040 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8042 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8043 | { } /* end */ |
| 8044 | }; |
| 8045 | |
| 8046 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8047 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8048 | */ |
| 8049 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8050 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8051 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8052 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8053 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8055 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8057 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8058 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8059 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8062 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8063 | { } /* end */ |
| 8064 | }; |
| 8065 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8066 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8067 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8068 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8069 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8070 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8071 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8072 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8073 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8075 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8076 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8077 | { } /* end */ |
| 8078 | }; |
| 8079 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8080 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8081 | { |
| 8082 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8083 | .name = "Channel Mode", |
| 8084 | .info = alc_ch_mode_info, |
| 8085 | .get = alc_ch_mode_get, |
| 8086 | .put = alc_ch_mode_put, |
| 8087 | }, |
| 8088 | { } /* end */ |
| 8089 | }; |
| 8090 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8091 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8092 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8093 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8094 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8095 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8096 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8097 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8098 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8099 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8100 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8101 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8102 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8103 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8105 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8106 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8107 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8108 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8109 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8110 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8111 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8112 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8113 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8114 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8115 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8116 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8117 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8118 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8119 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8120 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8121 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8122 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8123 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8124 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8125 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8126 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8127 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8128 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8129 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8130 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8131 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8132 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8133 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8134 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8135 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8136 | |
| 8137 | /* FIXME: use matrix-type input source selection */ |
| 8138 | /* 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] | 8139 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8140 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8141 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8142 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8143 | /* ADC2: mute amp left and right */ |
| 8144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8145 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8146 | /* ADC3: mute amp left and right */ |
| 8147 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8148 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8149 | |
| 8150 | { } |
| 8151 | }; |
| 8152 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8153 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8154 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8155 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8156 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8157 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8158 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8159 | /* ADC1: mute amp left and right */ |
| 8160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8161 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8162 | { } |
| 8163 | }; |
| 8164 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8165 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8166 | /* change to EAPD mode */ |
| 8167 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8168 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8169 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8170 | }; |
| 8171 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8172 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8173 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8174 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8175 | { } |
| 8176 | }; |
| 8177 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8178 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8179 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8181 | {} |
| 8182 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8183 | |
| 8184 | static struct hda_verb alc885_init_verbs[] = { |
| 8185 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8186 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8187 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8188 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8189 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8190 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8191 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8192 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8193 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8194 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8195 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8196 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8197 | |
| 8198 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8199 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8201 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8202 | /* Front Pin: output 0 (0x0c) */ |
| 8203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8204 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8205 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8206 | /* Rear Pin: output 1 (0x0d) */ |
| 8207 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8208 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8209 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8210 | /* CLFE Pin: output 2 (0x0e) */ |
| 8211 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8212 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8213 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8214 | /* Side Pin: output 3 (0x0f) */ |
| 8215 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8216 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8217 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8218 | /* Mic (rear) pin: input vref at 80% */ |
| 8219 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8220 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8221 | /* Front Mic pin: input vref at 80% */ |
| 8222 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8223 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8224 | /* Line In pin: input */ |
| 8225 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8226 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8227 | |
| 8228 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8229 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8231 | /* Input mixer2 */ |
| 8232 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8233 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8234 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8235 | /* ADC2: mute amp left and right */ |
| 8236 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8237 | /* ADC3: mute amp left and right */ |
| 8238 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8239 | |
| 8240 | { } |
| 8241 | }; |
| 8242 | |
| 8243 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8245 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8246 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8247 | { } |
| 8248 | }; |
| 8249 | |
| 8250 | |
| 8251 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8252 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8253 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8255 | { } |
| 8256 | }; |
| 8257 | |
| 8258 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8259 | #define alc883_init_verbs alc882_base_init_verbs |
| 8260 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8261 | /* Mac Pro test */ |
| 8262 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8263 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8264 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8265 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8266 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8267 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8268 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8269 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8270 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8271 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8272 | { } /* end */ |
| 8273 | }; |
| 8274 | |
| 8275 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8276 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8277 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8280 | /* Front Pin: output 0 (0x0c) */ |
| 8281 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8282 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8283 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8284 | /* Front Mic pin: input vref at 80% */ |
| 8285 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8286 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8287 | /* Speaker: output */ |
| 8288 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8289 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8290 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8291 | /* Headphone output (output 0 - 0x0c) */ |
| 8292 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8293 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8294 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8295 | |
| 8296 | /* FIXME: use matrix-type input source selection */ |
| 8297 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8298 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8302 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8303 | /* Input mixer2 */ |
| 8304 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8308 | /* Input mixer3 */ |
| 8309 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8313 | /* ADC1: mute amp left and right */ |
| 8314 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8315 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8316 | /* ADC2: mute amp left and right */ |
| 8317 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8318 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8319 | /* ADC3: mute amp left and right */ |
| 8320 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8321 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8322 | |
| 8323 | { } |
| 8324 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8325 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8326 | /* Macbook 5,1 */ |
| 8327 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8328 | /* DACs */ |
| 8329 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8330 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8331 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8332 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8333 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8336 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8337 | /* Surround mixer */ |
| 8338 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8339 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8340 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8341 | /* LFE mixer */ |
| 8342 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8343 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8344 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8345 | /* HP mixer */ |
| 8346 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8347 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8348 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8349 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8350 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8351 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8352 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8353 | /* LFE Pin (0x0e) */ |
| 8354 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8355 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8356 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8357 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8358 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8359 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8360 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8361 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8362 | /* Front Mic pin: input vref at 80% */ |
| 8363 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8364 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8365 | /* Line In pin */ |
| 8366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8367 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8368 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8369 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8370 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8371 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8372 | { } |
| 8373 | }; |
| 8374 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8375 | /* Macmini 3,1 */ |
| 8376 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8377 | /* DACs */ |
| 8378 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8379 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8380 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8381 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8382 | /* Front mixer */ |
| 8383 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8384 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8386 | /* Surround mixer */ |
| 8387 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8388 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8389 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8390 | /* LFE mixer */ |
| 8391 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8392 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8393 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8394 | /* HP mixer */ |
| 8395 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8396 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8397 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8398 | /* Front Pin (0x0c) */ |
| 8399 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8400 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8401 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8402 | /* LFE Pin (0x0e) */ |
| 8403 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8404 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8405 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8406 | /* HP Pin (0x0f) */ |
| 8407 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8408 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8409 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8410 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8411 | /* Line In pin */ |
| 8412 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8413 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8414 | |
| 8415 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8416 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8417 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8418 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8419 | { } |
| 8420 | }; |
| 8421 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8422 | |
| 8423 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8424 | /*Internal and HP Speaker Mixer*/ |
| 8425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8426 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8427 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8428 | /*Internal Speaker Pin (0x0c)*/ |
| 8429 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8430 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8431 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8432 | /* HP Pin: output 0 (0x0e) */ |
| 8433 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8434 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8435 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8436 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8437 | /* Line in (is hp when jack connected)*/ |
| 8438 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8439 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8440 | |
| 8441 | { } |
| 8442 | }; |
| 8443 | |
| 8444 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8445 | /* Macbook Pro rev3 */ |
| 8446 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8447 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8448 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8449 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8450 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8451 | /* Rear mixer */ |
| 8452 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8453 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8454 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8455 | /* HP mixer */ |
| 8456 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8457 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8458 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8459 | /* Front Pin: output 0 (0x0c) */ |
| 8460 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8461 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8462 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8463 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8465 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8466 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8467 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8468 | /* Mic (rear) pin: input vref at 80% */ |
| 8469 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8470 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8471 | /* Front Mic pin: input vref at 80% */ |
| 8472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8473 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8474 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8475 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8476 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8477 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8478 | |
| 8479 | /* FIXME: use matrix-type input source selection */ |
| 8480 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8481 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8482 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8483 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8484 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8485 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8486 | /* Input mixer2 */ |
| 8487 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8490 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8491 | /* Input mixer3 */ |
| 8492 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8496 | /* ADC1: mute amp left and right */ |
| 8497 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8498 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8499 | /* ADC2: mute amp left and right */ |
| 8500 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8501 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8502 | /* ADC3: mute amp left and right */ |
| 8503 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8504 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8505 | |
| 8506 | { } |
| 8507 | }; |
| 8508 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8509 | /* iMac 9,1 */ |
| 8510 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8511 | /* Internal Speaker Pin (0x0c) */ |
| 8512 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8513 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8514 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8515 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8516 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8517 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8518 | /* HP Pin: Rear */ |
| 8519 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8520 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8521 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8522 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8523 | /* Line in Rear */ |
| 8524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8525 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8526 | /* Front Mic pin: input vref at 80% */ |
| 8527 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8528 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8529 | /* Rear mixer */ |
| 8530 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8531 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8532 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8533 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8534 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8537 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8538 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8539 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8540 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8542 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8543 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8544 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8545 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8547 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8548 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8549 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8550 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8551 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8552 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8554 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8555 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8556 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8557 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8558 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8559 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8560 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8561 | { } |
| 8562 | }; |
| 8563 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8564 | /* iMac 24 mixer. */ |
| 8565 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8566 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8567 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8568 | { } /* end */ |
| 8569 | }; |
| 8570 | |
| 8571 | /* iMac 24 init verbs. */ |
| 8572 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8573 | /* Internal speakers: output 0 (0x0c) */ |
| 8574 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8575 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8576 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8577 | /* Internal speakers: output 0 (0x0c) */ |
| 8578 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8579 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8580 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8581 | /* Headphone: output 0 (0x0c) */ |
| 8582 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8583 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8584 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8585 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8586 | /* Front Mic: input vref at 80% */ |
| 8587 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8588 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8589 | { } |
| 8590 | }; |
| 8591 | |
| 8592 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8593 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8594 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8595 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8596 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8597 | spec->autocfg.hp_pins[0] = 0x14; |
| 8598 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8599 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8600 | } |
| 8601 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8602 | #define alc885_mb5_setup alc885_imac24_setup |
| 8603 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8604 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8605 | /* Macbook Air 2,1 */ |
| 8606 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8607 | { |
| 8608 | struct alc_spec *spec = codec->spec; |
| 8609 | |
| 8610 | spec->autocfg.hp_pins[0] = 0x14; |
| 8611 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8612 | } |
| 8613 | |
| 8614 | |
| 8615 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8616 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8617 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8618 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8619 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8620 | spec->autocfg.hp_pins[0] = 0x15; |
| 8621 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8622 | } |
| 8623 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8624 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8625 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8626 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8627 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8628 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8629 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8630 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8631 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8632 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8633 | static struct hda_verb alc882_targa_verbs[] = { |
| 8634 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8636 | |
| 8637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8638 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8639 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8640 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8641 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8642 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8643 | |
| 8644 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8645 | { } /* end */ |
| 8646 | }; |
| 8647 | |
| 8648 | /* toggle speaker-output according to the hp-jack state */ |
| 8649 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8650 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8651 | struct alc_spec *spec = codec->spec; |
| 8652 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8653 | 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] | 8654 | spec->jack_present ? 1 : 3); |
| 8655 | } |
| 8656 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8657 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8658 | { |
| 8659 | struct alc_spec *spec = codec->spec; |
| 8660 | |
| 8661 | spec->autocfg.hp_pins[0] = 0x14; |
| 8662 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8663 | } |
| 8664 | |
| 8665 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8666 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8667 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8668 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8669 | } |
| 8670 | |
| 8671 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8672 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8673 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8674 | |
| 8675 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8676 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8677 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8678 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8679 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8680 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8681 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8682 | |
| 8683 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8684 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8685 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8686 | { } /* end */ |
| 8687 | }; |
| 8688 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8689 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8691 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8692 | |
| 8693 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8694 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8695 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8696 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8697 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8698 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8699 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8700 | |
| 8701 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8702 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8703 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8704 | { } /* end */ |
| 8705 | }; |
| 8706 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8707 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8708 | { |
| 8709 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8710 | |
| 8711 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8712 | AC_VERB_GET_GPIO_DATA, 0); |
| 8713 | |
| 8714 | if (!muted) |
| 8715 | gpiostate |= (1 << pin); |
| 8716 | else |
| 8717 | gpiostate &= ~(1 << pin); |
| 8718 | |
| 8719 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8720 | AC_VERB_GET_GPIO_MASK, 0); |
| 8721 | gpiomask |= (1 << pin); |
| 8722 | |
| 8723 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8724 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8725 | gpiodir |= (1 << pin); |
| 8726 | |
| 8727 | |
| 8728 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8729 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8730 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8731 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8732 | |
| 8733 | msleep(1); |
| 8734 | |
| 8735 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8736 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8737 | } |
| 8738 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8739 | /* set up GPIO at initialization */ |
| 8740 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8741 | { |
| 8742 | alc882_gpio_mute(codec, 0, 0); |
| 8743 | alc882_gpio_mute(codec, 1, 0); |
| 8744 | } |
| 8745 | |
| 8746 | /* set up GPIO and update auto-muting at initialization */ |
| 8747 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8748 | { |
| 8749 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8750 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8751 | } |
| 8752 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8753 | /* |
| 8754 | * generic initialization of ADC, input mixers and output mixers |
| 8755 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8756 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8757 | /* |
| 8758 | * Unmute ADC0-2 and set the default input to mic-in |
| 8759 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8760 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8761 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8762 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8763 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8764 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8765 | /* |
| 8766 | * Set up output mixers (0x0c - 0x0f) |
| 8767 | */ |
| 8768 | /* set vol=0 to output mixers */ |
| 8769 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8770 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8771 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8772 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8773 | /* set up input amps for analog loopback */ |
| 8774 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8775 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8776 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8777 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8778 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8779 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8782 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8783 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8784 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8785 | |
| 8786 | /* FIXME: use matrix-type input source selection */ |
| 8787 | /* 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] | 8788 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8789 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8790 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8791 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8792 | { } |
| 8793 | }; |
| 8794 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8795 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8796 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8797 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8798 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8799 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8800 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8801 | { } /* end */ |
| 8802 | }; |
| 8803 | |
| 8804 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8805 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8807 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8808 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8809 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8810 | { } /* end */ |
| 8811 | }; |
| 8812 | |
| 8813 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8814 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8815 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8816 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8817 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8818 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8819 | { } /* end */ |
| 8820 | }; |
| 8821 | |
| 8822 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8823 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8824 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8825 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8826 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8827 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8828 | { } /* end */ |
| 8829 | }; |
| 8830 | |
| 8831 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8832 | { 2, alc889A_mb31_ch2_init }, |
| 8833 | { 4, alc889A_mb31_ch4_init }, |
| 8834 | { 5, alc889A_mb31_ch5_init }, |
| 8835 | { 6, alc889A_mb31_ch6_init }, |
| 8836 | }; |
| 8837 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8838 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8839 | /* eanable EAPD on medion laptop */ |
| 8840 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8841 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8842 | { } |
| 8843 | }; |
| 8844 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8845 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8846 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8847 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8848 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8849 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8850 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8851 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8852 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8853 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8856 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8858 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8859 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8860 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8861 | { } /* end */ |
| 8862 | }; |
| 8863 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8864 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8865 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8866 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8867 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8868 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8869 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8870 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8872 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8873 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8874 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8875 | { } /* end */ |
| 8876 | }; |
| 8877 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8878 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8879 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8880 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8881 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8882 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8883 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8884 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8886 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8887 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8888 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8889 | { } /* end */ |
| 8890 | }; |
| 8891 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8892 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8894 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8896 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8897 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8898 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8899 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8900 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8901 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8903 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8904 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8905 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8906 | { } /* end */ |
| 8907 | }; |
| 8908 | |
| 8909 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8910 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8911 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8912 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8913 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8914 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8915 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8916 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8917 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8918 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8919 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8920 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8921 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8922 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8924 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8926 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8927 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8928 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8929 | { } /* end */ |
| 8930 | }; |
| 8931 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8932 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8933 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8934 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8935 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8936 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8937 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8938 | HDA_OUTPUT), |
| 8939 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8940 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8941 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8942 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8943 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8944 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8945 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8946 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8947 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8948 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8950 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8951 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8952 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8953 | { } /* end */ |
| 8954 | }; |
| 8955 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8956 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8957 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8958 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8959 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8960 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8961 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8962 | HDA_OUTPUT), |
| 8963 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8964 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8965 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8966 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8967 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8972 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8974 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8975 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8976 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8977 | { } /* end */ |
| 8978 | }; |
| 8979 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8980 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8981 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8982 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8983 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8984 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8985 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8986 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8987 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8988 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8989 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8990 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8991 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8992 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8993 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8994 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8995 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8997 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8998 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8999 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9000 | { } /* end */ |
| 9001 | }; |
| 9002 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9003 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9004 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9005 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9006 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9007 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9008 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9009 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9010 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9011 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9012 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9013 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9014 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9015 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9016 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9017 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9019 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9021 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9022 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9023 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9024 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9025 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9026 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9027 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9028 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9029 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9030 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9031 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9032 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9033 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9034 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9035 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9036 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9037 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9038 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9039 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9040 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9041 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9042 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9043 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9044 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9045 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9046 | { } /* end */ |
| 9047 | }; |
| 9048 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9049 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9050 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9051 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9052 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9053 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9054 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9055 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9056 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9057 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9058 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9059 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9060 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9061 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9062 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9063 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9064 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9065 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9066 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9067 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9068 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9069 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9070 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9071 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9072 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9073 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9074 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9075 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9076 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9077 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9078 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9079 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9080 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9081 | { } /* end */ |
| 9082 | }; |
| 9083 | |
| 9084 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9085 | /* Unmute front mixer */ |
| 9086 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9087 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9088 | |
| 9089 | /* Set speaker pin to front mixer */ |
| 9090 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9091 | |
| 9092 | /* Init headphone pin */ |
| 9093 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9094 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9095 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9096 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9097 | |
| 9098 | { } /* end */ |
| 9099 | }; |
| 9100 | |
| 9101 | /* toggle speaker-output according to the hp-jack state */ |
| 9102 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9103 | { |
| 9104 | struct alc_spec *spec = codec->spec; |
| 9105 | |
| 9106 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9107 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9108 | } |
| 9109 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9110 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9111 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9112 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9113 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9114 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9115 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9117 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9119 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9120 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9121 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9122 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9124 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9125 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9126 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9128 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9130 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9132 | { } /* end */ |
| 9133 | }; |
| 9134 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9135 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9136 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9137 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9138 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9139 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9140 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9141 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9142 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9143 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9144 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9145 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9146 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9147 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9148 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9149 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9150 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9151 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9152 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9153 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9154 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9155 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9156 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9157 | { } /* end */ |
| 9158 | }; |
| 9159 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9160 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9161 | /* Output mixers */ |
| 9162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9163 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9164 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9165 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9166 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9167 | HDA_OUTPUT), |
| 9168 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9169 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9170 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9171 | /* Output switches */ |
| 9172 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9173 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9174 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9175 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9176 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9177 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9178 | /* Input mixers */ |
| 9179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9181 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9182 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9183 | { } /* end */ |
| 9184 | }; |
| 9185 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9186 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9187 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9188 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9189 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9191 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9192 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9193 | { } /* end */ |
| 9194 | }; |
| 9195 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9196 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9197 | .ops = &snd_hda_bind_vol, |
| 9198 | .values = { |
| 9199 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9200 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9201 | 0 |
| 9202 | }, |
| 9203 | }; |
| 9204 | |
| 9205 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9206 | .ops = &snd_hda_bind_sw, |
| 9207 | .values = { |
| 9208 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9209 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9210 | 0 |
| 9211 | }, |
| 9212 | }; |
| 9213 | |
| 9214 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9215 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9216 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9217 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9219 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9221 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9223 | { } /* end */ |
| 9224 | }; |
| 9225 | |
| 9226 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9227 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9228 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9229 | { |
| 9230 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9231 | /* .name = "Capture Source", */ |
| 9232 | .name = "Input Source", |
| 9233 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9234 | .info = alc_mux_enum_info, |
| 9235 | .get = alc_mux_enum_get, |
| 9236 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9237 | }, |
| 9238 | { } /* end */ |
| 9239 | }; |
| 9240 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9241 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9242 | { |
| 9243 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9244 | .name = "Channel Mode", |
| 9245 | .info = alc_ch_mode_info, |
| 9246 | .get = alc_ch_mode_get, |
| 9247 | .put = alc_ch_mode_put, |
| 9248 | }, |
| 9249 | { } /* end */ |
| 9250 | }; |
| 9251 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9252 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9253 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9254 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9255 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9256 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9257 | spec->autocfg.hp_pins[0] = 0x15; |
| 9258 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9259 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9260 | } |
| 9261 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9262 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9263 | /* HP */ |
| 9264 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9265 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9266 | /* Subwoofer */ |
| 9267 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9268 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9269 | |
| 9270 | /* enable unsolicited event */ |
| 9271 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9272 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9273 | |
| 9274 | { } /* end */ |
| 9275 | }; |
| 9276 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9277 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9278 | /* HP */ |
| 9279 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9280 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9281 | /* Int speaker */ |
| 9282 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9283 | |
| 9284 | /* enable unsolicited event */ |
| 9285 | /* |
| 9286 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9287 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9288 | */ |
| 9289 | |
| 9290 | { } /* end */ |
| 9291 | }; |
| 9292 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9293 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9294 | /* HP */ |
| 9295 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9297 | /* Int speaker */ |
| 9298 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9299 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9300 | |
| 9301 | /* enable unsolicited event */ |
| 9302 | {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] | 9303 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9304 | |
| 9305 | { } /* end */ |
| 9306 | }; |
| 9307 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9308 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9309 | /* HP */ |
| 9310 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9312 | /* Subwoofer */ |
| 9313 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9315 | |
| 9316 | /* enable unsolicited event */ |
| 9317 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9318 | |
| 9319 | { } /* end */ |
| 9320 | }; |
| 9321 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9322 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9325 | |
| 9326 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9327 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9328 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9329 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9330 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9331 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9332 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9333 | /* Connect Mic jack to CLFE */ |
| 9334 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9335 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9336 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9337 | /* Connect Line-in jack to Surround */ |
| 9338 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9339 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9340 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9341 | /* Connect HP out jack to Front */ |
| 9342 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9343 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9344 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9345 | |
| 9346 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9347 | |
| 9348 | { } /* end */ |
| 9349 | }; |
| 9350 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9351 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9352 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9353 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9354 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9355 | { } /* end */ |
| 9356 | }; |
| 9357 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9358 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9359 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9360 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9361 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9362 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9363 | { } /* end */ |
| 9364 | }; |
| 9365 | |
| 9366 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9368 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9369 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9370 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9371 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9372 | { } /* end */ |
| 9373 | }; |
| 9374 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9375 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9376 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9377 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9378 | |
| 9379 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9380 | |
| 9381 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9382 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9383 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9384 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9385 | { } /* end */ |
| 9386 | }; |
| 9387 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9388 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9389 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9390 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9391 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9392 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9393 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9394 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9395 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9396 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9397 | { } /* end */ |
| 9398 | }; |
| 9399 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9400 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9401 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9402 | { } |
| 9403 | }; |
| 9404 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9405 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9406 | /* HP */ |
| 9407 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9408 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9409 | |
| 9410 | /* enable unsolicited event */ |
| 9411 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9412 | |
| 9413 | { } /* end */ |
| 9414 | }; |
| 9415 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9416 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9417 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9418 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9419 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9420 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9421 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9422 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9423 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9424 | } |
| 9425 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9426 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9427 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9428 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9429 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9430 | {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] | 9431 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9432 | }; |
| 9433 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9434 | /* |
| 9435 | * 2ch mode |
| 9436 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9437 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9438 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9439 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9440 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9441 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9442 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9443 | }; |
| 9444 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9445 | /* |
| 9446 | * 4ch mode |
| 9447 | */ |
| 9448 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9449 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9450 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9451 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9452 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9453 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9454 | { } /* end */ |
| 9455 | }; |
| 9456 | |
| 9457 | /* |
| 9458 | * 6ch mode |
| 9459 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9460 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9461 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9462 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9463 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9464 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9465 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9466 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9467 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9468 | }; |
| 9469 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9470 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9471 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9472 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9473 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9474 | }; |
| 9475 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9476 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9477 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9478 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9479 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9480 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9481 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9482 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9483 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9484 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9485 | } |
| 9486 | |
| 9487 | /* toggle RCA according to the front-jack state */ |
| 9488 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9489 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9490 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9491 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9492 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9493 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9494 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9495 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9496 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9497 | unsigned int res) |
| 9498 | { |
| 9499 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9500 | alc888_lenovo_ms7195_front_automute(codec); |
| 9501 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9502 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9503 | } |
| 9504 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9505 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9506 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9507 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9508 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9509 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9510 | spec->autocfg.hp_pins[0] = 0x14; |
| 9511 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9512 | } |
| 9513 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9514 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9515 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9516 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9517 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9518 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9519 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9520 | struct alc_spec *spec = codec->spec; |
| 9521 | |
| 9522 | spec->autocfg.hp_pins[0] = 0x15; |
| 9523 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9524 | } |
| 9525 | |
| 9526 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9527 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9528 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9529 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9530 | } |
| 9531 | |
| 9532 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9533 | unsigned int res) |
| 9534 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9535 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9536 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9537 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9538 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9539 | default: |
| 9540 | alc_automute_amp_unsol_event(codec, res); |
| 9541 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9542 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9543 | } |
| 9544 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9545 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9546 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9547 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9548 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9549 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9550 | spec->autocfg.hp_pins[0] = 0x14; |
| 9551 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9552 | } |
| 9553 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9554 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9555 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9556 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9557 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9558 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9559 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9560 | } |
| 9561 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9562 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9563 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9564 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9565 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9566 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9567 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9568 | } |
| 9569 | |
| 9570 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9571 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9572 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9573 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9574 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9575 | HDA_AMP_MUTE, bits); |
| 9576 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9577 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9578 | } |
| 9579 | |
| 9580 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9581 | unsigned int res) |
| 9582 | { |
| 9583 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9584 | alc883_lenovo_101e_all_automute(codec); |
| 9585 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9586 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9587 | } |
| 9588 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9589 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9590 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9591 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9592 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9593 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9594 | spec->autocfg.hp_pins[0] = 0x14; |
| 9595 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9596 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9597 | } |
| 9598 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9599 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9600 | /* HP Pin: output 0 (0x0c) */ |
| 9601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9603 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9604 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9605 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9606 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9607 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9608 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9609 | /* eanable EAPD on medion laptop */ |
| 9610 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9611 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9612 | /* enable unsolicited event */ |
| 9613 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9614 | { } |
| 9615 | }; |
| 9616 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9617 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9618 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9619 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9620 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9621 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9622 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9623 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9624 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9625 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9626 | } |
| 9627 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9628 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9629 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9630 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9631 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9632 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9633 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9634 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9635 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9636 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9637 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9638 | } |
| 9639 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9640 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9641 | { |
| 9642 | struct alc_spec *spec = codec->spec; |
| 9643 | |
| 9644 | spec->autocfg.hp_pins[0] = 0x15; |
| 9645 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9646 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9647 | } |
| 9648 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9649 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9650 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9651 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9652 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9653 | /* enable unsolicited event */ |
| 9654 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9655 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9656 | { } /* end */ |
| 9657 | }; |
| 9658 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9659 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9660 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9661 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9662 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9663 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9664 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9665 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9666 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9667 | spec->ext_mic.pin = 0x18; |
| 9668 | spec->int_mic.pin = 0x19; |
| 9669 | spec->ext_mic.mux_idx = 0; |
| 9670 | spec->int_mic.mux_idx = 1; |
| 9671 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9672 | } |
| 9673 | |
| 9674 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9675 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9676 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9677 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9678 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9679 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9680 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9681 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9682 | /* enable unsolicited event */ |
| 9683 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9684 | { } /* end */ |
| 9685 | }; |
| 9686 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9687 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9688 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9689 | struct alc_spec *spec = codec->spec; |
| 9690 | |
| 9691 | spec->autocfg.hp_pins[0] = 0x14; |
| 9692 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9693 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9694 | } |
| 9695 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9696 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9697 | /* Init rear pin (used as headphone output) */ |
| 9698 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9699 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9700 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9701 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9702 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9703 | /* Init line 2 pin (used as headphone out by default) */ |
| 9704 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9705 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9706 | { } /* end */ |
| 9707 | }; |
| 9708 | |
| 9709 | /* Mute speakers according to the headphone jack state */ |
| 9710 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9711 | { |
| 9712 | unsigned int present; |
| 9713 | |
| 9714 | /* Mute only in 2ch or 4ch mode */ |
| 9715 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9716 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9717 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9718 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9719 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9720 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9721 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9722 | } |
| 9723 | } |
| 9724 | |
| 9725 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9726 | { |
| 9727 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9728 | alc889A_mb31_automute(codec); |
| 9729 | } |
| 9730 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9731 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9732 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9733 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9734 | #endif |
| 9735 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9736 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9737 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9738 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9739 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9740 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9741 | |
| 9742 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9743 | ALC1200_DIGOUT_NID, 0, |
| 9744 | }; |
| 9745 | |
| 9746 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9747 | ALC883_DIGOUT_NID, 0, |
| 9748 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9749 | |
| 9750 | /* |
| 9751 | * configuration and preset |
| 9752 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9753 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9754 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9755 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9756 | [ALC882_ARIMA] = "arima", |
| 9757 | [ALC882_W2JC] = "w2jc", |
| 9758 | [ALC882_TARGA] = "targa", |
| 9759 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9760 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9761 | [ALC885_MACPRO] = "macpro", |
| 9762 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9763 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9764 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9765 | [ALC885_MBP3] = "mbp3", |
| 9766 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9767 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9768 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9769 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9770 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9771 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9772 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9773 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9774 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9775 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9776 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9777 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9778 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9779 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9780 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9781 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9782 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9783 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9784 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9785 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9786 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9787 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9788 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9789 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9790 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9791 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9792 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9793 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9794 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9795 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9796 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9797 | [ALC889A_INTEL] = "intel-alc889a", |
| 9798 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9799 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9800 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9801 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9802 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9803 | }; |
| 9804 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9805 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9806 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9807 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9808 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9809 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9810 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9811 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9812 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9813 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9814 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9815 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9816 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9817 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9818 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9819 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9820 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9821 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9822 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9823 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9824 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9825 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9826 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9827 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9828 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9829 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9830 | /* default Acer -- disabled as it causes more problems. |
| 9831 | * model=auto should work fine now |
| 9832 | */ |
| 9833 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9834 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9835 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9836 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9837 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9838 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9839 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9840 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9841 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9842 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9843 | |
| 9844 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9845 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9846 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9847 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9848 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9849 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9850 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9851 | 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] | 9852 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9853 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9854 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9855 | |
| 9856 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9857 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9858 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9859 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9860 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9861 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9862 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9863 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9864 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9865 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9867 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9868 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9869 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9870 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9871 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9872 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9874 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9875 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9876 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9877 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9878 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9879 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9880 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9881 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9882 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9883 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9884 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9885 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9886 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9887 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9888 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9889 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9890 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9891 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9892 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9894 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9895 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9896 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9897 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9898 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9899 | 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] | 9900 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9901 | 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] | 9902 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9903 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9904 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9905 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9906 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9907 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9908 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9909 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9910 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9911 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9912 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9913 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9914 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9915 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9916 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9917 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9918 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9919 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9920 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9921 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9922 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9923 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9924 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9925 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9926 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9927 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9928 | {} |
| 9929 | }; |
| 9930 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9931 | /* codec SSID table for Intel Mac */ |
| 9932 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9933 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9934 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9935 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9936 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9937 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9938 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9939 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9940 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9941 | 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] | 9942 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9943 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9944 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9945 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9946 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9947 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9948 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9950 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9951 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9952 | */ |
| 9953 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9954 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9955 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9956 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9957 | }; |
| 9958 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9959 | static struct alc_config_preset alc882_presets[] = { |
| 9960 | [ALC882_3ST_DIG] = { |
| 9961 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9962 | .init_verbs = { alc882_base_init_verbs, |
| 9963 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9964 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9965 | .dac_nids = alc882_dac_nids, |
| 9966 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9967 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9968 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9969 | .channel_mode = alc882_ch_modes, |
| 9970 | .need_dac_fix = 1, |
| 9971 | .input_mux = &alc882_capture_source, |
| 9972 | }, |
| 9973 | [ALC882_6ST_DIG] = { |
| 9974 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9975 | .init_verbs = { alc882_base_init_verbs, |
| 9976 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9977 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9978 | .dac_nids = alc882_dac_nids, |
| 9979 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9980 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9981 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9982 | .channel_mode = alc882_sixstack_modes, |
| 9983 | .input_mux = &alc882_capture_source, |
| 9984 | }, |
| 9985 | [ALC882_ARIMA] = { |
| 9986 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9987 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9988 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9989 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9990 | .dac_nids = alc882_dac_nids, |
| 9991 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9992 | .channel_mode = alc882_sixstack_modes, |
| 9993 | .input_mux = &alc882_capture_source, |
| 9994 | }, |
| 9995 | [ALC882_W2JC] = { |
| 9996 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9997 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9998 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9999 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10000 | .dac_nids = alc882_dac_nids, |
| 10001 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10002 | .channel_mode = alc880_threestack_modes, |
| 10003 | .need_dac_fix = 1, |
| 10004 | .input_mux = &alc882_capture_source, |
| 10005 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10006 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10007 | [ALC885_MBA21] = { |
| 10008 | .mixers = { alc885_mba21_mixer }, |
| 10009 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10010 | .num_dacs = 2, |
| 10011 | .dac_nids = alc882_dac_nids, |
| 10012 | .channel_mode = alc885_mba21_ch_modes, |
| 10013 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10014 | .input_mux = &alc882_capture_source, |
| 10015 | .unsol_event = alc_automute_amp_unsol_event, |
| 10016 | .setup = alc885_mba21_setup, |
| 10017 | .init_hook = alc_automute_amp, |
| 10018 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10019 | [ALC885_MBP3] = { |
| 10020 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10021 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10022 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10023 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10024 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10025 | .hp_nid = 0x04, |
| 10026 | .channel_mode = alc885_mbp_4ch_modes, |
| 10027 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10028 | .input_mux = &alc882_capture_source, |
| 10029 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10030 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10031 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10032 | .setup = alc885_mbp3_setup, |
| 10033 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10034 | }, |
| 10035 | [ALC885_MB5] = { |
| 10036 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10037 | .init_verbs = { alc885_mb5_init_verbs, |
| 10038 | alc880_gpio1_init_verbs }, |
| 10039 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10040 | .dac_nids = alc882_dac_nids, |
| 10041 | .channel_mode = alc885_mb5_6ch_modes, |
| 10042 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10043 | .input_mux = &mb5_capture_source, |
| 10044 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10045 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10046 | .unsol_event = alc_automute_amp_unsol_event, |
| 10047 | .setup = alc885_mb5_setup, |
| 10048 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10049 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10050 | [ALC885_MACMINI3] = { |
| 10051 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10052 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10053 | alc880_gpio1_init_verbs }, |
| 10054 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10055 | .dac_nids = alc882_dac_nids, |
| 10056 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10057 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10058 | .input_mux = &macmini3_capture_source, |
| 10059 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10060 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10061 | .unsol_event = alc_automute_amp_unsol_event, |
| 10062 | .setup = alc885_macmini3_setup, |
| 10063 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10064 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10065 | [ALC885_MACPRO] = { |
| 10066 | .mixers = { alc882_macpro_mixer }, |
| 10067 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10068 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10069 | .dac_nids = alc882_dac_nids, |
| 10070 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10071 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10072 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10073 | .channel_mode = alc882_ch_modes, |
| 10074 | .input_mux = &alc882_capture_source, |
| 10075 | .init_hook = alc885_macpro_init_hook, |
| 10076 | }, |
| 10077 | [ALC885_IMAC24] = { |
| 10078 | .mixers = { alc885_imac24_mixer }, |
| 10079 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10080 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10081 | .dac_nids = alc882_dac_nids, |
| 10082 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10083 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10084 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10085 | .channel_mode = alc882_ch_modes, |
| 10086 | .input_mux = &alc882_capture_source, |
| 10087 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10088 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10089 | .init_hook = alc885_imac24_init_hook, |
| 10090 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10091 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10092 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10093 | .init_verbs = { alc885_imac91_init_verbs, |
| 10094 | alc880_gpio1_init_verbs }, |
| 10095 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10096 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10097 | .channel_mode = alc885_mba21_ch_modes, |
| 10098 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10099 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10100 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10101 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10102 | .unsol_event = alc_automute_amp_unsol_event, |
| 10103 | .setup = alc885_imac91_setup, |
| 10104 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10105 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10106 | [ALC882_TARGA] = { |
| 10107 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10108 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10109 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10110 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10111 | .dac_nids = alc882_dac_nids, |
| 10112 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10113 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10114 | .adc_nids = alc882_adc_nids, |
| 10115 | .capsrc_nids = alc882_capsrc_nids, |
| 10116 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10117 | .channel_mode = alc882_3ST_6ch_modes, |
| 10118 | .need_dac_fix = 1, |
| 10119 | .input_mux = &alc882_capture_source, |
| 10120 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10121 | .setup = alc882_targa_setup, |
| 10122 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10123 | }, |
| 10124 | [ALC882_ASUS_A7J] = { |
| 10125 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10126 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10127 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10128 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10129 | .dac_nids = alc882_dac_nids, |
| 10130 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10131 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10132 | .adc_nids = alc882_adc_nids, |
| 10133 | .capsrc_nids = alc882_capsrc_nids, |
| 10134 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10135 | .channel_mode = alc882_3ST_6ch_modes, |
| 10136 | .need_dac_fix = 1, |
| 10137 | .input_mux = &alc882_capture_source, |
| 10138 | }, |
| 10139 | [ALC882_ASUS_A7M] = { |
| 10140 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10141 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10142 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10143 | alc882_asus_a7m_verbs }, |
| 10144 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10145 | .dac_nids = alc882_dac_nids, |
| 10146 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10147 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10148 | .channel_mode = alc880_threestack_modes, |
| 10149 | .need_dac_fix = 1, |
| 10150 | .input_mux = &alc882_capture_source, |
| 10151 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10152 | [ALC883_3ST_2ch_DIG] = { |
| 10153 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10154 | .init_verbs = { alc883_init_verbs }, |
| 10155 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10156 | .dac_nids = alc883_dac_nids, |
| 10157 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10158 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10159 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10160 | .channel_mode = alc883_3ST_2ch_modes, |
| 10161 | .input_mux = &alc883_capture_source, |
| 10162 | }, |
| 10163 | [ALC883_3ST_6ch_DIG] = { |
| 10164 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10165 | .init_verbs = { alc883_init_verbs }, |
| 10166 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10167 | .dac_nids = alc883_dac_nids, |
| 10168 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10169 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10170 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10171 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10172 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10173 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10174 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10175 | [ALC883_3ST_6ch] = { |
| 10176 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10177 | .init_verbs = { alc883_init_verbs }, |
| 10178 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10179 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10180 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10181 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10182 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10183 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10184 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10185 | [ALC883_3ST_6ch_INTEL] = { |
| 10186 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10187 | .init_verbs = { alc883_init_verbs }, |
| 10188 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10189 | .dac_nids = alc883_dac_nids, |
| 10190 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10191 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10192 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10193 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10194 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10195 | .need_dac_fix = 1, |
| 10196 | .input_mux = &alc883_3stack_6ch_intel, |
| 10197 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10198 | [ALC889A_INTEL] = { |
| 10199 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10200 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10201 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10202 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10203 | .dac_nids = alc883_dac_nids, |
| 10204 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10205 | .adc_nids = alc889_adc_nids, |
| 10206 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10207 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10208 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10209 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10210 | .channel_mode = alc889_8ch_intel_modes, |
| 10211 | .capsrc_nids = alc889_capsrc_nids, |
| 10212 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10213 | .setup = alc889_automute_setup, |
| 10214 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10215 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10216 | .need_dac_fix = 1, |
| 10217 | }, |
| 10218 | [ALC889_INTEL] = { |
| 10219 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10220 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10221 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10222 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10223 | .dac_nids = alc883_dac_nids, |
| 10224 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10225 | .adc_nids = alc889_adc_nids, |
| 10226 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10227 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10228 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10229 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10230 | .channel_mode = alc889_8ch_intel_modes, |
| 10231 | .capsrc_nids = alc889_capsrc_nids, |
| 10232 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10233 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10234 | .init_hook = alc889_intel_init_hook, |
| 10235 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10236 | .need_dac_fix = 1, |
| 10237 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10238 | [ALC883_6ST_DIG] = { |
| 10239 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10240 | .init_verbs = { alc883_init_verbs }, |
| 10241 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10242 | .dac_nids = alc883_dac_nids, |
| 10243 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10244 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10245 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10246 | .channel_mode = alc883_sixstack_modes, |
| 10247 | .input_mux = &alc883_capture_source, |
| 10248 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10249 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10250 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10251 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10252 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10253 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10254 | .dac_nids = alc883_dac_nids, |
| 10255 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10256 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10257 | .channel_mode = alc883_3ST_6ch_modes, |
| 10258 | .need_dac_fix = 1, |
| 10259 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10260 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10261 | .setup = alc882_targa_setup, |
| 10262 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10263 | }, |
| 10264 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10265 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10266 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10267 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10268 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10269 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10270 | .adc_nids = alc883_adc_nids_alt, |
| 10271 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10272 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10273 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10274 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10275 | .channel_mode = alc883_3ST_2ch_modes, |
| 10276 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10277 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10278 | .setup = alc882_targa_setup, |
| 10279 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10280 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10281 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10282 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10283 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10284 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10285 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10286 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10287 | .dac_nids = alc883_dac_nids, |
| 10288 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10289 | .adc_nids = alc883_adc_nids_rev, |
| 10290 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10291 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10292 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10293 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10294 | .channel_mode = alc883_4ST_8ch_modes, |
| 10295 | .need_dac_fix = 1, |
| 10296 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10297 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10298 | .setup = alc882_targa_setup, |
| 10299 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10300 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10301 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10302 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10303 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10304 | * and the headphone jack. Turn this on and rely on the |
| 10305 | * standard mute methods whenever the user wants to turn |
| 10306 | * these outputs off. |
| 10307 | */ |
| 10308 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10309 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10310 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10311 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10312 | .channel_mode = alc883_3ST_2ch_modes, |
| 10313 | .input_mux = &alc883_capture_source, |
| 10314 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10315 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10316 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10317 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10318 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10319 | .dac_nids = alc883_dac_nids, |
| 10320 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10321 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10322 | .channel_mode = alc883_3ST_2ch_modes, |
| 10323 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10324 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10325 | .setup = alc883_acer_aspire_setup, |
| 10326 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10327 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10328 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10329 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10330 | alc883_chmode_mixer }, |
| 10331 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10332 | alc888_acer_aspire_4930g_verbs }, |
| 10333 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10334 | .dac_nids = alc883_dac_nids, |
| 10335 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10336 | .adc_nids = alc883_adc_nids_rev, |
| 10337 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10338 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10339 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10340 | .channel_mode = alc883_3ST_6ch_modes, |
| 10341 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10342 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10343 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10344 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10345 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10346 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10347 | .setup = alc888_acer_aspire_4930g_setup, |
| 10348 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10349 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10350 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10351 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10352 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10353 | alc888_acer_aspire_6530g_verbs }, |
| 10354 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10355 | .dac_nids = alc883_dac_nids, |
| 10356 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10357 | .adc_nids = alc883_adc_nids_rev, |
| 10358 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10359 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10360 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10361 | .channel_mode = alc883_3ST_2ch_modes, |
| 10362 | .num_mux_defs = |
| 10363 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10364 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10365 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10366 | .setup = alc888_acer_aspire_6530g_setup, |
| 10367 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10368 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10369 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10370 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10371 | alc883_chmode_mixer }, |
| 10372 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10373 | alc889_acer_aspire_8930g_verbs, |
| 10374 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10375 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10376 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10377 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10378 | .adc_nids = alc889_adc_nids, |
| 10379 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10380 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10381 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10382 | .channel_mode = alc883_3ST_6ch_modes, |
| 10383 | .need_dac_fix = 1, |
| 10384 | .const_channel_count = 6, |
| 10385 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10386 | ARRAY_SIZE(alc889_capture_sources), |
| 10387 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10388 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10389 | .setup = alc889_acer_aspire_8930g_setup, |
| 10390 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10391 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10392 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10393 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10394 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10395 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10396 | .mixers = { alc883_3ST_6ch_mixer, |
| 10397 | alc883_chmode_mixer }, |
| 10398 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10399 | alc888_acer_aspire_7730G_verbs }, |
| 10400 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10401 | .dac_nids = alc883_dac_nids, |
| 10402 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10403 | .adc_nids = alc883_adc_nids_rev, |
| 10404 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10405 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10406 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10407 | .channel_mode = alc883_3ST_6ch_modes, |
| 10408 | .need_dac_fix = 1, |
| 10409 | .const_channel_count = 6, |
| 10410 | .input_mux = &alc883_capture_source, |
| 10411 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10412 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10413 | .init_hook = alc_automute_amp, |
| 10414 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10415 | [ALC883_MEDION] = { |
| 10416 | .mixers = { alc883_fivestack_mixer, |
| 10417 | alc883_chmode_mixer }, |
| 10418 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10419 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10420 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10421 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10422 | .adc_nids = alc883_adc_nids_alt, |
| 10423 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10424 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10425 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10426 | .channel_mode = alc883_sixstack_modes, |
| 10427 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10428 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10429 | [ALC883_MEDION_WIM2160] = { |
| 10430 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10431 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10432 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10433 | .dac_nids = alc883_dac_nids, |
| 10434 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10435 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10436 | .adc_nids = alc883_adc_nids, |
| 10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10438 | .channel_mode = alc883_3ST_2ch_modes, |
| 10439 | .input_mux = &alc883_capture_source, |
| 10440 | .unsol_event = alc_automute_amp_unsol_event, |
| 10441 | .setup = alc883_medion_wim2160_setup, |
| 10442 | .init_hook = alc_automute_amp, |
| 10443 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10444 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10445 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10446 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10447 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10448 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10449 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10450 | .channel_mode = alc883_3ST_2ch_modes, |
| 10451 | .input_mux = &alc883_capture_source, |
| 10452 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10453 | [ALC883_CLEVO_M540R] = { |
| 10454 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10455 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10457 | .dac_nids = alc883_dac_nids, |
| 10458 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10459 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10460 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10461 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10462 | .need_dac_fix = 1, |
| 10463 | .input_mux = &alc883_capture_source, |
| 10464 | /* This machine has the hardware HP auto-muting, thus |
| 10465 | * we need no software mute via unsol event |
| 10466 | */ |
| 10467 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10468 | [ALC883_CLEVO_M720] = { |
| 10469 | .mixers = { alc883_clevo_m720_mixer }, |
| 10470 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10471 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10472 | .dac_nids = alc883_dac_nids, |
| 10473 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10474 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10475 | .channel_mode = alc883_3ST_2ch_modes, |
| 10476 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10477 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10478 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10479 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10480 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10481 | [ALC883_LENOVO_101E_2ch] = { |
| 10482 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10483 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10484 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10485 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10486 | .adc_nids = alc883_adc_nids_alt, |
| 10487 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10488 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10489 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10490 | .channel_mode = alc883_3ST_2ch_modes, |
| 10491 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10492 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10493 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10494 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10495 | [ALC883_LENOVO_NB0763] = { |
| 10496 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10497 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10498 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10499 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10500 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10501 | .channel_mode = alc883_3ST_2ch_modes, |
| 10502 | .need_dac_fix = 1, |
| 10503 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10504 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10505 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10506 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10507 | }, |
| 10508 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10509 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10510 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10511 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10512 | .dac_nids = alc883_dac_nids, |
| 10513 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10514 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10515 | .channel_mode = alc883_3ST_6ch_modes, |
| 10516 | .need_dac_fix = 1, |
| 10517 | .input_mux = &alc883_capture_source, |
| 10518 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10519 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10520 | }, |
| 10521 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10522 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10523 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10524 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10525 | .dac_nids = alc883_dac_nids, |
| 10526 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10527 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10528 | .channel_mode = alc883_3ST_2ch_modes, |
| 10529 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10530 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10531 | .setup = alc883_haier_w66_setup, |
| 10532 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10533 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10534 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10535 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10536 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10537 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10538 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10539 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10540 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10541 | .need_dac_fix = 1, |
| 10542 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10543 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10544 | .setup = alc888_3st_hp_setup, |
| 10545 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10546 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10547 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10548 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10549 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10550 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10551 | .dac_nids = alc883_dac_nids, |
| 10552 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10553 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10554 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10555 | .channel_mode = alc883_sixstack_modes, |
| 10556 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10557 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10558 | .setup = alc888_6st_dell_setup, |
| 10559 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10560 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10561 | [ALC883_MITAC] = { |
| 10562 | .mixers = { alc883_mitac_mixer }, |
| 10563 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10564 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10565 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10566 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10567 | .channel_mode = alc883_3ST_2ch_modes, |
| 10568 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10569 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10570 | .setup = alc883_mitac_setup, |
| 10571 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10572 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10573 | [ALC883_FUJITSU_PI2515] = { |
| 10574 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10575 | .init_verbs = { alc883_init_verbs, |
| 10576 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10577 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10578 | .dac_nids = alc883_dac_nids, |
| 10579 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10580 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10581 | .channel_mode = alc883_3ST_2ch_modes, |
| 10582 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10583 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10584 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10585 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10586 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10587 | [ALC888_FUJITSU_XA3530] = { |
| 10588 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10589 | .init_verbs = { alc883_init_verbs, |
| 10590 | alc888_fujitsu_xa3530_verbs }, |
| 10591 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10592 | .dac_nids = alc883_dac_nids, |
| 10593 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10594 | .adc_nids = alc883_adc_nids_rev, |
| 10595 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10596 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10597 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10598 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10599 | .num_mux_defs = |
| 10600 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10601 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10602 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10603 | .setup = alc888_fujitsu_xa3530_setup, |
| 10604 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10605 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10606 | [ALC888_LENOVO_SKY] = { |
| 10607 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10608 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10609 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10610 | .dac_nids = alc883_dac_nids, |
| 10611 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10612 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10613 | .channel_mode = alc883_sixstack_modes, |
| 10614 | .need_dac_fix = 1, |
| 10615 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10616 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10617 | .setup = alc888_lenovo_sky_setup, |
| 10618 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10619 | }, |
| 10620 | [ALC888_ASUS_M90V] = { |
| 10621 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10622 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10623 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10624 | .dac_nids = alc883_dac_nids, |
| 10625 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10626 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10627 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10628 | .channel_mode = alc883_3ST_6ch_modes, |
| 10629 | .need_dac_fix = 1, |
| 10630 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10631 | .unsol_event = alc_sku_unsol_event, |
| 10632 | .setup = alc883_mode2_setup, |
| 10633 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10634 | }, |
| 10635 | [ALC888_ASUS_EEE1601] = { |
| 10636 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10637 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10638 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10639 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10640 | .dac_nids = alc883_dac_nids, |
| 10641 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10642 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10643 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10644 | .channel_mode = alc883_3ST_2ch_modes, |
| 10645 | .need_dac_fix = 1, |
| 10646 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10647 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10648 | .init_hook = alc883_eee1601_inithook, |
| 10649 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10650 | [ALC1200_ASUS_P5Q] = { |
| 10651 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10652 | .init_verbs = { alc883_init_verbs }, |
| 10653 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10654 | .dac_nids = alc883_dac_nids, |
| 10655 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10656 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10657 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10658 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10659 | .channel_mode = alc883_sixstack_modes, |
| 10660 | .input_mux = &alc883_capture_source, |
| 10661 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10662 | [ALC889A_MB31] = { |
| 10663 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10664 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10665 | alc880_gpio1_init_verbs }, |
| 10666 | .adc_nids = alc883_adc_nids, |
| 10667 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10668 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10669 | .dac_nids = alc883_dac_nids, |
| 10670 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10671 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10672 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10673 | .input_mux = &alc889A_mb31_capture_source, |
| 10674 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10675 | .unsol_event = alc889A_mb31_unsol_event, |
| 10676 | .init_hook = alc889A_mb31_automute, |
| 10677 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10678 | [ALC883_SONY_VAIO_TT] = { |
| 10679 | .mixers = { alc883_vaiott_mixer }, |
| 10680 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10681 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10682 | .dac_nids = alc883_dac_nids, |
| 10683 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10684 | .channel_mode = alc883_3ST_2ch_modes, |
| 10685 | .input_mux = &alc883_capture_source, |
| 10686 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10687 | .setup = alc883_vaiott_setup, |
| 10688 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10689 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10690 | }; |
| 10691 | |
| 10692 | |
| 10693 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10694 | * Pin config fixes |
| 10695 | */ |
| 10696 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10697 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10698 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10699 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10700 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10701 | }; |
| 10702 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10703 | static const struct alc_fixup alc882_fixups[] = { |
| 10704 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10705 | .type = ALC_FIXUP_PINS, |
| 10706 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10707 | { 0x15, 0x01080104 }, /* side */ |
| 10708 | { 0x16, 0x01011012 }, /* rear */ |
| 10709 | { 0x17, 0x01016011 }, /* clfe */ |
| 10710 | { } |
| 10711 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10712 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10713 | [PINFIX_LENOVO_Y530] = { |
| 10714 | .type = ALC_FIXUP_PINS, |
| 10715 | .v.pins = (const struct alc_pincfg[]) { |
| 10716 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10717 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10718 | { } |
| 10719 | } |
| 10720 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10721 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10722 | .type = ALC_FIXUP_VERBS, |
| 10723 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10724 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10725 | {} |
| 10726 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10727 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10728 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10729 | .type = ALC_FIXUP_SKU, |
| 10730 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10731 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10732 | }; |
| 10733 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10734 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10735 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10736 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10737 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10738 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10739 | {} |
| 10740 | }; |
| 10741 | |
| 10742 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10743 | * BIOS auto configuration |
| 10744 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10745 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10746 | const struct auto_pin_cfg *cfg) |
| 10747 | { |
| 10748 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10749 | } |
| 10750 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10751 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10752 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10753 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10754 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10755 | int idx; |
| 10756 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10757 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10758 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10759 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10760 | if (dac == 0x25) |
| 10761 | idx = 4; |
| 10762 | else if (dac >= 0x02 && dac <= 0x05) |
| 10763 | idx = dac - 2; |
| 10764 | else |
| 10765 | return; |
| 10766 | 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] | 10767 | } |
| 10768 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10769 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10770 | { |
| 10771 | struct alc_spec *spec = codec->spec; |
| 10772 | int i; |
| 10773 | |
| 10774 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10775 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10776 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10777 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10778 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10779 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10780 | } |
| 10781 | } |
| 10782 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10783 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10784 | { |
| 10785 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10786 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10787 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10788 | |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10789 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
| 10790 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10791 | pin = spec->autocfg.hp_pins[i]; |
| 10792 | if (!pin) |
| 10793 | break; |
| 10794 | dac = spec->multiout.hp_nid; |
| 10795 | if (!dac) |
| 10796 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10797 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10798 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10799 | } |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10800 | |
| 10801 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 10802 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10803 | pin = spec->autocfg.speaker_pins[i]; |
| 10804 | if (!pin) |
| 10805 | break; |
| 10806 | dac = spec->multiout.extra_out_nid[0]; |
| 10807 | if (!dac) |
| 10808 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10809 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10810 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10811 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10812 | } |
| 10813 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10814 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10815 | { |
| 10816 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10817 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10818 | int i; |
| 10819 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10820 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10821 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10822 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10823 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10824 | snd_hda_codec_write(codec, nid, 0, |
| 10825 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10826 | AMP_OUT_MUTE); |
| 10827 | } |
| 10828 | } |
| 10829 | |
| 10830 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10831 | { |
| 10832 | struct alc_spec *spec = codec->spec; |
| 10833 | int c; |
| 10834 | |
| 10835 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10836 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10837 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10838 | unsigned int mux_idx; |
| 10839 | const struct hda_input_mux *imux; |
| 10840 | int conns, mute, idx, item; |
| 10841 | |
| 10842 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10843 | ARRAY_SIZE(conn_list)); |
| 10844 | if (conns < 0) |
| 10845 | continue; |
| 10846 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10847 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10848 | if (!imux->num_items && mux_idx > 0) |
| 10849 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10850 | for (idx = 0; idx < conns; idx++) { |
| 10851 | /* if the current connection is the selected one, |
| 10852 | * unmute it as default - otherwise mute it |
| 10853 | */ |
| 10854 | mute = AMP_IN_MUTE(idx); |
| 10855 | for (item = 0; item < imux->num_items; item++) { |
| 10856 | if (imux->items[item].index == idx) { |
| 10857 | if (spec->cur_mux[c] == item) |
| 10858 | mute = AMP_IN_UNMUTE(idx); |
| 10859 | break; |
| 10860 | } |
| 10861 | } |
| 10862 | /* check if we have a selector or mixer |
| 10863 | * we could check for the widget type instead, but |
| 10864 | * just check for Amp-In presence (in case of mixer |
| 10865 | * without amp-in there is something wrong, this |
| 10866 | * function shouldn't be used or capsrc nid is wrong) |
| 10867 | */ |
| 10868 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10869 | snd_hda_codec_write(codec, nid, 0, |
| 10870 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10871 | mute); |
| 10872 | else if (mute != AMP_IN_MUTE(idx)) |
| 10873 | snd_hda_codec_write(codec, nid, 0, |
| 10874 | AC_VERB_SET_CONNECT_SEL, |
| 10875 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10876 | } |
| 10877 | } |
| 10878 | } |
| 10879 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10880 | /* add mic boosts if needed */ |
| 10881 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10882 | { |
| 10883 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10884 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10885 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10886 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10887 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10888 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10889 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10890 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10891 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10892 | break; |
| 10893 | nid = cfg->inputs[i].pin; |
| 10894 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10895 | const char *label; |
| 10896 | char boost_label[32]; |
| 10897 | |
| 10898 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10899 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10900 | type_idx++; |
| 10901 | else |
| 10902 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10903 | prev_label = label; |
| 10904 | |
| 10905 | snprintf(boost_label, sizeof(boost_label), |
| 10906 | "%s Boost Volume", label); |
| 10907 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10908 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10909 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10910 | if (err < 0) |
| 10911 | return err; |
| 10912 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10913 | } |
| 10914 | return 0; |
| 10915 | } |
| 10916 | |
| 10917 | /* almost identical with ALC880 parser... */ |
| 10918 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10919 | { |
| 10920 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10921 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10922 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10923 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10924 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10925 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10926 | if (err < 0) |
| 10927 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10928 | if (!spec->autocfg.line_outs) |
| 10929 | return 0; /* can't find valid BIOS pin config */ |
| 10930 | |
| 10931 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10932 | if (err < 0) |
| 10933 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 10934 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10935 | if (err < 0) |
| 10936 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10937 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10938 | "Headphone"); |
| 10939 | if (err < 0) |
| 10940 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10941 | err = alc880_auto_create_extra_out(spec, |
| 10942 | spec->autocfg.speaker_pins[0], |
| 10943 | "Speaker"); |
| 10944 | if (err < 0) |
| 10945 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10946 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10947 | if (err < 0) |
| 10948 | return err; |
| 10949 | |
| 10950 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10951 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10952 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10953 | |
| 10954 | if (spec->kctls.list) |
| 10955 | add_mixer(spec, spec->kctls.list); |
| 10956 | |
| 10957 | add_verb(spec, alc883_auto_init_verbs); |
| 10958 | /* if ADC 0x07 is available, initialize it, too */ |
| 10959 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10960 | add_verb(spec, alc882_adc1_init_verbs); |
| 10961 | |
| 10962 | spec->num_mux_defs = 1; |
| 10963 | spec->input_mux = &spec->private_imux[0]; |
| 10964 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10965 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10966 | |
| 10967 | err = alc_auto_add_mic_boost(codec); |
| 10968 | if (err < 0) |
| 10969 | return err; |
| 10970 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10971 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10972 | } |
| 10973 | |
| 10974 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10975 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10976 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10977 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10978 | alc882_auto_init_multi_out(codec); |
| 10979 | alc882_auto_init_hp_out(codec); |
| 10980 | alc882_auto_init_analog_input(codec); |
| 10981 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10982 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10983 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10984 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10985 | } |
| 10986 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10987 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10988 | { |
| 10989 | struct alc_spec *spec; |
| 10990 | int err, board_config; |
| 10991 | |
| 10992 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10993 | if (spec == NULL) |
| 10994 | return -ENOMEM; |
| 10995 | |
| 10996 | codec->spec = spec; |
| 10997 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10998 | switch (codec->vendor_id) { |
| 10999 | case 0x10ec0882: |
| 11000 | case 0x10ec0885: |
| 11001 | break; |
| 11002 | default: |
| 11003 | /* ALC883 and variants */ |
| 11004 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11005 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11006 | } |
| 11007 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11008 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11009 | alc882_models, |
| 11010 | alc882_cfg_tbl); |
| 11011 | |
| 11012 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11013 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11014 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11015 | |
| 11016 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11017 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11018 | codec->chip_name); |
| 11019 | board_config = ALC882_AUTO; |
| 11020 | } |
| 11021 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11022 | if (board_config == ALC882_AUTO) { |
| 11023 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11024 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11025 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11026 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11027 | alc_auto_parse_customize_define(codec); |
| 11028 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11029 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11030 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11031 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11032 | if (err < 0) { |
| 11033 | alc_free(codec); |
| 11034 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11035 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11036 | printk(KERN_INFO |
| 11037 | "hda_codec: Cannot set up configuration " |
| 11038 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11039 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11040 | } |
| 11041 | } |
| 11042 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11043 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11044 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11045 | if (err < 0) { |
| 11046 | alc_free(codec); |
| 11047 | return err; |
| 11048 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11049 | } |
| 11050 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11051 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11052 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11053 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11054 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11055 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11056 | /* FIXME: setup DAC5 */ |
| 11057 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11058 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11059 | |
| 11060 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11061 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11062 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11063 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11064 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11065 | spec->num_adc_nids = 0; |
| 11066 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11067 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11068 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11069 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11070 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11071 | unsigned int wcap = get_wcaps(codec, nid); |
| 11072 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11073 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11074 | if (wcap != AC_WID_AUD_IN) |
| 11075 | continue; |
| 11076 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11077 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11078 | if (err < 0) |
| 11079 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11080 | err = snd_hda_get_connections(codec, cap, items, |
| 11081 | ARRAY_SIZE(items)); |
| 11082 | if (err < 0) |
| 11083 | continue; |
| 11084 | for (j = 0; j < imux->num_items; j++) |
| 11085 | if (imux->items[j].index >= err) |
| 11086 | break; |
| 11087 | if (j < imux->num_items) |
| 11088 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11089 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11090 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11091 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11092 | spec->adc_nids = spec->private_adc_nids; |
| 11093 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11094 | } |
| 11095 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11096 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11097 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11098 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11099 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11100 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11101 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11102 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11103 | spec->vmaster_nid = 0x0c; |
| 11104 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11105 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11106 | if (board_config == ALC882_AUTO) |
| 11107 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11108 | |
| 11109 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11110 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11111 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11112 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11113 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11114 | |
| 11115 | return 0; |
| 11116 | } |
| 11117 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11118 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11119 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11120 | * ALC262 support |
| 11121 | */ |
| 11122 | |
| 11123 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11124 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11125 | |
| 11126 | #define alc262_dac_nids alc260_dac_nids |
| 11127 | #define alc262_adc_nids alc882_adc_nids |
| 11128 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11129 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11130 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11131 | |
| 11132 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11133 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11134 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11135 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11136 | /* ADC0 */ |
| 11137 | 0x09 |
| 11138 | }; |
| 11139 | |
| 11140 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11142 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11143 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11144 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11145 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11146 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11147 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11148 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11151 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11152 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11153 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11154 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11155 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11156 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11157 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11158 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11159 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11160 | }; |
| 11161 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11162 | /* update HP, line and mono-out pins according to the master switch */ |
| 11163 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11164 | { |
| 11165 | struct alc_spec *spec = codec->spec; |
| 11166 | int val = spec->master_sw; |
| 11167 | |
| 11168 | /* HP & line-out */ |
| 11169 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11170 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11171 | val ? PIN_HP : 0); |
| 11172 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11173 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11174 | val ? PIN_HP : 0); |
| 11175 | /* mono (speaker) depending on the HP jack sense */ |
| 11176 | val = val && !spec->jack_present; |
| 11177 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11178 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11179 | val ? PIN_OUT : 0); |
| 11180 | } |
| 11181 | |
| 11182 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11183 | { |
| 11184 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11185 | |
| 11186 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11187 | alc262_hp_master_update(codec); |
| 11188 | } |
| 11189 | |
| 11190 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11191 | { |
| 11192 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11193 | return; |
| 11194 | alc262_hp_bpc_automute(codec); |
| 11195 | } |
| 11196 | |
| 11197 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11198 | { |
| 11199 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11200 | |
| 11201 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11202 | alc262_hp_master_update(codec); |
| 11203 | } |
| 11204 | |
| 11205 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11206 | unsigned int res) |
| 11207 | { |
| 11208 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11209 | return; |
| 11210 | alc262_hp_wildwest_automute(codec); |
| 11211 | } |
| 11212 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11213 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11214 | |
| 11215 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11216 | struct snd_ctl_elem_value *ucontrol) |
| 11217 | { |
| 11218 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11219 | struct alc_spec *spec = codec->spec; |
| 11220 | int val = !!*ucontrol->value.integer.value; |
| 11221 | |
| 11222 | if (val == spec->master_sw) |
| 11223 | return 0; |
| 11224 | spec->master_sw = val; |
| 11225 | alc262_hp_master_update(codec); |
| 11226 | return 1; |
| 11227 | } |
| 11228 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11229 | #define ALC262_HP_MASTER_SWITCH \ |
| 11230 | { \ |
| 11231 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11232 | .name = "Master Playback Switch", \ |
| 11233 | .info = snd_ctl_boolean_mono_info, \ |
| 11234 | .get = alc262_hp_master_sw_get, \ |
| 11235 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11236 | }, \ |
| 11237 | { \ |
| 11238 | .iface = NID_MAPPING, \ |
| 11239 | .name = "Master Playback Switch", \ |
| 11240 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11241 | } |
| 11242 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11243 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11244 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11245 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11246 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11247 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11248 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11249 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11250 | HDA_OUTPUT), |
| 11251 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11252 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11254 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11255 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11256 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11257 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11258 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11259 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11260 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11261 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11262 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11263 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11264 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11265 | { } /* end */ |
| 11266 | }; |
| 11267 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11268 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11269 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11270 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11271 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11272 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11273 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11274 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11275 | HDA_OUTPUT), |
| 11276 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11277 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11278 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11279 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11280 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11281 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11282 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11283 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11284 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11285 | { } /* end */ |
| 11286 | }; |
| 11287 | |
| 11288 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11289 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11290 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11291 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11292 | { } /* end */ |
| 11293 | }; |
| 11294 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11295 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11296 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11297 | { |
| 11298 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11299 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11300 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11301 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11302 | } |
| 11303 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11304 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11305 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11306 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11307 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11308 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11309 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11310 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11311 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11312 | { } /* end */ |
| 11313 | }; |
| 11314 | |
| 11315 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11316 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11317 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11318 | |
| 11319 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11320 | { } |
| 11321 | }; |
| 11322 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11323 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11324 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11325 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11326 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11327 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11328 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11329 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11330 | { } /* end */ |
| 11331 | }; |
| 11332 | |
| 11333 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11334 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11335 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11336 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11337 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11338 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11339 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11340 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11342 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11344 | {} |
| 11345 | }; |
| 11346 | |
| 11347 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11348 | .num_items = 1, |
| 11349 | .items = { |
| 11350 | { "Line", 0x1 }, |
| 11351 | }, |
| 11352 | }; |
| 11353 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11354 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11355 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11356 | { |
| 11357 | struct alc_spec *spec = codec->spec; |
| 11358 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11359 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11360 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11361 | unsigned int mute; |
| 11362 | |
| 11363 | /* HP */ |
| 11364 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11365 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11366 | HDA_AMP_MUTE, mute); |
| 11367 | /* mute internal speaker per jack sense */ |
| 11368 | if (spec->jack_present) |
| 11369 | mute = HDA_AMP_MUTE; |
| 11370 | if (line_nid) |
| 11371 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11372 | HDA_AMP_MUTE, mute); |
| 11373 | if (speaker_nid && speaker_nid != line_nid) |
| 11374 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11375 | HDA_AMP_MUTE, mute); |
| 11376 | } |
| 11377 | |
| 11378 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11379 | |
| 11380 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11381 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11382 | { |
| 11383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11384 | struct alc_spec *spec = codec->spec; |
| 11385 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11386 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11387 | if (val == spec->master_sw) |
| 11388 | return 0; |
| 11389 | spec->master_sw = val; |
| 11390 | alc262_hippo_master_update(codec); |
| 11391 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11392 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11393 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11394 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11395 | { \ |
| 11396 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11397 | .name = "Master Playback Switch", \ |
| 11398 | .info = snd_ctl_boolean_mono_info, \ |
| 11399 | .get = alc262_hippo_master_sw_get, \ |
| 11400 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11401 | }, \ |
| 11402 | { \ |
| 11403 | .iface = NID_MAPPING, \ |
| 11404 | .name = "Master Playback Switch", \ |
| 11405 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11406 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11407 | } |
| 11408 | |
| 11409 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11410 | ALC262_HIPPO_MASTER_SWITCH, |
| 11411 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11412 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11413 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11414 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11415 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11416 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11417 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11418 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11419 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11420 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11421 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11422 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11423 | { } /* end */ |
| 11424 | }; |
| 11425 | |
| 11426 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11427 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11428 | ALC262_HIPPO_MASTER_SWITCH, |
| 11429 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11430 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11431 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11432 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11435 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11436 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11437 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11438 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11439 | { } /* end */ |
| 11440 | }; |
| 11441 | |
| 11442 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11443 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11444 | { |
| 11445 | struct alc_spec *spec = codec->spec; |
| 11446 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11447 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11448 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11449 | alc262_hippo_master_update(codec); |
| 11450 | } |
| 11451 | |
| 11452 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11453 | { |
| 11454 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11455 | return; |
| 11456 | alc262_hippo_automute(codec); |
| 11457 | } |
| 11458 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11459 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11460 | { |
| 11461 | struct alc_spec *spec = codec->spec; |
| 11462 | |
| 11463 | spec->autocfg.hp_pins[0] = 0x15; |
| 11464 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11465 | } |
| 11466 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11467 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11468 | { |
| 11469 | struct alc_spec *spec = codec->spec; |
| 11470 | |
| 11471 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11472 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11473 | } |
| 11474 | |
| 11475 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11476 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11477 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11478 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11479 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11480 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11481 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11482 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11483 | { } /* end */ |
| 11484 | }; |
| 11485 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11486 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11487 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11488 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11489 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11490 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11491 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11492 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11493 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11494 | { } /* end */ |
| 11495 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11496 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11497 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11498 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11499 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11500 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11501 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11502 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11503 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11504 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11506 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11507 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11508 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11509 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11510 | { } /* end */ |
| 11511 | }; |
| 11512 | |
| 11513 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11514 | /* Headphone automute */ |
| 11515 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11516 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11517 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11518 | |
| 11519 | /* P11 AUX_IN, white 4-pin connector */ |
| 11520 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11521 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11522 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11523 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11524 | |
| 11525 | {} |
| 11526 | }; |
| 11527 | |
| 11528 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11529 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11530 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11531 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11532 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11533 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11534 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11535 | } |
| 11536 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11537 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11538 | #define alc262_capture_mixer alc882_capture_mixer |
| 11539 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11540 | |
| 11541 | /* |
| 11542 | * generic initialization of ADC, input mixers and output mixers |
| 11543 | */ |
| 11544 | static struct hda_verb alc262_init_verbs[] = { |
| 11545 | /* |
| 11546 | * Unmute ADC0-2 and set the default input to mic-in |
| 11547 | */ |
| 11548 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11550 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11551 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11552 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11553 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11554 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11555 | /* 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] | 11556 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11557 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11558 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11559 | */ |
| 11560 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11562 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11566 | |
| 11567 | /* |
| 11568 | * Set up output mixers (0x0c - 0x0e) |
| 11569 | */ |
| 11570 | /* set vol=0 to output mixers */ |
| 11571 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11572 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11573 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11574 | /* set up input amps for analog loopback */ |
| 11575 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11576 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11578 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11579 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11580 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11581 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11582 | |
| 11583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11585 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11586 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11587 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11588 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11589 | |
| 11590 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11591 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11592 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11593 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11594 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11595 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11596 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11597 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11598 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11599 | /* FIXME: use matrix-type input source selection */ |
| 11600 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11601 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11602 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11603 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11604 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11605 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11606 | /* Input mixer2 */ |
| 11607 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11608 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11609 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11610 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11611 | /* Input mixer3 */ |
| 11612 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11613 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11615 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11616 | |
| 11617 | { } |
| 11618 | }; |
| 11619 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11620 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11621 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11622 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11623 | { } |
| 11624 | }; |
| 11625 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11626 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11628 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11629 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11630 | |
| 11631 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11632 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11633 | {} |
| 11634 | }; |
| 11635 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11636 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11638 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11639 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11640 | |
| 11641 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11642 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11643 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11644 | }; |
| 11645 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11646 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11647 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11648 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11649 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11650 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11651 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11652 | { } /* end */ |
| 11653 | }; |
| 11654 | |
| 11655 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11656 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11657 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11658 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11659 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11660 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11661 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11662 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11663 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11664 | {} |
| 11665 | }; |
| 11666 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11667 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11668 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11669 | struct alc_spec *spec = codec->spec; |
| 11670 | |
| 11671 | spec->autocfg.hp_pins[0] = 0x15; |
| 11672 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11673 | spec->ext_mic.pin = 0x18; |
| 11674 | spec->ext_mic.mux_idx = 0; |
| 11675 | spec->int_mic.pin = 0x12; |
| 11676 | spec->int_mic.mux_idx = 9; |
| 11677 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11678 | } |
| 11679 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11680 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11681 | * nec model |
| 11682 | * 0x15 = headphone |
| 11683 | * 0x16 = internal speaker |
| 11684 | * 0x18 = external mic |
| 11685 | */ |
| 11686 | |
| 11687 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11688 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11689 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11690 | |
| 11691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11693 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11694 | |
| 11695 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11697 | { } /* end */ |
| 11698 | }; |
| 11699 | |
| 11700 | static struct hda_verb alc262_nec_verbs[] = { |
| 11701 | /* Unmute Speaker */ |
| 11702 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11703 | |
| 11704 | /* Headphone */ |
| 11705 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11707 | |
| 11708 | /* External mic to headphone */ |
| 11709 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11710 | /* External mic to speaker */ |
| 11711 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11712 | {} |
| 11713 | }; |
| 11714 | |
| 11715 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11716 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11717 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11718 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11719 | */ |
| 11720 | |
| 11721 | #define ALC_HP_EVENT 0x37 |
| 11722 | |
| 11723 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11724 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11725 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11726 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11727 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11728 | {} |
| 11729 | }; |
| 11730 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11731 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11732 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11733 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11734 | {} |
| 11735 | }; |
| 11736 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11737 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11738 | /* Front Mic pin: input vref at 50% */ |
| 11739 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11740 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11741 | {} |
| 11742 | }; |
| 11743 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11744 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11745 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11746 | .items = { |
| 11747 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11748 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11749 | { "CD", 0x4 }, |
| 11750 | }, |
| 11751 | }; |
| 11752 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11753 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11754 | .num_items = 5, |
| 11755 | .items = { |
| 11756 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11757 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11758 | { "Line", 0x2 }, |
| 11759 | { "CD", 0x4 }, |
| 11760 | { "AUX IN", 0x6 }, |
| 11761 | }, |
| 11762 | }; |
| 11763 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11764 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11765 | .num_items = 4, |
| 11766 | .items = { |
| 11767 | { "Mic", 0x0 }, |
| 11768 | { "Front Mic", 0x2 }, |
| 11769 | { "Line", 0x1 }, |
| 11770 | { "CD", 0x4 }, |
| 11771 | }, |
| 11772 | }; |
| 11773 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11774 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11775 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11776 | { |
| 11777 | struct alc_spec *spec = codec->spec; |
| 11778 | unsigned int mute; |
| 11779 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11780 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11781 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11782 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11783 | spec->sense_updated = 1; |
| 11784 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11785 | /* unmute internal speaker only if both HPs are unplugged and |
| 11786 | * master switch is on |
| 11787 | */ |
| 11788 | if (spec->jack_present) |
| 11789 | mute = HDA_AMP_MUTE; |
| 11790 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11791 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11792 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11793 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11794 | } |
| 11795 | |
| 11796 | /* unsolicited event for HP jack sensing */ |
| 11797 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11798 | unsigned int res) |
| 11799 | { |
| 11800 | if ((res >> 26) != ALC_HP_EVENT) |
| 11801 | return; |
| 11802 | alc262_fujitsu_automute(codec, 1); |
| 11803 | } |
| 11804 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11805 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11806 | { |
| 11807 | alc262_fujitsu_automute(codec, 1); |
| 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 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11820 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11821 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11822 | { |
| 11823 | struct alc_spec *spec = codec->spec; |
| 11824 | unsigned int mute; |
| 11825 | |
| 11826 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11827 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11828 | spec->sense_updated = 1; |
| 11829 | } |
| 11830 | if (spec->jack_present) { |
| 11831 | /* mute internal speaker */ |
| 11832 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11833 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11834 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11835 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11836 | } else { |
| 11837 | /* unmute internal speaker if necessary */ |
| 11838 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11839 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11840 | HDA_AMP_MUTE, mute); |
| 11841 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11842 | HDA_AMP_MUTE, mute); |
| 11843 | } |
| 11844 | } |
| 11845 | |
| 11846 | /* unsolicited event for HP jack sensing */ |
| 11847 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11848 | unsigned int res) |
| 11849 | { |
| 11850 | if ((res >> 26) != ALC_HP_EVENT) |
| 11851 | return; |
| 11852 | alc262_lenovo_3000_automute(codec, 1); |
| 11853 | } |
| 11854 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11855 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11856 | int dir, int idx, long *valp) |
| 11857 | { |
| 11858 | int i, change = 0; |
| 11859 | |
| 11860 | for (i = 0; i < 2; i++, valp++) |
| 11861 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11862 | HDA_AMP_MUTE, |
| 11863 | *valp ? 0 : HDA_AMP_MUTE); |
| 11864 | return change; |
| 11865 | } |
| 11866 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11867 | /* bind hp and internal speaker mute (with plug check) */ |
| 11868 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11869 | struct snd_ctl_elem_value *ucontrol) |
| 11870 | { |
| 11871 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11872 | long *valp = ucontrol->value.integer.value; |
| 11873 | int change; |
| 11874 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11875 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11876 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11877 | if (change) |
| 11878 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11879 | return change; |
| 11880 | } |
| 11881 | |
| 11882 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11883 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11884 | { |
| 11885 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11886 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11887 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11888 | .info = snd_hda_mixer_amp_switch_info, |
| 11889 | .get = snd_hda_mixer_amp_switch_get, |
| 11890 | .put = alc262_fujitsu_master_sw_put, |
| 11891 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11892 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11893 | { |
| 11894 | .iface = NID_MAPPING, |
| 11895 | .name = "Master Playback Switch", |
| 11896 | .private_value = 0x1b, |
| 11897 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11898 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11899 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11900 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11901 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11903 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11904 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11905 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11906 | { } /* end */ |
| 11907 | }; |
| 11908 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11909 | /* bind hp and internal speaker mute (with plug check) */ |
| 11910 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11911 | struct snd_ctl_elem_value *ucontrol) |
| 11912 | { |
| 11913 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11914 | long *valp = ucontrol->value.integer.value; |
| 11915 | int change; |
| 11916 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11917 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11918 | if (change) |
| 11919 | alc262_lenovo_3000_automute(codec, 0); |
| 11920 | return change; |
| 11921 | } |
| 11922 | |
| 11923 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11924 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11925 | { |
| 11926 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11927 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11928 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11929 | .info = snd_hda_mixer_amp_switch_info, |
| 11930 | .get = snd_hda_mixer_amp_switch_get, |
| 11931 | .put = alc262_lenovo_3000_master_sw_put, |
| 11932 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11933 | }, |
| 11934 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11935 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11936 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11939 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11940 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11941 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11942 | { } /* end */ |
| 11943 | }; |
| 11944 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11945 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11946 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11947 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11950 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11951 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11952 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11953 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11954 | { } /* end */ |
| 11955 | }; |
| 11956 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11957 | /* additional init verbs for Benq laptops */ |
| 11958 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11959 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11960 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11961 | {} |
| 11962 | }; |
| 11963 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11964 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11965 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11966 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11967 | |
| 11968 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11969 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11970 | {} |
| 11971 | }; |
| 11972 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11973 | /* Samsung Q1 Ultra Vista model setup */ |
| 11974 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11975 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11976 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11977 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11979 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 11980 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11981 | { } /* end */ |
| 11982 | }; |
| 11983 | |
| 11984 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11985 | /* output mixer */ |
| 11986 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11987 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11988 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11989 | /* speaker */ |
| 11990 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11991 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11992 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11993 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11994 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11995 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11997 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11998 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11999 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12000 | /* internal mic */ |
| 12001 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12002 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12003 | /* ADC, choose mic */ |
| 12004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12008 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12009 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12010 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12011 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12012 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12013 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12014 | {} |
| 12015 | }; |
| 12016 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12017 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12018 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12019 | { |
| 12020 | struct alc_spec *spec = codec->spec; |
| 12021 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12022 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12023 | mute = 0; |
| 12024 | /* auto-mute only when HP is used as HP */ |
| 12025 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12026 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12027 | if (spec->jack_present) |
| 12028 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12029 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12030 | /* mute/unmute internal speaker */ |
| 12031 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12032 | HDA_AMP_MUTE, mute); |
| 12033 | /* mute/unmute HP */ |
| 12034 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12035 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12036 | } |
| 12037 | |
| 12038 | /* unsolicited event for HP jack sensing */ |
| 12039 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12040 | unsigned int res) |
| 12041 | { |
| 12042 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12043 | return; |
| 12044 | alc262_ultra_automute(codec); |
| 12045 | } |
| 12046 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12047 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12048 | .num_items = 2, |
| 12049 | .items = { |
| 12050 | { "Mic", 0x1 }, |
| 12051 | { "Headphone", 0x7 }, |
| 12052 | }, |
| 12053 | }; |
| 12054 | |
| 12055 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12056 | struct snd_ctl_elem_value *ucontrol) |
| 12057 | { |
| 12058 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12059 | struct alc_spec *spec = codec->spec; |
| 12060 | int ret; |
| 12061 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12062 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12063 | if (!ret) |
| 12064 | return 0; |
| 12065 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12066 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12067 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12068 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12069 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12070 | return ret; |
| 12071 | } |
| 12072 | |
| 12073 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12074 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12075 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12076 | { |
| 12077 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12078 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12079 | .info = alc_mux_enum_info, |
| 12080 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12081 | .put = alc262_ultra_mux_enum_put, |
| 12082 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12083 | { |
| 12084 | .iface = NID_MAPPING, |
| 12085 | .name = "Capture Source", |
| 12086 | .private_value = 0x15, |
| 12087 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12088 | { } /* end */ |
| 12089 | }; |
| 12090 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12091 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12092 | * and thus it's bound with a different mixer. |
| 12093 | * This function returns which mixer amp should be used. |
| 12094 | */ |
| 12095 | static int alc262_check_volbit(hda_nid_t nid) |
| 12096 | { |
| 12097 | if (!nid) |
| 12098 | return 0; |
| 12099 | else if (nid == 0x16) |
| 12100 | return 2; |
| 12101 | else |
| 12102 | return 1; |
| 12103 | } |
| 12104 | |
| 12105 | 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] | 12106 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12107 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12108 | unsigned long val; |
| 12109 | int vbit; |
| 12110 | |
| 12111 | vbit = alc262_check_volbit(nid); |
| 12112 | if (!vbit) |
| 12113 | return 0; |
| 12114 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12115 | return 0; |
| 12116 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12117 | if (vbit == 2) |
| 12118 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12119 | else |
| 12120 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12121 | 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] | 12122 | } |
| 12123 | |
| 12124 | 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] | 12125 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12126 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12127 | unsigned long val; |
| 12128 | |
| 12129 | if (!nid) |
| 12130 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12131 | if (nid == 0x16) |
| 12132 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12133 | else |
| 12134 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12135 | 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] | 12136 | } |
| 12137 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12138 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12139 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12140 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12141 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12142 | const char *pfx; |
| 12143 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12144 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12145 | |
| 12146 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12147 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12148 | spec->multiout.dac_nids[0] = 2; |
| 12149 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12150 | pfx = alc_get_line_out_pfx(cfg, true); |
| 12151 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12152 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12153 | for (i = 0; i < 2; i++) { |
| 12154 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12155 | if (err < 0) |
| 12156 | return err; |
| 12157 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12158 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12159 | "Speaker", i); |
| 12160 | if (err < 0) |
| 12161 | return err; |
| 12162 | } |
| 12163 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12164 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12165 | "Headphone", i); |
| 12166 | if (err < 0) |
| 12167 | return err; |
| 12168 | } |
| 12169 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12170 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12171 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12172 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12173 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12174 | if (vbits == 1 || vbits == 2) |
| 12175 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12176 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12177 | for (i = 0; i < 2; i++) { |
| 12178 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12179 | &vbits, i); |
| 12180 | if (err < 0) |
| 12181 | return err; |
| 12182 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12183 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12184 | "Speaker", &vbits, i); |
| 12185 | if (err < 0) |
| 12186 | return err; |
| 12187 | } |
| 12188 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12189 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12190 | "Headphone", &vbits, i); |
| 12191 | if (err < 0) |
| 12192 | return err; |
| 12193 | } |
| 12194 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12195 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12196 | } |
| 12197 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12198 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12199 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12200 | |
| 12201 | /* |
| 12202 | * generic initialization of ADC, input mixers and output mixers |
| 12203 | */ |
| 12204 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12205 | /* |
| 12206 | * Unmute ADC0-2 and set the default input to mic-in |
| 12207 | */ |
| 12208 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12210 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12211 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12212 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12213 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12214 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12215 | /* 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] | 12216 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12217 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12218 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12219 | */ |
| 12220 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12222 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12223 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12224 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12225 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12226 | |
| 12227 | /* |
| 12228 | * Set up output mixers (0x0c - 0x0f) |
| 12229 | */ |
| 12230 | /* set vol=0 to output mixers */ |
| 12231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12232 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12233 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12234 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12235 | /* set up input amps for analog loopback */ |
| 12236 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12237 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12238 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12239 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12240 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12241 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12242 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12243 | |
| 12244 | /* FIXME: use matrix-type input source selection */ |
| 12245 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12246 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12247 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12248 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12249 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12250 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12251 | /* Input mixer2 */ |
| 12252 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12253 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12254 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12255 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12256 | /* Input mixer3 */ |
| 12257 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12258 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12259 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12260 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12261 | |
| 12262 | { } |
| 12263 | }; |
| 12264 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12265 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12266 | /* |
| 12267 | * Unmute ADC0-2 and set the default input to mic-in |
| 12268 | */ |
| 12269 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12271 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12272 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12273 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12274 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12275 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12276 | /* 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] | 12277 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12278 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12279 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12280 | */ |
| 12281 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12282 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12283 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12284 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12289 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12290 | /* |
| 12291 | * Set up output mixers (0x0c - 0x0e) |
| 12292 | */ |
| 12293 | /* set vol=0 to output mixers */ |
| 12294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12297 | |
| 12298 | /* set up input amps for analog loopback */ |
| 12299 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12300 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12302 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12303 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12304 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12305 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12306 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12307 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12308 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12309 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12310 | |
| 12311 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12313 | |
| 12314 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12315 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12316 | |
| 12317 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12318 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12319 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12320 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12321 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12322 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12323 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12324 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12325 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12326 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12327 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12328 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12329 | |
| 12330 | |
| 12331 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12332 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12333 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12335 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12336 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12337 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12338 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12339 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12340 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12343 | /* Input mixer2 */ |
| 12344 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12345 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12346 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12347 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12348 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12350 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12351 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12352 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12353 | /* Input mixer3 */ |
| 12354 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12355 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12356 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12357 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12359 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12360 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12363 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12364 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12365 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12366 | { } |
| 12367 | }; |
| 12368 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12369 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12370 | /* |
| 12371 | * Unmute ADC0-2 and set the default input to mic-in |
| 12372 | */ |
| 12373 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12374 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12375 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12376 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12377 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12378 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12379 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12380 | /* 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] | 12381 | * mixer widget |
| 12382 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12383 | * panel mic (mic 2) |
| 12384 | */ |
| 12385 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12391 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12392 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12393 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12394 | /* |
| 12395 | * Set up output mixers (0x0c - 0x0e) |
| 12396 | */ |
| 12397 | /* set vol=0 to output mixers */ |
| 12398 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12400 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12401 | |
| 12402 | /* set up input amps for analog loopback */ |
| 12403 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12406 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12408 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12409 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12410 | |
| 12411 | |
| 12412 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12413 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12414 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12415 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12416 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12417 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12418 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12419 | |
| 12420 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12421 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12422 | |
| 12423 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12424 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12425 | |
| 12426 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12427 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12428 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12429 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12430 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12431 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12432 | |
| 12433 | /* FIXME: use matrix-type input source selection */ |
| 12434 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12435 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12436 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12437 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12441 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12442 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12443 | /* Input mixer2 */ |
| 12444 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12445 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12446 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12447 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12448 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12449 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12450 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12451 | /* Input mixer3 */ |
| 12452 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12453 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12454 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12455 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12457 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12459 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12460 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12461 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12462 | { } |
| 12463 | }; |
| 12464 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12465 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12466 | |
| 12467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12468 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12469 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12470 | |
| 12471 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12473 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12474 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12475 | |
| 12476 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12477 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12478 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12479 | {} |
| 12480 | }; |
| 12481 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12482 | /* |
| 12483 | * Pin config fixes |
| 12484 | */ |
| 12485 | enum { |
| 12486 | PINFIX_FSC_H270, |
| 12487 | }; |
| 12488 | |
| 12489 | static const struct alc_fixup alc262_fixups[] = { |
| 12490 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12491 | .type = ALC_FIXUP_PINS, |
| 12492 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12493 | { 0x14, 0x99130110 }, /* speaker */ |
| 12494 | { 0x15, 0x0221142f }, /* front HP */ |
| 12495 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12496 | { } |
| 12497 | } |
| 12498 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12499 | }; |
| 12500 | |
| 12501 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12502 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12503 | {} |
| 12504 | }; |
| 12505 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12506 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12507 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12508 | #define alc262_loopbacks alc880_loopbacks |
| 12509 | #endif |
| 12510 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12511 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12512 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12513 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12514 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12515 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12516 | |
| 12517 | /* |
| 12518 | * BIOS auto configuration |
| 12519 | */ |
| 12520 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12521 | { |
| 12522 | struct alc_spec *spec = codec->spec; |
| 12523 | int err; |
| 12524 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12525 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12526 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12527 | alc262_ignore); |
| 12528 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12529 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12530 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12531 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12532 | spec->multiout.max_channels = 2; |
| 12533 | spec->no_analog = 1; |
| 12534 | goto dig_only; |
| 12535 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12536 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12537 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12538 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12539 | if (err < 0) |
| 12540 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12541 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12542 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12543 | return err; |
| 12544 | |
| 12545 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12546 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12547 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12548 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12549 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12550 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12551 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12552 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12553 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12554 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12555 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12556 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12557 | err = alc_auto_add_mic_boost(codec); |
| 12558 | if (err < 0) |
| 12559 | return err; |
| 12560 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12561 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12562 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12563 | return 1; |
| 12564 | } |
| 12565 | |
| 12566 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12567 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12568 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12569 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12570 | |
| 12571 | |
| 12572 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12573 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12574 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12575 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12576 | alc262_auto_init_multi_out(codec); |
| 12577 | alc262_auto_init_hp_out(codec); |
| 12578 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12579 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12580 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12581 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12582 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12583 | } |
| 12584 | |
| 12585 | /* |
| 12586 | * configuration and preset |
| 12587 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12588 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12589 | [ALC262_BASIC] = "basic", |
| 12590 | [ALC262_HIPPO] = "hippo", |
| 12591 | [ALC262_HIPPO_1] = "hippo_1", |
| 12592 | [ALC262_FUJITSU] = "fujitsu", |
| 12593 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12594 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12595 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12596 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12597 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12598 | [ALC262_BENQ_T31] = "benq-t31", |
| 12599 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12600 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12601 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12602 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12603 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12604 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12605 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12606 | [ALC262_AUTO] = "auto", |
| 12607 | }; |
| 12608 | |
| 12609 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12610 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12611 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12612 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12613 | ALC262_HP_BPC), |
| 12614 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12615 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12616 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12617 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12618 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12619 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12620 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12621 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12622 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12623 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12624 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12625 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12626 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12627 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12628 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12629 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12630 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12631 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12632 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12633 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12634 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12635 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12636 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12637 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12638 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12639 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12640 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12641 | #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] | 12642 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12643 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12644 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12645 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12646 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12647 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12648 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12649 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12650 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12651 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12652 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12653 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12654 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12655 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12656 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12657 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12658 | {} |
| 12659 | }; |
| 12660 | |
| 12661 | static struct alc_config_preset alc262_presets[] = { |
| 12662 | [ALC262_BASIC] = { |
| 12663 | .mixers = { alc262_base_mixer }, |
| 12664 | .init_verbs = { alc262_init_verbs }, |
| 12665 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12666 | .dac_nids = alc262_dac_nids, |
| 12667 | .hp_nid = 0x03, |
| 12668 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12669 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12670 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12671 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12672 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12673 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12674 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12675 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12676 | .dac_nids = alc262_dac_nids, |
| 12677 | .hp_nid = 0x03, |
| 12678 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12679 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12680 | .channel_mode = alc262_modes, |
| 12681 | .input_mux = &alc262_capture_source, |
| 12682 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12683 | .setup = alc262_hippo_setup, |
| 12684 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12685 | }, |
| 12686 | [ALC262_HIPPO_1] = { |
| 12687 | .mixers = { alc262_hippo1_mixer }, |
| 12688 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12689 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12690 | .dac_nids = alc262_dac_nids, |
| 12691 | .hp_nid = 0x02, |
| 12692 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12693 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12694 | .channel_mode = alc262_modes, |
| 12695 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12696 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12697 | .setup = alc262_hippo1_setup, |
| 12698 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12699 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12700 | [ALC262_FUJITSU] = { |
| 12701 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12702 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12703 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12704 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12705 | .dac_nids = alc262_dac_nids, |
| 12706 | .hp_nid = 0x03, |
| 12707 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12708 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12709 | .channel_mode = alc262_modes, |
| 12710 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12711 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12712 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12713 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12714 | [ALC262_HP_BPC] = { |
| 12715 | .mixers = { alc262_HP_BPC_mixer }, |
| 12716 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12717 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12718 | .dac_nids = alc262_dac_nids, |
| 12719 | .hp_nid = 0x03, |
| 12720 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12721 | .channel_mode = alc262_modes, |
| 12722 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12723 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12724 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12725 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12726 | [ALC262_HP_BPC_D7000_WF] = { |
| 12727 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12728 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12729 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12730 | .dac_nids = alc262_dac_nids, |
| 12731 | .hp_nid = 0x03, |
| 12732 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12733 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12734 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12735 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12736 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12737 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12738 | [ALC262_HP_BPC_D7000_WL] = { |
| 12739 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12740 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12741 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12742 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12743 | .dac_nids = alc262_dac_nids, |
| 12744 | .hp_nid = 0x03, |
| 12745 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12746 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12747 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12748 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12749 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12750 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12751 | [ALC262_HP_TC_T5735] = { |
| 12752 | .mixers = { alc262_hp_t5735_mixer }, |
| 12753 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12754 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12755 | .dac_nids = alc262_dac_nids, |
| 12756 | .hp_nid = 0x03, |
| 12757 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12758 | .channel_mode = alc262_modes, |
| 12759 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12760 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12761 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12762 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12763 | }, |
| 12764 | [ALC262_HP_RP5700] = { |
| 12765 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12766 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12767 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12768 | .dac_nids = alc262_dac_nids, |
| 12769 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12770 | .channel_mode = alc262_modes, |
| 12771 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12772 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12773 | [ALC262_BENQ_ED8] = { |
| 12774 | .mixers = { alc262_base_mixer }, |
| 12775 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12776 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12777 | .dac_nids = alc262_dac_nids, |
| 12778 | .hp_nid = 0x03, |
| 12779 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12780 | .channel_mode = alc262_modes, |
| 12781 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12782 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12783 | [ALC262_SONY_ASSAMD] = { |
| 12784 | .mixers = { alc262_sony_mixer }, |
| 12785 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12786 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12787 | .dac_nids = alc262_dac_nids, |
| 12788 | .hp_nid = 0x02, |
| 12789 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12790 | .channel_mode = alc262_modes, |
| 12791 | .input_mux = &alc262_capture_source, |
| 12792 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12793 | .setup = alc262_hippo_setup, |
| 12794 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12795 | }, |
| 12796 | [ALC262_BENQ_T31] = { |
| 12797 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12798 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12799 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12800 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12801 | .dac_nids = alc262_dac_nids, |
| 12802 | .hp_nid = 0x03, |
| 12803 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12804 | .channel_mode = alc262_modes, |
| 12805 | .input_mux = &alc262_capture_source, |
| 12806 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12807 | .setup = alc262_hippo_setup, |
| 12808 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12809 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12810 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12811 | .mixers = { alc262_ultra_mixer }, |
| 12812 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12813 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12814 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12815 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12816 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12817 | .channel_mode = alc262_modes, |
| 12818 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12819 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12820 | .capsrc_nids = alc262_capsrc_nids, |
| 12821 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12822 | .unsol_event = alc262_ultra_unsol_event, |
| 12823 | .init_hook = alc262_ultra_automute, |
| 12824 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12825 | [ALC262_LENOVO_3000] = { |
| 12826 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12827 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12828 | alc262_lenovo_3000_unsol_verbs, |
| 12829 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12830 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12831 | .dac_nids = alc262_dac_nids, |
| 12832 | .hp_nid = 0x03, |
| 12833 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12834 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12835 | .channel_mode = alc262_modes, |
| 12836 | .input_mux = &alc262_fujitsu_capture_source, |
| 12837 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12838 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12839 | [ALC262_NEC] = { |
| 12840 | .mixers = { alc262_nec_mixer }, |
| 12841 | .init_verbs = { alc262_nec_verbs }, |
| 12842 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12843 | .dac_nids = alc262_dac_nids, |
| 12844 | .hp_nid = 0x03, |
| 12845 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12846 | .channel_mode = alc262_modes, |
| 12847 | .input_mux = &alc262_capture_source, |
| 12848 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12849 | [ALC262_TOSHIBA_S06] = { |
| 12850 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12851 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12852 | alc262_eapd_verbs }, |
| 12853 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12854 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12855 | .dac_nids = alc262_dac_nids, |
| 12856 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12857 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12858 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12859 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12860 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12861 | .unsol_event = alc_sku_unsol_event, |
| 12862 | .setup = alc262_toshiba_s06_setup, |
| 12863 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12864 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12865 | [ALC262_TOSHIBA_RX1] = { |
| 12866 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12867 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12868 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12869 | .dac_nids = alc262_dac_nids, |
| 12870 | .hp_nid = 0x03, |
| 12871 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12872 | .channel_mode = alc262_modes, |
| 12873 | .input_mux = &alc262_capture_source, |
| 12874 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12875 | .setup = alc262_hippo_setup, |
| 12876 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12877 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12878 | [ALC262_TYAN] = { |
| 12879 | .mixers = { alc262_tyan_mixer }, |
| 12880 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12881 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12882 | .dac_nids = alc262_dac_nids, |
| 12883 | .hp_nid = 0x02, |
| 12884 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12885 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12886 | .channel_mode = alc262_modes, |
| 12887 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12888 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12889 | .setup = alc262_tyan_setup, |
| 12890 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12891 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12892 | }; |
| 12893 | |
| 12894 | static int patch_alc262(struct hda_codec *codec) |
| 12895 | { |
| 12896 | struct alc_spec *spec; |
| 12897 | int board_config; |
| 12898 | int err; |
| 12899 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12900 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12901 | if (spec == NULL) |
| 12902 | return -ENOMEM; |
| 12903 | |
| 12904 | codec->spec = spec; |
| 12905 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12906 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12907 | * under-run |
| 12908 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12909 | { |
| 12910 | int tmp; |
| 12911 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12912 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12913 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12914 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12915 | } |
| 12916 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12917 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12918 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12919 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12920 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12921 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12922 | alc262_models, |
| 12923 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12924 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12925 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12926 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12927 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12928 | board_config = ALC262_AUTO; |
| 12929 | } |
| 12930 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12931 | if (board_config == ALC262_AUTO) { |
| 12932 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12933 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12934 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12935 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12936 | if (board_config == ALC262_AUTO) { |
| 12937 | /* automatic parse from the BIOS config */ |
| 12938 | err = alc262_parse_auto_config(codec); |
| 12939 | if (err < 0) { |
| 12940 | alc_free(codec); |
| 12941 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12942 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12943 | printk(KERN_INFO |
| 12944 | "hda_codec: Cannot set up configuration " |
| 12945 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12946 | board_config = ALC262_BASIC; |
| 12947 | } |
| 12948 | } |
| 12949 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12950 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12951 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12952 | if (err < 0) { |
| 12953 | alc_free(codec); |
| 12954 | return err; |
| 12955 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12956 | } |
| 12957 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12958 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12959 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12961 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12962 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12963 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12964 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12965 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12966 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12967 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12968 | int i; |
| 12969 | /* check whether the digital-mic has to be supported */ |
| 12970 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12971 | if (spec->input_mux->items[i].index >= 9) |
| 12972 | break; |
| 12973 | } |
| 12974 | if (i < spec->input_mux->num_items) { |
| 12975 | /* use only ADC0 */ |
| 12976 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12977 | spec->num_adc_nids = 1; |
| 12978 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12979 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12980 | /* all analog inputs */ |
| 12981 | /* check whether NID 0x07 is valid */ |
| 12982 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12983 | |
| 12984 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12985 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12986 | if (wcap != AC_WID_AUD_IN) { |
| 12987 | spec->adc_nids = alc262_adc_nids_alt; |
| 12988 | spec->num_adc_nids = |
| 12989 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12990 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12991 | } else { |
| 12992 | spec->adc_nids = alc262_adc_nids; |
| 12993 | spec->num_adc_nids = |
| 12994 | ARRAY_SIZE(alc262_adc_nids); |
| 12995 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12996 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12997 | } |
| 12998 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12999 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13000 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13001 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13002 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13003 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13004 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13005 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13006 | spec->vmaster_nid = 0x0c; |
| 13007 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13008 | codec->patch_ops = alc_patch_ops; |
| 13009 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13010 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13011 | |
| 13012 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13013 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13014 | if (!spec->loopback.amplist) |
| 13015 | spec->loopback.amplist = alc262_loopbacks; |
| 13016 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13018 | return 0; |
| 13019 | } |
| 13020 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13021 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13022 | * ALC268 channel source setting (2 channel) |
| 13023 | */ |
| 13024 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13025 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13026 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13027 | static hda_nid_t alc268_dac_nids[2] = { |
| 13028 | /* front, hp */ |
| 13029 | 0x02, 0x03 |
| 13030 | }; |
| 13031 | |
| 13032 | static hda_nid_t alc268_adc_nids[2] = { |
| 13033 | /* ADC0-1 */ |
| 13034 | 0x08, 0x07 |
| 13035 | }; |
| 13036 | |
| 13037 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13038 | /* ADC0 */ |
| 13039 | 0x08 |
| 13040 | }; |
| 13041 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13042 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13043 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13044 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13045 | /* output mixer control */ |
| 13046 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13047 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13048 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13049 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13050 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13051 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13052 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13053 | { } |
| 13054 | }; |
| 13055 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13056 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13057 | /* output mixer control */ |
| 13058 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13059 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13060 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13061 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13062 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13063 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13064 | { } |
| 13065 | }; |
| 13066 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13067 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13068 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13069 | .ops = &snd_hda_bind_sw, |
| 13070 | .values = { |
| 13071 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13072 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13073 | 0 |
| 13074 | }, |
| 13075 | }; |
| 13076 | |
| 13077 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13078 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13079 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13080 | { } |
| 13081 | }; |
| 13082 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13083 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13084 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13085 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13086 | { } |
| 13087 | }; |
| 13088 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13089 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13090 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13091 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13092 | { } /* end */ |
| 13093 | }; |
| 13094 | |
| 13095 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13096 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13097 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13098 | .ops = &snd_hda_bind_vol, |
| 13099 | .values = { |
| 13100 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13101 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13102 | 0 |
| 13103 | }, |
| 13104 | }; |
| 13105 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13106 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13107 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13108 | { |
| 13109 | struct alc_spec *spec = codec->spec; |
| 13110 | unsigned int mute; |
| 13111 | |
| 13112 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13113 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13114 | spec->sense_updated = 1; |
| 13115 | } |
| 13116 | if (spec->jack_present) |
| 13117 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13118 | else /* unmute internal speaker if necessary */ |
| 13119 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13120 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13121 | HDA_AMP_MUTE, mute); |
| 13122 | } |
| 13123 | |
| 13124 | |
| 13125 | /* bind hp and internal speaker mute (with plug check) */ |
| 13126 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13127 | struct snd_ctl_elem_value *ucontrol) |
| 13128 | { |
| 13129 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13130 | long *valp = ucontrol->value.integer.value; |
| 13131 | int change; |
| 13132 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13133 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13134 | if (change) |
| 13135 | alc268_acer_automute(codec, 0); |
| 13136 | return change; |
| 13137 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13138 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13139 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13140 | /* output mixer control */ |
| 13141 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13142 | { |
| 13143 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13144 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13145 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13146 | .info = snd_hda_mixer_amp_switch_info, |
| 13147 | .get = snd_hda_mixer_amp_switch_get, |
| 13148 | .put = alc268_acer_master_sw_put, |
| 13149 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13150 | }, |
| 13151 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13152 | { } |
| 13153 | }; |
| 13154 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13155 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13156 | /* output mixer control */ |
| 13157 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13158 | { |
| 13159 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13160 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13161 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13162 | .info = snd_hda_mixer_amp_switch_info, |
| 13163 | .get = snd_hda_mixer_amp_switch_get, |
| 13164 | .put = alc268_acer_master_sw_put, |
| 13165 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13166 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13167 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13168 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13169 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13170 | { } |
| 13171 | }; |
| 13172 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13173 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13174 | /* output mixer control */ |
| 13175 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13176 | { |
| 13177 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13178 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13179 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13180 | .info = snd_hda_mixer_amp_switch_info, |
| 13181 | .get = snd_hda_mixer_amp_switch_get, |
| 13182 | .put = alc268_acer_master_sw_put, |
| 13183 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13184 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13185 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13186 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13187 | { } |
| 13188 | }; |
| 13189 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13190 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13191 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13192 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13193 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13194 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13195 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13197 | { } |
| 13198 | }; |
| 13199 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13200 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13201 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13202 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13204 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13205 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13206 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13207 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13208 | { } |
| 13209 | }; |
| 13210 | |
| 13211 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13212 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13213 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13214 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13215 | |
| 13216 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13217 | unsigned int res) |
| 13218 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13219 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13220 | return; |
| 13221 | alc268_acer_automute(codec, 1); |
| 13222 | } |
| 13223 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13224 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13225 | { |
| 13226 | alc268_acer_automute(codec, 1); |
| 13227 | } |
| 13228 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13229 | /* toggle speaker-output according to the hp-jack state */ |
| 13230 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13231 | { |
| 13232 | unsigned int present; |
| 13233 | unsigned char bits; |
| 13234 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13235 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13236 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13237 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13238 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13239 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13240 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13241 | } |
| 13242 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13243 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13244 | unsigned int res) |
| 13245 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13246 | switch (res >> 26) { |
| 13247 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13248 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13249 | break; |
| 13250 | case ALC880_MIC_EVENT: |
| 13251 | alc_mic_automute(codec); |
| 13252 | break; |
| 13253 | } |
| 13254 | } |
| 13255 | |
| 13256 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13257 | { |
| 13258 | struct alc_spec *spec = codec->spec; |
| 13259 | spec->ext_mic.pin = 0x18; |
| 13260 | spec->ext_mic.mux_idx = 0; |
| 13261 | spec->int_mic.pin = 0x12; |
| 13262 | spec->int_mic.mux_idx = 6; |
| 13263 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13264 | } |
| 13265 | |
| 13266 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13267 | { |
| 13268 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13269 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13270 | } |
| 13271 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13272 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13273 | /* output mixer control */ |
| 13274 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13275 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13276 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13277 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13278 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13279 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13280 | { } |
| 13281 | }; |
| 13282 | |
| 13283 | static struct hda_verb alc268_dell_verbs[] = { |
| 13284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13285 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13286 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13287 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13288 | { } |
| 13289 | }; |
| 13290 | |
| 13291 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13292 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13293 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13294 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13295 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13296 | spec->autocfg.hp_pins[0] = 0x15; |
| 13297 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13298 | spec->ext_mic.pin = 0x18; |
| 13299 | spec->ext_mic.mux_idx = 0; |
| 13300 | spec->int_mic.pin = 0x19; |
| 13301 | spec->int_mic.mux_idx = 1; |
| 13302 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13303 | } |
| 13304 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13305 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13306 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13307 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13308 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13309 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13310 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13311 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13312 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13313 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13314 | { } |
| 13315 | }; |
| 13316 | |
| 13317 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13318 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13319 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13320 | { } |
| 13321 | }; |
| 13322 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13323 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13324 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13325 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13326 | spec->autocfg.hp_pins[0] = 0x15; |
| 13327 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13328 | spec->ext_mic.pin = 0x18; |
| 13329 | spec->ext_mic.mux_idx = 0; |
| 13330 | spec->int_mic.pin = 0x19; |
| 13331 | spec->int_mic.mux_idx = 1; |
| 13332 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13333 | } |
| 13334 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13335 | /* |
| 13336 | * generic initialization of ADC, input mixers and output mixers |
| 13337 | */ |
| 13338 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13339 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13340 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13341 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13342 | |
| 13343 | /* |
| 13344 | * Set up output mixers (0x0c - 0x0e) |
| 13345 | */ |
| 13346 | /* set vol=0 to output mixers */ |
| 13347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13348 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13349 | |
| 13350 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13351 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13352 | |
| 13353 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13354 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13355 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13356 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13357 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13358 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13359 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13360 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13361 | |
| 13362 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13363 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13364 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13365 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13366 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13367 | |
| 13368 | /* set PCBEEP vol = 0, mute connections */ |
| 13369 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13370 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13371 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13372 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13373 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13374 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13375 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13376 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13377 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13379 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13380 | { } |
| 13381 | }; |
| 13382 | |
| 13383 | /* |
| 13384 | * generic initialization of ADC, input mixers and output mixers |
| 13385 | */ |
| 13386 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13387 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13388 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13389 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13390 | |
| 13391 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13392 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13393 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13394 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13395 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13396 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13397 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13398 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13399 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13400 | |
| 13401 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13402 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13403 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13404 | /* set PCBEEP vol = 0, mute connections */ |
| 13405 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13406 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13407 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13408 | |
| 13409 | { } |
| 13410 | }; |
| 13411 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13412 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13413 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13414 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13415 | { } /* end */ |
| 13416 | }; |
| 13417 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13418 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13419 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13420 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13421 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13422 | { } /* end */ |
| 13423 | }; |
| 13424 | |
| 13425 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13426 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13427 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13428 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13429 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13430 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13431 | { } /* end */ |
| 13432 | }; |
| 13433 | |
| 13434 | static struct hda_input_mux alc268_capture_source = { |
| 13435 | .num_items = 4, |
| 13436 | .items = { |
| 13437 | { "Mic", 0x0 }, |
| 13438 | { "Front Mic", 0x1 }, |
| 13439 | { "Line", 0x2 }, |
| 13440 | { "CD", 0x3 }, |
| 13441 | }, |
| 13442 | }; |
| 13443 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13444 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13445 | .num_items = 3, |
| 13446 | .items = { |
| 13447 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13448 | { "Internal Mic", 0x1 }, |
| 13449 | { "Line", 0x2 }, |
| 13450 | }, |
| 13451 | }; |
| 13452 | |
| 13453 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13454 | .num_items = 3, |
| 13455 | .items = { |
| 13456 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13457 | { "Internal Mic", 0x6 }, |
| 13458 | { "Line", 0x2 }, |
| 13459 | }, |
| 13460 | }; |
| 13461 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13462 | #ifdef CONFIG_SND_DEBUG |
| 13463 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13464 | /* Volume widgets */ |
| 13465 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13466 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13467 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13468 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13469 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13470 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13471 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13472 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13473 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13474 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13475 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13476 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13477 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13478 | /* The below appears problematic on some hardwares */ |
| 13479 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13480 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13481 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13482 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13483 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13484 | |
| 13485 | /* Modes for retasking pin widgets */ |
| 13486 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13487 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13488 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13489 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13490 | |
| 13491 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13492 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13493 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13494 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13495 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13496 | |
| 13497 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13498 | * The ALC268 does not have an SPDIF input. |
| 13499 | */ |
| 13500 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13501 | |
| 13502 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13503 | * this output to turn on an external amplifier. |
| 13504 | */ |
| 13505 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13506 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13507 | |
| 13508 | { } /* end */ |
| 13509 | }; |
| 13510 | #endif |
| 13511 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13512 | /* create input playback/capture controls for the given pin */ |
| 13513 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13514 | const char *ctlname, int idx) |
| 13515 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13516 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13517 | int err; |
| 13518 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13519 | switch (nid) { |
| 13520 | case 0x14: |
| 13521 | case 0x16: |
| 13522 | dac = 0x02; |
| 13523 | break; |
| 13524 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13525 | case 0x1a: /* ALC259/269 only */ |
| 13526 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13527 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13528 | dac = 0x03; |
| 13529 | break; |
| 13530 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13531 | snd_printd(KERN_WARNING "hda_codec: " |
| 13532 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13533 | return 0; |
| 13534 | } |
| 13535 | if (spec->multiout.dac_nids[0] != dac && |
| 13536 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13537 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13538 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13539 | HDA_OUTPUT)); |
| 13540 | if (err < 0) |
| 13541 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13542 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13543 | } |
| 13544 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13545 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13546 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13547 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13548 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13549 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13550 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13551 | if (err < 0) |
| 13552 | return err; |
| 13553 | return 0; |
| 13554 | } |
| 13555 | |
| 13556 | /* add playback controls from the parsed DAC table */ |
| 13557 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13558 | const struct auto_pin_cfg *cfg) |
| 13559 | { |
| 13560 | hda_nid_t nid; |
| 13561 | int err; |
| 13562 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13563 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13564 | |
| 13565 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13566 | if (nid) { |
| 13567 | const char *name; |
| 13568 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13569 | name = "Speaker"; |
| 13570 | else |
| 13571 | name = "Front"; |
| 13572 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13573 | if (err < 0) |
| 13574 | return err; |
| 13575 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13576 | |
| 13577 | nid = cfg->speaker_pins[0]; |
| 13578 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13579 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13580 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13581 | if (err < 0) |
| 13582 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13583 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13584 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13585 | if (err < 0) |
| 13586 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13587 | } |
| 13588 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13589 | if (nid) { |
| 13590 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13591 | if (err < 0) |
| 13592 | return err; |
| 13593 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13594 | |
| 13595 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13596 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13597 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13598 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13599 | if (err < 0) |
| 13600 | return err; |
| 13601 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13602 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13603 | } |
| 13604 | |
| 13605 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13606 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13607 | const struct auto_pin_cfg *cfg) |
| 13608 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13609 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13610 | } |
| 13611 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13612 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13613 | hda_nid_t nid, int pin_type) |
| 13614 | { |
| 13615 | int idx; |
| 13616 | |
| 13617 | alc_set_pin_output(codec, nid, pin_type); |
| 13618 | if (nid == 0x14 || nid == 0x16) |
| 13619 | idx = 0; |
| 13620 | else |
| 13621 | idx = 1; |
| 13622 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13623 | } |
| 13624 | |
| 13625 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13626 | { |
| 13627 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13628 | int i; |
| 13629 | |
| 13630 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13631 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13632 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13633 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13634 | } |
| 13635 | } |
| 13636 | |
| 13637 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13638 | { |
| 13639 | struct alc_spec *spec = codec->spec; |
| 13640 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13641 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13642 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13643 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13644 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13645 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13646 | } |
| 13647 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13648 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13649 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13650 | } |
| 13651 | if (spec->autocfg.mono_out_pin) |
| 13652 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13653 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13654 | } |
| 13655 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13656 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13657 | { |
| 13658 | struct alc_spec *spec = codec->spec; |
| 13659 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13660 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13661 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13662 | unsigned int dac_vol1, dac_vol2; |
| 13663 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13664 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13665 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13666 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13667 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13668 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13669 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13670 | AMP_IN_UNMUTE(1)); |
| 13671 | snd_hda_codec_write(codec, 0x10, 0, |
| 13672 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13673 | AMP_IN_UNMUTE(1)); |
| 13674 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13675 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13676 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13677 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13678 | snd_hda_codec_write(codec, 0x10, 0, |
| 13679 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13680 | } |
| 13681 | |
| 13682 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13683 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13684 | dac_vol2 = AMP_OUT_ZERO; |
| 13685 | else if (line_nid == 0x15) |
| 13686 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13687 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13688 | dac_vol2 = AMP_OUT_ZERO; |
| 13689 | else if (hp_nid == 0x15) |
| 13690 | dac_vol1 = AMP_OUT_ZERO; |
| 13691 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13692 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13693 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13694 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13695 | |
| 13696 | snd_hda_codec_write(codec, 0x02, 0, |
| 13697 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13698 | snd_hda_codec_write(codec, 0x03, 0, |
| 13699 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13700 | } |
| 13701 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13702 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13703 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13704 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13705 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13706 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13707 | |
| 13708 | /* |
| 13709 | * BIOS auto configuration |
| 13710 | */ |
| 13711 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13712 | { |
| 13713 | struct alc_spec *spec = codec->spec; |
| 13714 | int err; |
| 13715 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13716 | |
| 13717 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13718 | alc268_ignore); |
| 13719 | if (err < 0) |
| 13720 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13721 | if (!spec->autocfg.line_outs) { |
| 13722 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13723 | spec->multiout.max_channels = 2; |
| 13724 | spec->no_analog = 1; |
| 13725 | goto dig_only; |
| 13726 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13727 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13728 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13729 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13730 | if (err < 0) |
| 13731 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13732 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13733 | if (err < 0) |
| 13734 | return err; |
| 13735 | |
| 13736 | spec->multiout.max_channels = 2; |
| 13737 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13738 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13739 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13740 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13741 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13742 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13744 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13745 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13746 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13747 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13748 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13749 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13750 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13751 | err = alc_auto_add_mic_boost(codec); |
| 13752 | if (err < 0) |
| 13753 | return err; |
| 13754 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13755 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13756 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13757 | return 1; |
| 13758 | } |
| 13759 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13760 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame^] | 13761 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13762 | |
| 13763 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13764 | static void alc268_auto_init(struct hda_codec *codec) |
| 13765 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13766 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13767 | alc268_auto_init_multi_out(codec); |
| 13768 | alc268_auto_init_hp_out(codec); |
| 13769 | alc268_auto_init_mono_speaker_out(codec); |
| 13770 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame^] | 13771 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13772 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13773 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13774 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13775 | } |
| 13776 | |
| 13777 | /* |
| 13778 | * configuration and preset |
| 13779 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13780 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13781 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13782 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13783 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13784 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13785 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13786 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13787 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13788 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13789 | #ifdef CONFIG_SND_DEBUG |
| 13790 | [ALC268_TEST] = "test", |
| 13791 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13792 | [ALC268_AUTO] = "auto", |
| 13793 | }; |
| 13794 | |
| 13795 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13796 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13797 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13798 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13799 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13800 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13801 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13802 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13803 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13804 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13805 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13806 | /* almost compatible with toshiba but with optional digital outs; |
| 13807 | * auto-probing seems working fine |
| 13808 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13809 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13810 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13811 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13812 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13813 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13814 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13815 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13816 | {} |
| 13817 | }; |
| 13818 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13819 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13820 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13821 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13822 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13823 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13824 | ALC268_TOSHIBA), |
| 13825 | {} |
| 13826 | }; |
| 13827 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13828 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13829 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13830 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13831 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13832 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13833 | alc267_quanta_il1_verbs }, |
| 13834 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13835 | .dac_nids = alc268_dac_nids, |
| 13836 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13837 | .adc_nids = alc268_adc_nids_alt, |
| 13838 | .hp_nid = 0x03, |
| 13839 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13840 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13841 | .unsol_event = alc_sku_unsol_event, |
| 13842 | .setup = alc267_quanta_il1_setup, |
| 13843 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13844 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13845 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13846 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13847 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13848 | .init_verbs = { alc268_base_init_verbs }, |
| 13849 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13850 | .dac_nids = alc268_dac_nids, |
| 13851 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13852 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13853 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13854 | .hp_nid = 0x03, |
| 13855 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13856 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13857 | .channel_mode = alc268_modes, |
| 13858 | .input_mux = &alc268_capture_source, |
| 13859 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13860 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13861 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13862 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13863 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13864 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13865 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13866 | .dac_nids = alc268_dac_nids, |
| 13867 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13868 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13869 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13870 | .hp_nid = 0x03, |
| 13871 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13872 | .channel_mode = alc268_modes, |
| 13873 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13874 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13875 | .setup = alc268_toshiba_setup, |
| 13876 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13877 | }, |
| 13878 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13879 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13880 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13881 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13882 | alc268_acer_verbs }, |
| 13883 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13884 | .dac_nids = alc268_dac_nids, |
| 13885 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13886 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13887 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13888 | .hp_nid = 0x02, |
| 13889 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13890 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13891 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13892 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13893 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13894 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13895 | [ALC268_ACER_DMIC] = { |
| 13896 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13897 | alc268_beep_mixer }, |
| 13898 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13899 | alc268_acer_verbs }, |
| 13900 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13901 | .dac_nids = alc268_dac_nids, |
| 13902 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13903 | .adc_nids = alc268_adc_nids_alt, |
| 13904 | .capsrc_nids = alc268_capsrc_nids, |
| 13905 | .hp_nid = 0x02, |
| 13906 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13907 | .channel_mode = alc268_modes, |
| 13908 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13909 | .unsol_event = alc268_acer_unsol_event, |
| 13910 | .init_hook = alc268_acer_init_hook, |
| 13911 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13912 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13913 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13914 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13915 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13916 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13917 | alc268_acer_aspire_one_verbs }, |
| 13918 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13919 | .dac_nids = alc268_dac_nids, |
| 13920 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13921 | .adc_nids = alc268_adc_nids_alt, |
| 13922 | .capsrc_nids = alc268_capsrc_nids, |
| 13923 | .hp_nid = 0x03, |
| 13924 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13925 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13926 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13927 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13928 | .init_hook = alc268_acer_lc_init_hook, |
| 13929 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13930 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13931 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13932 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13933 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13934 | alc268_dell_verbs }, |
| 13935 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13936 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13937 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13938 | .adc_nids = alc268_adc_nids_alt, |
| 13939 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13940 | .hp_nid = 0x02, |
| 13941 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13942 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13943 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13944 | .setup = alc268_dell_setup, |
| 13945 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13946 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13947 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13948 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13949 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13950 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13951 | alc268_toshiba_verbs }, |
| 13952 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13953 | .dac_nids = alc268_dac_nids, |
| 13954 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13955 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13956 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13957 | .hp_nid = 0x03, |
| 13958 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13959 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13960 | .channel_mode = alc268_modes, |
| 13961 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13962 | .setup = alc268_toshiba_setup, |
| 13963 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13964 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13965 | #ifdef CONFIG_SND_DEBUG |
| 13966 | [ALC268_TEST] = { |
| 13967 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13968 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13969 | alc268_volume_init_verbs }, |
| 13970 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13971 | .dac_nids = alc268_dac_nids, |
| 13972 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13973 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13974 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13975 | .hp_nid = 0x03, |
| 13976 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13977 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13978 | .channel_mode = alc268_modes, |
| 13979 | .input_mux = &alc268_capture_source, |
| 13980 | }, |
| 13981 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13982 | }; |
| 13983 | |
| 13984 | static int patch_alc268(struct hda_codec *codec) |
| 13985 | { |
| 13986 | struct alc_spec *spec; |
| 13987 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13988 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13989 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13990 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13991 | if (spec == NULL) |
| 13992 | return -ENOMEM; |
| 13993 | |
| 13994 | codec->spec = spec; |
| 13995 | |
| 13996 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13997 | alc268_models, |
| 13998 | alc268_cfg_tbl); |
| 13999 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14000 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14001 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14002 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14003 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14004 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14005 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14006 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14007 | board_config = ALC268_AUTO; |
| 14008 | } |
| 14009 | |
| 14010 | if (board_config == ALC268_AUTO) { |
| 14011 | /* automatic parse from the BIOS config */ |
| 14012 | err = alc268_parse_auto_config(codec); |
| 14013 | if (err < 0) { |
| 14014 | alc_free(codec); |
| 14015 | return err; |
| 14016 | } else if (!err) { |
| 14017 | printk(KERN_INFO |
| 14018 | "hda_codec: Cannot set up configuration " |
| 14019 | "from BIOS. Using base mode...\n"); |
| 14020 | board_config = ALC268_3ST; |
| 14021 | } |
| 14022 | } |
| 14023 | |
| 14024 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14025 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14026 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14027 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14028 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14029 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14030 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14031 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14032 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14033 | has_beep = 0; |
| 14034 | for (i = 0; i < spec->num_mixers; i++) { |
| 14035 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14036 | has_beep = 1; |
| 14037 | break; |
| 14038 | } |
| 14039 | } |
| 14040 | |
| 14041 | if (has_beep) { |
| 14042 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14043 | if (err < 0) { |
| 14044 | alc_free(codec); |
| 14045 | return err; |
| 14046 | } |
| 14047 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14048 | /* override the amp caps for beep generator */ |
| 14049 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14050 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14051 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14052 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14053 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14054 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14055 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14056 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14057 | /* check whether NID 0x07 is valid */ |
| 14058 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14059 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14060 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14061 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14062 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14063 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14064 | if (spec->auto_mic || |
| 14065 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14066 | spec->adc_nids = alc268_adc_nids_alt; |
| 14067 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14068 | if (spec->auto_mic) |
| 14069 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14070 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14071 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14072 | else |
| 14073 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14074 | } else { |
| 14075 | spec->adc_nids = alc268_adc_nids; |
| 14076 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14077 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14078 | } |
| 14079 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14080 | |
| 14081 | spec->vmaster_nid = 0x02; |
| 14082 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14083 | codec->patch_ops = alc_patch_ops; |
| 14084 | if (board_config == ALC268_AUTO) |
| 14085 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14086 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14087 | alc_init_jacks(codec); |
| 14088 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14089 | return 0; |
| 14090 | } |
| 14091 | |
| 14092 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14093 | * ALC269 channel source setting (2 channel) |
| 14094 | */ |
| 14095 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14096 | |
| 14097 | #define alc269_dac_nids alc260_dac_nids |
| 14098 | |
| 14099 | static hda_nid_t alc269_adc_nids[1] = { |
| 14100 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14101 | 0x08, |
| 14102 | }; |
| 14103 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14104 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14105 | 0x23, |
| 14106 | }; |
| 14107 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14108 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14109 | /* ADC1 */ |
| 14110 | 0x09, |
| 14111 | }; |
| 14112 | |
| 14113 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14114 | 0x22, |
| 14115 | }; |
| 14116 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14117 | static hda_nid_t alc269_adc_candidates[] = { |
| 14118 | 0x08, 0x09, 0x07, |
| 14119 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14120 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14121 | #define alc269_modes alc260_modes |
| 14122 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14123 | |
| 14124 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14125 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14126 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14131 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14132 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14133 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14134 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14135 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14136 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14137 | { } /* end */ |
| 14138 | }; |
| 14139 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14140 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14141 | /* output mixer control */ |
| 14142 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14143 | { |
| 14144 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14145 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14146 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14147 | .info = snd_hda_mixer_amp_switch_info, |
| 14148 | .get = snd_hda_mixer_amp_switch_get, |
| 14149 | .put = alc268_acer_master_sw_put, |
| 14150 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14151 | }, |
| 14152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14153 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14154 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14155 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14156 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14157 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14158 | { } |
| 14159 | }; |
| 14160 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14161 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14162 | /* output mixer control */ |
| 14163 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14164 | { |
| 14165 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14166 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14167 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14168 | .info = snd_hda_mixer_amp_switch_info, |
| 14169 | .get = snd_hda_mixer_amp_switch_get, |
| 14170 | .put = alc268_acer_master_sw_put, |
| 14171 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14172 | }, |
| 14173 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14174 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14175 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14176 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14177 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14178 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14179 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14180 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14181 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14182 | { } |
| 14183 | }; |
| 14184 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14185 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14186 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14187 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14188 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14189 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14190 | { } /* end */ |
| 14191 | }; |
| 14192 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14193 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14194 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14195 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14196 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14197 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14198 | { } /* end */ |
| 14199 | }; |
| 14200 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14201 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14202 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14203 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14204 | { } /* end */ |
| 14205 | }; |
| 14206 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14207 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14208 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14209 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14210 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14211 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14212 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14213 | { } /* end */ |
| 14214 | }; |
| 14215 | |
| 14216 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14217 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14218 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14219 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14220 | { } /* end */ |
| 14221 | }; |
| 14222 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14223 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14224 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14225 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14226 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14227 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14228 | { } /* end */ |
| 14229 | }; |
| 14230 | |
| 14231 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14232 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14233 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14234 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14235 | { } /* end */ |
| 14236 | }; |
| 14237 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14238 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14239 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14240 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14241 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14242 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14243 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14244 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14245 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14246 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14247 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14248 | { } |
| 14249 | }; |
| 14250 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14251 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14252 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14253 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14254 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14256 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14257 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14258 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14259 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14260 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14261 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14262 | { } |
| 14263 | }; |
| 14264 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14265 | /* toggle speaker-output according to the hp-jack state */ |
| 14266 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14267 | { |
| 14268 | unsigned int present; |
| 14269 | unsigned char bits; |
| 14270 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14271 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14272 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14273 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14274 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14275 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14276 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14277 | |
| 14278 | snd_hda_codec_write(codec, 0x20, 0, |
| 14279 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14280 | snd_hda_codec_write(codec, 0x20, 0, |
| 14281 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14282 | |
| 14283 | snd_hda_codec_write(codec, 0x20, 0, |
| 14284 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14285 | snd_hda_codec_write(codec, 0x20, 0, |
| 14286 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14287 | } |
| 14288 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14289 | /* toggle speaker-output according to the hp-jacks state */ |
| 14290 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14291 | { |
| 14292 | unsigned int present; |
| 14293 | unsigned char bits; |
| 14294 | |
| 14295 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14296 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14297 | |
| 14298 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14299 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14300 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14301 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14302 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14303 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14304 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14305 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14306 | |
| 14307 | snd_hda_codec_write(codec, 0x20, 0, |
| 14308 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14309 | snd_hda_codec_write(codec, 0x20, 0, |
| 14310 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14311 | |
| 14312 | snd_hda_codec_write(codec, 0x20, 0, |
| 14313 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14314 | snd_hda_codec_write(codec, 0x20, 0, |
| 14315 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14316 | } |
| 14317 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14318 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14319 | { |
| 14320 | unsigned int present_laptop; |
| 14321 | unsigned int present_dock; |
| 14322 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14323 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14324 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14325 | |
| 14326 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14327 | if (present_dock) |
| 14328 | snd_hda_codec_write(codec, 0x23, 0, |
| 14329 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14330 | if (present_laptop) |
| 14331 | snd_hda_codec_write(codec, 0x23, 0, |
| 14332 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14333 | if (!present_dock && !present_laptop) |
| 14334 | snd_hda_codec_write(codec, 0x23, 0, |
| 14335 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14336 | } |
| 14337 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14338 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14339 | unsigned int res) |
| 14340 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14341 | switch (res >> 26) { |
| 14342 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14343 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14344 | break; |
| 14345 | case ALC880_MIC_EVENT: |
| 14346 | alc_mic_automute(codec); |
| 14347 | break; |
| 14348 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14349 | } |
| 14350 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14351 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14352 | unsigned int res) |
| 14353 | { |
| 14354 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14355 | alc269_lifebook_speaker_automute(codec); |
| 14356 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14357 | alc269_lifebook_mic_autoswitch(codec); |
| 14358 | } |
| 14359 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14360 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14361 | { |
| 14362 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14363 | spec->autocfg.hp_pins[0] = 0x15; |
| 14364 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14365 | spec->ext_mic.pin = 0x18; |
| 14366 | spec->ext_mic.mux_idx = 0; |
| 14367 | spec->int_mic.pin = 0x19; |
| 14368 | spec->int_mic.mux_idx = 1; |
| 14369 | spec->auto_mic = 1; |
| 14370 | } |
| 14371 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14372 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14373 | { |
| 14374 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14375 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14376 | } |
| 14377 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14378 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14379 | { |
| 14380 | alc269_lifebook_speaker_automute(codec); |
| 14381 | alc269_lifebook_mic_autoswitch(codec); |
| 14382 | } |
| 14383 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14384 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14385 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14386 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14387 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14388 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14389 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14390 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14391 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14392 | {} |
| 14393 | }; |
| 14394 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14395 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14396 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14397 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14398 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14399 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14400 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14401 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14402 | {} |
| 14403 | }; |
| 14404 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14405 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14406 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14407 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14408 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14409 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14410 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14411 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14412 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14413 | {} |
| 14414 | }; |
| 14415 | |
| 14416 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14417 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14418 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14419 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14420 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14421 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14422 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14423 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14424 | {} |
| 14425 | }; |
| 14426 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14427 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14428 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14429 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14430 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14431 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14432 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14433 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14434 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14435 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14436 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14437 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14438 | { } |
| 14439 | }; |
| 14440 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14441 | /* toggle speaker-output according to the hp-jack state */ |
| 14442 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14443 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14444 | struct alc_spec *spec = codec->spec; |
| 14445 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14446 | unsigned int present; |
| 14447 | unsigned char bits; |
| 14448 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14449 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14450 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14451 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14452 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14453 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14454 | HDA_AMP_MUTE, bits); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 14455 | snd_hda_input_jack_report(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14456 | } |
| 14457 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14458 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14459 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14460 | unsigned int res) |
| 14461 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14462 | switch (res >> 26) { |
| 14463 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14464 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14465 | break; |
| 14466 | case ALC880_MIC_EVENT: |
| 14467 | alc_mic_automute(codec); |
| 14468 | break; |
| 14469 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14470 | } |
| 14471 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14472 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14473 | { |
| 14474 | struct alc_spec *spec = codec->spec; |
| 14475 | spec->autocfg.hp_pins[0] = 0x15; |
| 14476 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14477 | spec->ext_mic.pin = 0x18; |
| 14478 | spec->ext_mic.mux_idx = 0; |
| 14479 | spec->int_mic.pin = 0x19; |
| 14480 | spec->int_mic.mux_idx = 1; |
| 14481 | spec->auto_mic = 1; |
| 14482 | } |
| 14483 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14484 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14485 | { |
| 14486 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14487 | spec->autocfg.hp_pins[0] = 0x15; |
| 14488 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14489 | spec->ext_mic.pin = 0x18; |
| 14490 | spec->ext_mic.mux_idx = 0; |
| 14491 | spec->int_mic.pin = 0x12; |
| 14492 | spec->int_mic.mux_idx = 5; |
| 14493 | spec->auto_mic = 1; |
| 14494 | } |
| 14495 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14496 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14497 | { |
| 14498 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14499 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14500 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14501 | spec->ext_mic.pin = 0x18; |
| 14502 | spec->ext_mic.mux_idx = 0; |
| 14503 | spec->int_mic.pin = 0x19; |
| 14504 | spec->int_mic.mux_idx = 1; |
| 14505 | spec->auto_mic = 1; |
| 14506 | } |
| 14507 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14508 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14509 | { |
| 14510 | struct alc_spec *spec = codec->spec; |
| 14511 | spec->autocfg.hp_pins[0] = 0x21; |
| 14512 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14513 | spec->ext_mic.pin = 0x18; |
| 14514 | spec->ext_mic.mux_idx = 0; |
| 14515 | spec->int_mic.pin = 0x12; |
| 14516 | spec->int_mic.mux_idx = 6; |
| 14517 | spec->auto_mic = 1; |
| 14518 | } |
| 14519 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14520 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14521 | { |
| 14522 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14523 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14524 | } |
| 14525 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14526 | /* |
| 14527 | * generic initialization of ADC, input mixers and output mixers |
| 14528 | */ |
| 14529 | static struct hda_verb alc269_init_verbs[] = { |
| 14530 | /* |
| 14531 | * Unmute ADC0 and set the default input to mic-in |
| 14532 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14533 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14534 | |
| 14535 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14536 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14537 | */ |
| 14538 | /* set vol=0 to output mixers */ |
| 14539 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14540 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14541 | |
| 14542 | /* set up input amps for analog loopback */ |
| 14543 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14544 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14545 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14546 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14547 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14548 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14549 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14550 | |
| 14551 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14552 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14553 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14554 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14555 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14556 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14557 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14558 | |
| 14559 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14560 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14561 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14562 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14563 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14564 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14565 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14566 | |
| 14567 | /* set EAPD */ |
| 14568 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14569 | { } |
| 14570 | }; |
| 14571 | |
| 14572 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14573 | /* |
| 14574 | * Unmute ADC0 and set the default input to mic-in |
| 14575 | */ |
| 14576 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14577 | |
| 14578 | /* |
| 14579 | * Set up output mixers (0x02 - 0x03) |
| 14580 | */ |
| 14581 | /* set vol=0 to output mixers */ |
| 14582 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14583 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14584 | |
| 14585 | /* set up input amps for analog loopback */ |
| 14586 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14590 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14591 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14592 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14593 | |
| 14594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14595 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14596 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14597 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14598 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14599 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14600 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14601 | |
| 14602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14603 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14604 | |
| 14605 | /* FIXME: use Mux-type input source selection */ |
| 14606 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14607 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14608 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14609 | |
| 14610 | /* set EAPD */ |
| 14611 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14612 | { } |
| 14613 | }; |
| 14614 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14615 | #define alc269_auto_create_multi_out_ctls \ |
| 14616 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14617 | #define alc269_auto_create_input_ctls \ |
| 14618 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14619 | |
| 14620 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14621 | #define alc269_loopbacks alc880_loopbacks |
| 14622 | #endif |
| 14623 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14624 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14625 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14626 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14627 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14628 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14629 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14630 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14631 | .substreams = 1, |
| 14632 | .channels_min = 2, |
| 14633 | .channels_max = 8, |
| 14634 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14635 | /* NID is set in alc_build_pcms */ |
| 14636 | .ops = { |
| 14637 | .open = alc880_playback_pcm_open, |
| 14638 | .prepare = alc880_playback_pcm_prepare, |
| 14639 | .cleanup = alc880_playback_pcm_cleanup |
| 14640 | }, |
| 14641 | }; |
| 14642 | |
| 14643 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14644 | .substreams = 1, |
| 14645 | .channels_min = 2, |
| 14646 | .channels_max = 2, |
| 14647 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14648 | /* NID is set in alc_build_pcms */ |
| 14649 | }; |
| 14650 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14651 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14652 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14653 | { |
| 14654 | switch (codec->subsystem_id) { |
| 14655 | case 0x103c1586: |
| 14656 | return 1; |
| 14657 | } |
| 14658 | return 0; |
| 14659 | } |
| 14660 | |
| 14661 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14662 | { |
| 14663 | /* update mute-LED according to the speaker mute state */ |
| 14664 | if (nid == 0x01 || nid == 0x14) { |
| 14665 | int pinval; |
| 14666 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14667 | HDA_AMP_MUTE) |
| 14668 | pinval = 0x24; |
| 14669 | else |
| 14670 | pinval = 0x20; |
| 14671 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14672 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14673 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14674 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14675 | } |
| 14676 | return alc_check_power_status(codec, nid); |
| 14677 | } |
| 14678 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14679 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14680 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14681 | { |
| 14682 | struct alc_spec *spec = codec->spec; |
| 14683 | |
| 14684 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14685 | return 0; |
| 14686 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14687 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14688 | if (spec->ext_mic.pin <= 0x12) { |
| 14689 | spec->private_adc_nids[0] = 0x08; |
| 14690 | spec->private_adc_nids[1] = 0x11; |
| 14691 | spec->private_capsrc_nids[0] = 0x23; |
| 14692 | spec->private_capsrc_nids[1] = 0x22; |
| 14693 | } else { |
| 14694 | spec->private_adc_nids[0] = 0x11; |
| 14695 | spec->private_adc_nids[1] = 0x08; |
| 14696 | spec->private_capsrc_nids[0] = 0x22; |
| 14697 | spec->private_capsrc_nids[1] = 0x23; |
| 14698 | } |
| 14699 | spec->adc_nids = spec->private_adc_nids; |
| 14700 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14701 | spec->num_adc_nids = 2; |
| 14702 | spec->dual_adc_switch = 1; |
| 14703 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14704 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14705 | return 1; |
| 14706 | } |
| 14707 | return 0; |
| 14708 | } |
| 14709 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14710 | /* different alc269-variants */ |
| 14711 | enum { |
| 14712 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14713 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14714 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14715 | ALC269_TYPE_ALC269VB, |
| 14716 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14717 | ALC269_TYPE_ALC271X, |
| 14718 | }; |
| 14719 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14720 | /* |
| 14721 | * BIOS auto configuration |
| 14722 | */ |
| 14723 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14724 | { |
| 14725 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14726 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14727 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14728 | |
| 14729 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14730 | alc269_ignore); |
| 14731 | if (err < 0) |
| 14732 | return err; |
| 14733 | |
| 14734 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14735 | if (err < 0) |
| 14736 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14737 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14738 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14739 | else |
| 14740 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14741 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14742 | if (err < 0) |
| 14743 | return err; |
| 14744 | |
| 14745 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14746 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14747 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14748 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14749 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14750 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14751 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14752 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14753 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14754 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14755 | } else { |
| 14756 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14757 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14758 | } |
| 14759 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14760 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14761 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14762 | |
| 14763 | if (!alc275_setup_dual_adc(codec)) |
| 14764 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14765 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14766 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14767 | err = alc_auto_add_mic_boost(codec); |
| 14768 | if (err < 0) |
| 14769 | return err; |
| 14770 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14771 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14772 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14773 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14774 | return 1; |
| 14775 | } |
| 14776 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14777 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14778 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14779 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame^] | 14780 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14781 | |
| 14782 | |
| 14783 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14784 | static void alc269_auto_init(struct hda_codec *codec) |
| 14785 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14786 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14787 | alc269_auto_init_multi_out(codec); |
| 14788 | alc269_auto_init_hp_out(codec); |
| 14789 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame^] | 14790 | if (!spec->dual_adc_switch) |
| 14791 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14792 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14793 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14794 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14795 | } |
| 14796 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14797 | #ifdef SND_HDA_NEEDS_RESUME |
| 14798 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14799 | { |
| 14800 | int val = alc_read_coef_idx(codec, 0x04); |
| 14801 | if (power_up) |
| 14802 | val |= 1 << 11; |
| 14803 | else |
| 14804 | val &= ~(1 << 11); |
| 14805 | alc_write_coef_idx(codec, 0x04, val); |
| 14806 | } |
| 14807 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14808 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14809 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14810 | { |
| 14811 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14812 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14813 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14814 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14815 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14816 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14817 | msleep(150); |
| 14818 | } |
| 14819 | |
| 14820 | alc_shutup(codec); |
| 14821 | if (spec && spec->power_hook) |
| 14822 | spec->power_hook(codec); |
| 14823 | return 0; |
| 14824 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14825 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14826 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14827 | static int alc269_resume(struct hda_codec *codec) |
| 14828 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14829 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14830 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14831 | msleep(150); |
| 14832 | } |
| 14833 | |
| 14834 | codec->patch_ops.init(codec); |
| 14835 | |
| 14836 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14837 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14838 | msleep(200); |
| 14839 | } |
| 14840 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14841 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14842 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14843 | |
| 14844 | snd_hda_codec_resume_amp(codec); |
| 14845 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14846 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14847 | return 0; |
| 14848 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14849 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14850 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14851 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14852 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14853 | { |
| 14854 | int coef; |
| 14855 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14856 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14857 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14858 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14859 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14860 | } |
| 14861 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14862 | enum { |
| 14863 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14864 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14865 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14866 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14867 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14868 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14869 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14870 | }; |
| 14871 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14872 | static const struct alc_fixup alc269_fixups[] = { |
| 14873 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14874 | .type = ALC_FIXUP_VERBS, |
| 14875 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14876 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14877 | {} |
| 14878 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14879 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14880 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14881 | .type = ALC_FIXUP_VERBS, |
| 14882 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14883 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14884 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14885 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14886 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14887 | }, |
| 14888 | .chained = true, |
| 14889 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14890 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14891 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14892 | .type = ALC_FIXUP_VERBS, |
| 14893 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14894 | /* Enables internal speaker */ |
| 14895 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14896 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14897 | {} |
| 14898 | } |
| 14899 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14900 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14901 | .type = ALC_FIXUP_SKU, |
| 14902 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14903 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14904 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14905 | .type = ALC_FIXUP_PINS, |
| 14906 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14907 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14908 | { } |
| 14909 | } |
| 14910 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14911 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14912 | .type = ALC_FIXUP_VERBS, |
| 14913 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14914 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14915 | {} |
| 14916 | } |
| 14917 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14918 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14919 | .type = ALC_FIXUP_FUNC, |
| 14920 | .v.func = alc269_fixup_hweq, |
| 14921 | .chained = true, |
| 14922 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14923 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14924 | }; |
| 14925 | |
| 14926 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14927 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14928 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14929 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14930 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14931 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14932 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14933 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14934 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14935 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14936 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14937 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14938 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14939 | {} |
| 14940 | }; |
| 14941 | |
| 14942 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14943 | /* |
| 14944 | * configuration and preset |
| 14945 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14946 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14947 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14948 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14949 | [ALC269_AMIC] = "laptop-amic", |
| 14950 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14951 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14952 | [ALC269_LIFEBOOK] = "lifebook", |
| 14953 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14954 | }; |
| 14955 | |
| 14956 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14957 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14958 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14959 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14960 | ALC269_AMIC), |
| 14961 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14962 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14963 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14964 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14965 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14966 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14967 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14968 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14969 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 14970 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14971 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14972 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14973 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14974 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14975 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14976 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14977 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14978 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14979 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14980 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14981 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14982 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14983 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14984 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14985 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14986 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14987 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14988 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14989 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14990 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14991 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14992 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14993 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14994 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14995 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14996 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14997 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14998 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14999 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15000 | ALC269_DMIC), |
| 15001 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 15002 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15003 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15004 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 15005 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 15006 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 15007 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 15008 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 15009 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 15010 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15011 | {} |
| 15012 | }; |
| 15013 | |
| 15014 | static struct alc_config_preset alc269_presets[] = { |
| 15015 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15016 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15017 | .init_verbs = { alc269_init_verbs }, |
| 15018 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15019 | .dac_nids = alc269_dac_nids, |
| 15020 | .hp_nid = 0x03, |
| 15021 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15022 | .channel_mode = alc269_modes, |
| 15023 | .input_mux = &alc269_capture_source, |
| 15024 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15025 | [ALC269_QUANTA_FL1] = { |
| 15026 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15027 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15028 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15029 | .dac_nids = alc269_dac_nids, |
| 15030 | .hp_nid = 0x03, |
| 15031 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15032 | .channel_mode = alc269_modes, |
| 15033 | .input_mux = &alc269_capture_source, |
| 15034 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15035 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15036 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15037 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15038 | [ALC269_AMIC] = { |
| 15039 | .mixers = { alc269_laptop_mixer }, |
| 15040 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15041 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15042 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15043 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15044 | .dac_nids = alc269_dac_nids, |
| 15045 | .hp_nid = 0x03, |
| 15046 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15047 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15048 | .unsol_event = alc269_laptop_unsol_event, |
| 15049 | .setup = alc269_laptop_amic_setup, |
| 15050 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15051 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15052 | [ALC269_DMIC] = { |
| 15053 | .mixers = { alc269_laptop_mixer }, |
| 15054 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15055 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15056 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15057 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15058 | .dac_nids = alc269_dac_nids, |
| 15059 | .hp_nid = 0x03, |
| 15060 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15061 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15062 | .unsol_event = alc269_laptop_unsol_event, |
| 15063 | .setup = alc269_laptop_dmic_setup, |
| 15064 | .init_hook = alc269_laptop_inithook, |
| 15065 | }, |
| 15066 | [ALC269VB_AMIC] = { |
| 15067 | .mixers = { alc269vb_laptop_mixer }, |
| 15068 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15069 | .init_verbs = { alc269vb_init_verbs, |
| 15070 | alc269vb_laptop_amic_init_verbs }, |
| 15071 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15072 | .dac_nids = alc269_dac_nids, |
| 15073 | .hp_nid = 0x03, |
| 15074 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15075 | .channel_mode = alc269_modes, |
| 15076 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15077 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15078 | .init_hook = alc269_laptop_inithook, |
| 15079 | }, |
| 15080 | [ALC269VB_DMIC] = { |
| 15081 | .mixers = { alc269vb_laptop_mixer }, |
| 15082 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15083 | .init_verbs = { alc269vb_init_verbs, |
| 15084 | alc269vb_laptop_dmic_init_verbs }, |
| 15085 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15086 | .dac_nids = alc269_dac_nids, |
| 15087 | .hp_nid = 0x03, |
| 15088 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15089 | .channel_mode = alc269_modes, |
| 15090 | .unsol_event = alc269_laptop_unsol_event, |
| 15091 | .setup = alc269vb_laptop_dmic_setup, |
| 15092 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15093 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15094 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15095 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15096 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15097 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15098 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15099 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15100 | .dac_nids = alc269_dac_nids, |
| 15101 | .hp_nid = 0x03, |
| 15102 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15103 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15104 | .unsol_event = alc269_laptop_unsol_event, |
| 15105 | .setup = alc269_laptop_dmic_setup, |
| 15106 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15107 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15108 | [ALC269_LIFEBOOK] = { |
| 15109 | .mixers = { alc269_lifebook_mixer }, |
| 15110 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15111 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15112 | .dac_nids = alc269_dac_nids, |
| 15113 | .hp_nid = 0x03, |
| 15114 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15115 | .channel_mode = alc269_modes, |
| 15116 | .input_mux = &alc269_capture_source, |
| 15117 | .unsol_event = alc269_lifebook_unsol_event, |
| 15118 | .init_hook = alc269_lifebook_init_hook, |
| 15119 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15120 | [ALC271_ACER] = { |
| 15121 | .mixers = { alc269_asus_mixer }, |
| 15122 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15123 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15124 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15125 | .dac_nids = alc269_dac_nids, |
| 15126 | .adc_nids = alc262_dmic_adc_nids, |
| 15127 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15128 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15129 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15130 | .channel_mode = alc269_modes, |
| 15131 | .input_mux = &alc269_capture_source, |
| 15132 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15133 | .unsol_event = alc_sku_unsol_event, |
| 15134 | .setup = alc269vb_laptop_dmic_setup, |
| 15135 | .init_hook = alc_inithook, |
| 15136 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15137 | }; |
| 15138 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15139 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15140 | { |
| 15141 | int val; |
| 15142 | |
| 15143 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15144 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15145 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15146 | } |
| 15147 | |
| 15148 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15149 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15150 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15151 | } |
| 15152 | |
| 15153 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15154 | val = alc_read_coef_idx(codec, 0x04); |
| 15155 | /* Power up output pin */ |
| 15156 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15157 | } |
| 15158 | |
| 15159 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15160 | val = alc_read_coef_idx(codec, 0xd); |
| 15161 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15162 | /* Capless ramp up clock control */ |
| 15163 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15164 | } |
| 15165 | val = alc_read_coef_idx(codec, 0x17); |
| 15166 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15167 | /* Class D power on reset */ |
| 15168 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15169 | } |
| 15170 | } |
| 15171 | return 0; |
| 15172 | } |
| 15173 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15174 | static int patch_alc269(struct hda_codec *codec) |
| 15175 | { |
| 15176 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15177 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15178 | int err; |
| 15179 | |
| 15180 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15181 | if (spec == NULL) |
| 15182 | return -ENOMEM; |
| 15183 | |
| 15184 | codec->spec = spec; |
| 15185 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15186 | alc_auto_parse_customize_define(codec); |
| 15187 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15188 | if (codec->vendor_id == 0x10ec0269) { |
| 15189 | coef = alc_read_coef_idx(codec, 0); |
| 15190 | if ((coef & 0x00f0) == 0x0010) { |
| 15191 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15192 | spec->cdefine.platform_type == 1) { |
| 15193 | alc_codec_rename(codec, "ALC271X"); |
| 15194 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15195 | } else if ((coef & 0xf000) == 0x1000) { |
| 15196 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15197 | } else if ((coef & 0xf000) == 0x2000) { |
| 15198 | alc_codec_rename(codec, "ALC259"); |
| 15199 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15200 | } else if ((coef & 0xf000) == 0x3000) { |
| 15201 | alc_codec_rename(codec, "ALC258"); |
| 15202 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15203 | } else { |
| 15204 | alc_codec_rename(codec, "ALC269VB"); |
| 15205 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15206 | } |
| 15207 | } else |
| 15208 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15209 | alc269_fill_coef(codec); |
| 15210 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15211 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15212 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15213 | alc269_models, |
| 15214 | alc269_cfg_tbl); |
| 15215 | |
| 15216 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15217 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15218 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15219 | board_config = ALC269_AUTO; |
| 15220 | } |
| 15221 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15222 | if (board_config == ALC269_AUTO) { |
| 15223 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15224 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15225 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15226 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15227 | if (board_config == ALC269_AUTO) { |
| 15228 | /* automatic parse from the BIOS config */ |
| 15229 | err = alc269_parse_auto_config(codec); |
| 15230 | if (err < 0) { |
| 15231 | alc_free(codec); |
| 15232 | return err; |
| 15233 | } else if (!err) { |
| 15234 | printk(KERN_INFO |
| 15235 | "hda_codec: Cannot set up configuration " |
| 15236 | "from BIOS. Using base mode...\n"); |
| 15237 | board_config = ALC269_BASIC; |
| 15238 | } |
| 15239 | } |
| 15240 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15241 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15242 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15243 | if (err < 0) { |
| 15244 | alc_free(codec); |
| 15245 | return err; |
| 15246 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15247 | } |
| 15248 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15249 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15250 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15251 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15252 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15253 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15254 | * fix the sample rate of analog I/O to 44.1kHz |
| 15255 | */ |
| 15256 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15257 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15258 | } else if (spec->dual_adc_switch) { |
| 15259 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15260 | /* switch ADC dynamically */ |
| 15261 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15262 | } else { |
| 15263 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15264 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15265 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15266 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15267 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15268 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15269 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15270 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15271 | spec->adc_nids = alc269_adc_nids; |
| 15272 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15273 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15274 | } else { |
| 15275 | spec->adc_nids = alc269vb_adc_nids; |
| 15276 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15277 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15278 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15279 | } |
| 15280 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15281 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15282 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15283 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15284 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15285 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15286 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15287 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15288 | spec->vmaster_nid = 0x02; |
| 15289 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15290 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15291 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15292 | codec->patch_ops.suspend = alc269_suspend; |
| 15293 | #endif |
| 15294 | #ifdef SND_HDA_NEEDS_RESUME |
| 15295 | codec->patch_ops.resume = alc269_resume; |
| 15296 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15297 | if (board_config == ALC269_AUTO) |
| 15298 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15299 | |
| 15300 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15301 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15302 | if (!spec->loopback.amplist) |
| 15303 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15304 | if (alc269_mic2_for_mute_led(codec)) |
| 15305 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15306 | #endif |
| 15307 | |
| 15308 | return 0; |
| 15309 | } |
| 15310 | |
| 15311 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15312 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15313 | */ |
| 15314 | |
| 15315 | /* |
| 15316 | * set the path ways for 2 channel output |
| 15317 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15318 | */ |
| 15319 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15320 | /* set pin widget 1Ah (line in) for input */ |
| 15321 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15322 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15323 | * the vref |
| 15324 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15325 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15326 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15327 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15328 | #if 0 |
| 15329 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15330 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15331 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15332 | { } /* end */ |
| 15333 | }; |
| 15334 | /* |
| 15335 | * 6ch mode |
| 15336 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15337 | */ |
| 15338 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15339 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15340 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15341 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15342 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15343 | |
| 15344 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15345 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15346 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15347 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15348 | #if 0 |
| 15349 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15350 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15351 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15352 | { } /* end */ |
| 15353 | }; |
| 15354 | |
| 15355 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15356 | { 2, alc861_threestack_ch2_init }, |
| 15357 | { 6, alc861_threestack_ch6_init }, |
| 15358 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15359 | /* Set mic1 as input and unmute the mixer */ |
| 15360 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15361 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15362 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15363 | { } /* end */ |
| 15364 | }; |
| 15365 | /* Set mic1 as output and mute mixer */ |
| 15366 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15367 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15368 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15369 | { } /* end */ |
| 15370 | }; |
| 15371 | |
| 15372 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15373 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15374 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15375 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15376 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15377 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15378 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15379 | /* set pin widget 1Ah (line in) for input */ |
| 15380 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15381 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15382 | * the vref |
| 15383 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15384 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15385 | |
| 15386 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15387 | #if 0 |
| 15388 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15389 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15390 | #endif |
| 15391 | { } /* end */ |
| 15392 | }; |
| 15393 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15394 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15395 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15396 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15397 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15398 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15399 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15400 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15401 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15402 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15403 | |
| 15404 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15405 | #if 0 |
| 15406 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15407 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15408 | #endif |
| 15409 | { } /* end */ |
| 15410 | }; |
| 15411 | |
| 15412 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15413 | { 2, alc861_asus_ch2_init }, |
| 15414 | { 6, alc861_asus_ch6_init }, |
| 15415 | }; |
| 15416 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15417 | /* patch-ALC861 */ |
| 15418 | |
| 15419 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15420 | /* output mixer control */ |
| 15421 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15422 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15423 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15424 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15425 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15426 | |
| 15427 | /*Input mixer control */ |
| 15428 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15429 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15430 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15431 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15432 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15433 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15434 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15435 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15436 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15437 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15438 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15439 | { } /* end */ |
| 15440 | }; |
| 15441 | |
| 15442 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15443 | /* output mixer control */ |
| 15444 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15445 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15446 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15447 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15448 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15449 | |
| 15450 | /* Input mixer control */ |
| 15451 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15452 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15454 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15455 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15456 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15459 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15461 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15462 | { |
| 15463 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15464 | .name = "Channel Mode", |
| 15465 | .info = alc_ch_mode_info, |
| 15466 | .get = alc_ch_mode_get, |
| 15467 | .put = alc_ch_mode_put, |
| 15468 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15469 | }, |
| 15470 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15471 | }; |
| 15472 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15473 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15474 | /* output mixer control */ |
| 15475 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15476 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15477 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15478 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15479 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15480 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15481 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15482 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15483 | /* output mixer control */ |
| 15484 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15485 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15486 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15487 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15488 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15489 | |
| 15490 | /* Input mixer control */ |
| 15491 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15492 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15493 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15494 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15495 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15496 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15497 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15499 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15500 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15501 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15502 | { |
| 15503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15504 | .name = "Channel Mode", |
| 15505 | .info = alc_ch_mode_info, |
| 15506 | .get = alc_ch_mode_get, |
| 15507 | .put = alc_ch_mode_put, |
| 15508 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15509 | }, |
| 15510 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15511 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15512 | |
| 15513 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15514 | /* output mixer control */ |
| 15515 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15516 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15517 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15518 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15519 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15520 | |
| 15521 | /* Input mixer control */ |
| 15522 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15523 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15524 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15525 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15526 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15527 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15528 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15529 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15530 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15531 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15532 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15533 | { |
| 15534 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15535 | .name = "Channel Mode", |
| 15536 | .info = alc_ch_mode_info, |
| 15537 | .get = alc_ch_mode_get, |
| 15538 | .put = alc_ch_mode_put, |
| 15539 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15540 | }, |
| 15541 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15542 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15543 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15544 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15545 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15547 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15548 | { } |
| 15549 | }; |
| 15550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15551 | /* |
| 15552 | * generic initialization of ADC, input mixers and output mixers |
| 15553 | */ |
| 15554 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15555 | /* |
| 15556 | * Unmute ADC0 and set the default input to mic-in |
| 15557 | */ |
| 15558 | /* port-A for surround (rear panel) */ |
| 15559 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15560 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15561 | /* port-B for mic-in (rear panel) with vref */ |
| 15562 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15563 | /* port-C for line-in (rear panel) */ |
| 15564 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15565 | /* port-D for Front */ |
| 15566 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15567 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15568 | /* port-E for HP out (front panel) */ |
| 15569 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15570 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15571 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15572 | /* port-F for mic-in (front panel) with vref */ |
| 15573 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15574 | /* port-G for CLFE (rear panel) */ |
| 15575 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15576 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15577 | /* port-H for side (rear panel) */ |
| 15578 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15579 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15580 | /* CD-in */ |
| 15581 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15582 | /* route front mic to ADC1*/ |
| 15583 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15584 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15585 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15586 | /* Unmute DAC0~3 & spdif out*/ |
| 15587 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15588 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15589 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15590 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15592 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15593 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15594 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15595 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15596 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15597 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15598 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15599 | /* Unmute Stereo Mixer 15 */ |
| 15600 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15601 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15602 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15603 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15604 | |
| 15605 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15606 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15607 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15608 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15609 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15610 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15611 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15612 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15613 | /* hp used DAC 3 (Front) */ |
| 15614 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15615 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15616 | |
| 15617 | { } |
| 15618 | }; |
| 15619 | |
| 15620 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15621 | /* |
| 15622 | * Unmute ADC0 and set the default input to mic-in |
| 15623 | */ |
| 15624 | /* port-A for surround (rear panel) */ |
| 15625 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15626 | /* port-B for mic-in (rear panel) with vref */ |
| 15627 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15628 | /* port-C for line-in (rear panel) */ |
| 15629 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15630 | /* port-D for Front */ |
| 15631 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15632 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15633 | /* port-E for HP out (front panel) */ |
| 15634 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15635 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15636 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15637 | /* port-F for mic-in (front panel) with vref */ |
| 15638 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15639 | /* port-G for CLFE (rear panel) */ |
| 15640 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15641 | /* port-H for side (rear panel) */ |
| 15642 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15643 | /* CD-in */ |
| 15644 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15645 | /* route front mic to ADC1*/ |
| 15646 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15647 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15648 | /* Unmute DAC0~3 & spdif out*/ |
| 15649 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15650 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15651 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15652 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15653 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15654 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15655 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15656 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15657 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15658 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15659 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15660 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15661 | /* Unmute Stereo Mixer 15 */ |
| 15662 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15663 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15664 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15665 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15666 | |
| 15667 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15668 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15669 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15670 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15671 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15672 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15673 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15674 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15675 | /* hp used DAC 3 (Front) */ |
| 15676 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15677 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15678 | { } |
| 15679 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15680 | |
| 15681 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15682 | /* |
| 15683 | * Unmute ADC0 and set the default input to mic-in |
| 15684 | */ |
| 15685 | /* port-A for surround (rear panel) */ |
| 15686 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15687 | /* port-B for mic-in (rear panel) with vref */ |
| 15688 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15689 | /* port-C for line-in (rear panel) */ |
| 15690 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15691 | /* port-D for Front */ |
| 15692 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15693 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15694 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15695 | /* this has to be set to VREF80 */ |
| 15696 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15697 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15698 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15699 | /* port-F for mic-in (front panel) with vref */ |
| 15700 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15701 | /* port-G for CLFE (rear panel) */ |
| 15702 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15703 | /* port-H for side (rear panel) */ |
| 15704 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15705 | /* CD-in */ |
| 15706 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15707 | /* route front mic to ADC1*/ |
| 15708 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15709 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15710 | /* Unmute DAC0~3 & spdif out*/ |
| 15711 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15712 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15713 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15714 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15715 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15716 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15717 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15718 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15719 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15720 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15721 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15722 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15723 | /* Unmute Stereo Mixer 15 */ |
| 15724 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15725 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15726 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15727 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15728 | |
| 15729 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15730 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15731 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15732 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15733 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15734 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15735 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15736 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15737 | /* hp used DAC 3 (Front) */ |
| 15738 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15739 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15740 | { } |
| 15741 | }; |
| 15742 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15743 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15744 | /* |
| 15745 | * Unmute ADC0 and set the default input to mic-in |
| 15746 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15747 | /* port-A for surround (rear panel) |
| 15748 | * according to codec#0 this is the HP jack |
| 15749 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15750 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15751 | /* route front PCM to HP */ |
| 15752 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15753 | /* port-B for mic-in (rear panel) with vref */ |
| 15754 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15755 | /* port-C for line-in (rear panel) */ |
| 15756 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15757 | /* port-D for Front */ |
| 15758 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15759 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15760 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15761 | /* this has to be set to VREF80 */ |
| 15762 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15763 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15764 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15765 | /* port-F for mic-in (front panel) with vref */ |
| 15766 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15767 | /* port-G for CLFE (rear panel) */ |
| 15768 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15769 | /* port-H for side (rear panel) */ |
| 15770 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15771 | /* CD-in */ |
| 15772 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15773 | /* route front mic to ADC1*/ |
| 15774 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15775 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15776 | /* Unmute DAC0~3 & spdif out*/ |
| 15777 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15778 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15779 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15780 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15781 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15782 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15783 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15784 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15785 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15786 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15787 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15788 | /* Unmute Stereo Mixer 15 */ |
| 15789 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15790 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15793 | |
| 15794 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15795 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15796 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15797 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15798 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15800 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15802 | /* hp used DAC 3 (Front) */ |
| 15803 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15804 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15805 | { } |
| 15806 | }; |
| 15807 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15808 | /* additional init verbs for ASUS laptops */ |
| 15809 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15810 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15811 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15812 | { } |
| 15813 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15814 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15815 | /* |
| 15816 | * generic initialization of ADC, input mixers and output mixers |
| 15817 | */ |
| 15818 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15819 | /* |
| 15820 | * Unmute ADC0 and set the default input to mic-in |
| 15821 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15822 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15825 | /* Unmute DAC0~3 & spdif out*/ |
| 15826 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15827 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15828 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15829 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15830 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15831 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15832 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15833 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15834 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15835 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15836 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15837 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15838 | /* Unmute Stereo Mixer 15 */ |
| 15839 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15840 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15841 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15843 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15844 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15845 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15846 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15847 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15848 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15849 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15850 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15851 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15852 | |
| 15853 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15854 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15855 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15856 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15857 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15858 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15859 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15860 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15861 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15862 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15863 | |
| 15864 | { } |
| 15865 | }; |
| 15866 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15867 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15868 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15869 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15870 | { } |
| 15871 | }; |
| 15872 | |
| 15873 | /* toggle speaker-output according to the hp-jack state */ |
| 15874 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15875 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15876 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15877 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15878 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15879 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15880 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15881 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15882 | } |
| 15883 | |
| 15884 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15885 | unsigned int res) |
| 15886 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15887 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15888 | alc861_toshiba_automute(codec); |
| 15889 | } |
| 15890 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15891 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15892 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15893 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15894 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15895 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15896 | |
| 15897 | |
| 15898 | #define ALC861_DIGOUT_NID 0x07 |
| 15899 | |
| 15900 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15901 | { 8, NULL } |
| 15902 | }; |
| 15903 | |
| 15904 | static hda_nid_t alc861_dac_nids[4] = { |
| 15905 | /* front, surround, clfe, side */ |
| 15906 | 0x03, 0x06, 0x05, 0x04 |
| 15907 | }; |
| 15908 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15909 | static hda_nid_t alc660_dac_nids[3] = { |
| 15910 | /* front, clfe, surround */ |
| 15911 | 0x03, 0x05, 0x06 |
| 15912 | }; |
| 15913 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15914 | static hda_nid_t alc861_adc_nids[1] = { |
| 15915 | /* ADC0-2 */ |
| 15916 | 0x08, |
| 15917 | }; |
| 15918 | |
| 15919 | static struct hda_input_mux alc861_capture_source = { |
| 15920 | .num_items = 5, |
| 15921 | .items = { |
| 15922 | { "Mic", 0x0 }, |
| 15923 | { "Front Mic", 0x3 }, |
| 15924 | { "Line", 0x1 }, |
| 15925 | { "CD", 0x4 }, |
| 15926 | { "Mixer", 0x5 }, |
| 15927 | }, |
| 15928 | }; |
| 15929 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15930 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15931 | { |
| 15932 | struct alc_spec *spec = codec->spec; |
| 15933 | hda_nid_t mix, srcs[5]; |
| 15934 | int i, j, num; |
| 15935 | |
| 15936 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15937 | return 0; |
| 15938 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15939 | if (num < 0) |
| 15940 | return 0; |
| 15941 | for (i = 0; i < num; i++) { |
| 15942 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15943 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15944 | if (type != AC_WID_AUD_OUT) |
| 15945 | continue; |
| 15946 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15947 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15948 | break; |
| 15949 | if (j >= spec->multiout.num_dacs) |
| 15950 | return srcs[i]; |
| 15951 | } |
| 15952 | return 0; |
| 15953 | } |
| 15954 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15955 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15956 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15957 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15958 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15959 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15960 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15961 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15962 | |
| 15963 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15964 | for (i = 0; i < cfg->line_outs; i++) { |
| 15965 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15966 | dac = alc861_look_for_dac(codec, nid); |
| 15967 | if (!dac) |
| 15968 | continue; |
| 15969 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15970 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15971 | return 0; |
| 15972 | } |
| 15973 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15974 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15975 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15976 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15977 | 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] | 15978 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15979 | } |
| 15980 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15981 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15982 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15983 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15984 | /* add playback controls from the parsed DAC table */ |
| 15985 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15986 | const struct auto_pin_cfg *cfg) |
| 15987 | { |
| 15988 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 15989 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15990 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15991 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15992 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15993 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15994 | int i, err; |
| 15995 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15996 | for (i = 0; i < cfg->line_outs; i++) { |
| 15997 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15998 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15999 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16000 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16001 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16002 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16003 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16004 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16005 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16006 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16007 | return err; |
| 16008 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16009 | const char *name = pfx; |
| 16010 | if (!name) |
| 16011 | name = chname[i]; |
| 16012 | err = __alc861_create_out_sw(codec, name, nid, i, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16013 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16014 | return err; |
| 16015 | } |
| 16016 | } |
| 16017 | return 0; |
| 16018 | } |
| 16019 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16020 | 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] | 16021 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16022 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16023 | int err; |
| 16024 | hda_nid_t nid; |
| 16025 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16026 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16027 | return 0; |
| 16028 | |
| 16029 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16030 | nid = alc861_look_for_dac(codec, pin); |
| 16031 | if (nid) { |
| 16032 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16033 | if (err < 0) |
| 16034 | return err; |
| 16035 | spec->multiout.hp_nid = nid; |
| 16036 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16037 | } |
| 16038 | return 0; |
| 16039 | } |
| 16040 | |
| 16041 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16042 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16043 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16044 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16045 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16046 | } |
| 16047 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16048 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16049 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16050 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16051 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16052 | hda_nid_t mix, srcs[5]; |
| 16053 | int i, num; |
| 16054 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16055 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16056 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16057 | 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] | 16058 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16059 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16060 | return; |
| 16061 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16062 | if (num < 0) |
| 16063 | return; |
| 16064 | for (i = 0; i < num; i++) { |
| 16065 | unsigned int mute; |
| 16066 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16067 | mute = AMP_IN_UNMUTE(i); |
| 16068 | else |
| 16069 | mute = AMP_IN_MUTE(i); |
| 16070 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16071 | mute); |
| 16072 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16073 | } |
| 16074 | |
| 16075 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16076 | { |
| 16077 | struct alc_spec *spec = codec->spec; |
| 16078 | int i; |
| 16079 | |
| 16080 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16081 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16082 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16083 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16084 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16085 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16086 | } |
| 16087 | } |
| 16088 | |
| 16089 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16090 | { |
| 16091 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16092 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16093 | if (spec->autocfg.hp_outs) |
| 16094 | alc861_auto_set_output_and_unmute(codec, |
| 16095 | spec->autocfg.hp_pins[0], |
| 16096 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16097 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16098 | if (spec->autocfg.speaker_outs) |
| 16099 | alc861_auto_set_output_and_unmute(codec, |
| 16100 | spec->autocfg.speaker_pins[0], |
| 16101 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16102 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16103 | } |
| 16104 | |
| 16105 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16106 | { |
| 16107 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16108 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16109 | int i; |
| 16110 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16111 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16112 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16113 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16114 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16115 | } |
| 16116 | } |
| 16117 | |
| 16118 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16119 | /* return 1 if successful, 0 if the proper config is not found, |
| 16120 | * or a negative error code |
| 16121 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16122 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16123 | { |
| 16124 | struct alc_spec *spec = codec->spec; |
| 16125 | int err; |
| 16126 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16127 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16128 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16129 | alc861_ignore); |
| 16130 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16131 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16132 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16133 | return 0; /* can't find valid BIOS pin config */ |
| 16134 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16135 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16136 | if (err < 0) |
| 16137 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16138 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16139 | if (err < 0) |
| 16140 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16141 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16142 | if (err < 0) |
| 16143 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16144 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16145 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16146 | return err; |
| 16147 | |
| 16148 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16149 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16150 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16151 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16152 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16153 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16154 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16155 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16156 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16157 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16158 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16159 | |
| 16160 | spec->adc_nids = alc861_adc_nids; |
| 16161 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16162 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16163 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16164 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16166 | return 1; |
| 16167 | } |
| 16168 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16169 | /* additional initialization for auto-configuration model */ |
| 16170 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16171 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16172 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16173 | alc861_auto_init_multi_out(codec); |
| 16174 | alc861_auto_init_hp_out(codec); |
| 16175 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16176 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16177 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16178 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16179 | } |
| 16180 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16181 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16182 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16183 | { 0x15, HDA_INPUT, 0 }, |
| 16184 | { 0x15, HDA_INPUT, 1 }, |
| 16185 | { 0x15, HDA_INPUT, 2 }, |
| 16186 | { 0x15, HDA_INPUT, 3 }, |
| 16187 | { } /* end */ |
| 16188 | }; |
| 16189 | #endif |
| 16190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16191 | |
| 16192 | /* |
| 16193 | * configuration and preset |
| 16194 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16195 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16196 | [ALC861_3ST] = "3stack", |
| 16197 | [ALC660_3ST] = "3stack-660", |
| 16198 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16199 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16200 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16201 | [ALC861_TOSHIBA] = "toshiba", |
| 16202 | [ALC861_ASUS] = "asus", |
| 16203 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16204 | [ALC861_AUTO] = "auto", |
| 16205 | }; |
| 16206 | |
| 16207 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16208 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16209 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16210 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16211 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16212 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16213 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16214 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16215 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16216 | * Any other models that need this preset? |
| 16217 | */ |
| 16218 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16219 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16220 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16221 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16222 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16223 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16224 | /* FIXME: the below seems conflict */ |
| 16225 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16226 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16227 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16228 | {} |
| 16229 | }; |
| 16230 | |
| 16231 | static struct alc_config_preset alc861_presets[] = { |
| 16232 | [ALC861_3ST] = { |
| 16233 | .mixers = { alc861_3ST_mixer }, |
| 16234 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16235 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16236 | .dac_nids = alc861_dac_nids, |
| 16237 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16238 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16239 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16240 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16241 | .adc_nids = alc861_adc_nids, |
| 16242 | .input_mux = &alc861_capture_source, |
| 16243 | }, |
| 16244 | [ALC861_3ST_DIG] = { |
| 16245 | .mixers = { alc861_base_mixer }, |
| 16246 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16247 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16248 | .dac_nids = alc861_dac_nids, |
| 16249 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16250 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16251 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16252 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16253 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16254 | .adc_nids = alc861_adc_nids, |
| 16255 | .input_mux = &alc861_capture_source, |
| 16256 | }, |
| 16257 | [ALC861_6ST_DIG] = { |
| 16258 | .mixers = { alc861_base_mixer }, |
| 16259 | .init_verbs = { alc861_base_init_verbs }, |
| 16260 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16261 | .dac_nids = alc861_dac_nids, |
| 16262 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16263 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16264 | .channel_mode = alc861_8ch_modes, |
| 16265 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16266 | .adc_nids = alc861_adc_nids, |
| 16267 | .input_mux = &alc861_capture_source, |
| 16268 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16269 | [ALC660_3ST] = { |
| 16270 | .mixers = { alc861_3ST_mixer }, |
| 16271 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16272 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16273 | .dac_nids = alc660_dac_nids, |
| 16274 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16275 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16276 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16277 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16278 | .adc_nids = alc861_adc_nids, |
| 16279 | .input_mux = &alc861_capture_source, |
| 16280 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16281 | [ALC861_UNIWILL_M31] = { |
| 16282 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16283 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16284 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16285 | .dac_nids = alc861_dac_nids, |
| 16286 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16287 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16288 | .channel_mode = alc861_uniwill_m31_modes, |
| 16289 | .need_dac_fix = 1, |
| 16290 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16291 | .adc_nids = alc861_adc_nids, |
| 16292 | .input_mux = &alc861_capture_source, |
| 16293 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16294 | [ALC861_TOSHIBA] = { |
| 16295 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16296 | .init_verbs = { alc861_base_init_verbs, |
| 16297 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16298 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16299 | .dac_nids = alc861_dac_nids, |
| 16300 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16301 | .channel_mode = alc883_3ST_2ch_modes, |
| 16302 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16303 | .adc_nids = alc861_adc_nids, |
| 16304 | .input_mux = &alc861_capture_source, |
| 16305 | .unsol_event = alc861_toshiba_unsol_event, |
| 16306 | .init_hook = alc861_toshiba_automute, |
| 16307 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16308 | [ALC861_ASUS] = { |
| 16309 | .mixers = { alc861_asus_mixer }, |
| 16310 | .init_verbs = { alc861_asus_init_verbs }, |
| 16311 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16312 | .dac_nids = alc861_dac_nids, |
| 16313 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16314 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16315 | .channel_mode = alc861_asus_modes, |
| 16316 | .need_dac_fix = 1, |
| 16317 | .hp_nid = 0x06, |
| 16318 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16319 | .adc_nids = alc861_adc_nids, |
| 16320 | .input_mux = &alc861_capture_source, |
| 16321 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16322 | [ALC861_ASUS_LAPTOP] = { |
| 16323 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16324 | .init_verbs = { alc861_asus_init_verbs, |
| 16325 | alc861_asus_laptop_init_verbs }, |
| 16326 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16327 | .dac_nids = alc861_dac_nids, |
| 16328 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16329 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16330 | .channel_mode = alc883_3ST_2ch_modes, |
| 16331 | .need_dac_fix = 1, |
| 16332 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16333 | .adc_nids = alc861_adc_nids, |
| 16334 | .input_mux = &alc861_capture_source, |
| 16335 | }, |
| 16336 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16337 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16338 | /* Pin config fixes */ |
| 16339 | enum { |
| 16340 | PINFIX_FSC_AMILO_PI1505, |
| 16341 | }; |
| 16342 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16343 | static const struct alc_fixup alc861_fixups[] = { |
| 16344 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16345 | .type = ALC_FIXUP_PINS, |
| 16346 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16347 | { 0x0b, 0x0221101f }, /* HP */ |
| 16348 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16349 | { } |
| 16350 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16351 | }, |
| 16352 | }; |
| 16353 | |
| 16354 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16355 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16356 | {} |
| 16357 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16358 | |
| 16359 | static int patch_alc861(struct hda_codec *codec) |
| 16360 | { |
| 16361 | struct alc_spec *spec; |
| 16362 | int board_config; |
| 16363 | int err; |
| 16364 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16365 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16366 | if (spec == NULL) |
| 16367 | return -ENOMEM; |
| 16368 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16369 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16370 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16371 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16372 | alc861_models, |
| 16373 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16374 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16375 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16376 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16377 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16378 | board_config = ALC861_AUTO; |
| 16379 | } |
| 16380 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16381 | if (board_config == ALC861_AUTO) { |
| 16382 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16383 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16384 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16385 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16386 | if (board_config == ALC861_AUTO) { |
| 16387 | /* automatic parse from the BIOS config */ |
| 16388 | err = alc861_parse_auto_config(codec); |
| 16389 | if (err < 0) { |
| 16390 | alc_free(codec); |
| 16391 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16392 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16393 | printk(KERN_INFO |
| 16394 | "hda_codec: Cannot set up configuration " |
| 16395 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16396 | board_config = ALC861_3ST_DIG; |
| 16397 | } |
| 16398 | } |
| 16399 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16400 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16401 | if (err < 0) { |
| 16402 | alc_free(codec); |
| 16403 | return err; |
| 16404 | } |
| 16405 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16406 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16407 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16408 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16409 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16410 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16411 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16412 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16413 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16414 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16415 | if (!spec->cap_mixer) |
| 16416 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16417 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16418 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16419 | spec->vmaster_nid = 0x03; |
| 16420 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16421 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16422 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16423 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16424 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16425 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16426 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16427 | spec->power_hook = alc_power_eapd; |
| 16428 | #endif |
| 16429 | } |
| 16430 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16431 | if (!spec->loopback.amplist) |
| 16432 | spec->loopback.amplist = alc861_loopbacks; |
| 16433 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16434 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16435 | return 0; |
| 16436 | } |
| 16437 | |
| 16438 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16439 | * ALC861-VD support |
| 16440 | * |
| 16441 | * Based on ALC882 |
| 16442 | * |
| 16443 | * In addition, an independent DAC |
| 16444 | */ |
| 16445 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16446 | |
| 16447 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16448 | /* front, surr, clfe, side surr */ |
| 16449 | 0x02, 0x03, 0x04, 0x05 |
| 16450 | }; |
| 16451 | |
| 16452 | /* dac_nids for ALC660vd are in a different order - according to |
| 16453 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16454 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16455 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16456 | * - and it is the same as in 861vd. |
| 16457 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16458 | */ |
| 16459 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16460 | /* front, rear, clfe, rear_surr */ |
| 16461 | 0x02, 0x04, 0x03 |
| 16462 | }; |
| 16463 | |
| 16464 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16465 | /* ADC0 */ |
| 16466 | 0x09, |
| 16467 | }; |
| 16468 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16469 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16470 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16471 | /* input MUX */ |
| 16472 | /* FIXME: should be a matrix-type input source selection */ |
| 16473 | static struct hda_input_mux alc861vd_capture_source = { |
| 16474 | .num_items = 4, |
| 16475 | .items = { |
| 16476 | { "Mic", 0x0 }, |
| 16477 | { "Front Mic", 0x1 }, |
| 16478 | { "Line", 0x2 }, |
| 16479 | { "CD", 0x4 }, |
| 16480 | }, |
| 16481 | }; |
| 16482 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16483 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16484 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16485 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16486 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16487 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16488 | }, |
| 16489 | }; |
| 16490 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16491 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16492 | .num_items = 2, |
| 16493 | .items = { |
| 16494 | { "Front Mic", 0x0 }, |
| 16495 | { "ATAPI Mic", 0x1 }, |
| 16496 | }, |
| 16497 | }; |
| 16498 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16499 | /* |
| 16500 | * 2ch mode |
| 16501 | */ |
| 16502 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16503 | { 2, NULL } |
| 16504 | }; |
| 16505 | |
| 16506 | /* |
| 16507 | * 6ch mode |
| 16508 | */ |
| 16509 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16510 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16511 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16512 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16513 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16514 | { } /* end */ |
| 16515 | }; |
| 16516 | |
| 16517 | /* |
| 16518 | * 8ch mode |
| 16519 | */ |
| 16520 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16521 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16522 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16523 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16524 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16525 | { } /* end */ |
| 16526 | }; |
| 16527 | |
| 16528 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16529 | { 6, alc861vd_6stack_ch6_init }, |
| 16530 | { 8, alc861vd_6stack_ch8_init }, |
| 16531 | }; |
| 16532 | |
| 16533 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16534 | { |
| 16535 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16536 | .name = "Channel Mode", |
| 16537 | .info = alc_ch_mode_info, |
| 16538 | .get = alc_ch_mode_get, |
| 16539 | .put = alc_ch_mode_put, |
| 16540 | }, |
| 16541 | { } /* end */ |
| 16542 | }; |
| 16543 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16544 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16545 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16546 | */ |
| 16547 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16548 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16549 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16550 | |
| 16551 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16552 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16553 | |
| 16554 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16555 | HDA_OUTPUT), |
| 16556 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16557 | HDA_OUTPUT), |
| 16558 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16559 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16560 | |
| 16561 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16562 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16563 | |
| 16564 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16565 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16566 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16568 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16569 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16570 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16571 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16572 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16573 | |
| 16574 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16575 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16576 | |
| 16577 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16578 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16579 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16580 | { } /* end */ |
| 16581 | }; |
| 16582 | |
| 16583 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16585 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16586 | |
| 16587 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16588 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16589 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16590 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16591 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16592 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16593 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16594 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16595 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16596 | |
| 16597 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16598 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16599 | |
| 16600 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16601 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16602 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16603 | { } /* end */ |
| 16604 | }; |
| 16605 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16606 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16607 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16608 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16609 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16610 | |
| 16611 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16612 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16613 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16616 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16617 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16618 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16619 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16620 | |
| 16621 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16622 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16623 | |
| 16624 | { } /* end */ |
| 16625 | }; |
| 16626 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16627 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16628 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16629 | */ |
| 16630 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16631 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16632 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16633 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16634 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16635 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16638 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16639 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16640 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16641 | { } /* end */ |
| 16642 | }; |
| 16643 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16644 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16645 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16646 | */ |
| 16647 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16649 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16650 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16651 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16652 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16653 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16654 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16655 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16656 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16657 | { } /* end */ |
| 16658 | }; |
| 16659 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16660 | /* |
| 16661 | * generic initialization of ADC, input mixers and output mixers |
| 16662 | */ |
| 16663 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16664 | /* |
| 16665 | * Unmute ADC0 and set the default input to mic-in |
| 16666 | */ |
| 16667 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16668 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16669 | |
| 16670 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16671 | * the analog-loopback mixer widget |
| 16672 | */ |
| 16673 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16674 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16675 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16676 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16677 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16678 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16679 | |
| 16680 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16681 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16682 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16683 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16684 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16685 | |
| 16686 | /* |
| 16687 | * Set up output mixers (0x02 - 0x05) |
| 16688 | */ |
| 16689 | /* set vol=0 to output mixers */ |
| 16690 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16691 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16692 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16693 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16694 | |
| 16695 | /* set up input amps for analog loopback */ |
| 16696 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16698 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16700 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16701 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16702 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16703 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16704 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16705 | |
| 16706 | { } |
| 16707 | }; |
| 16708 | |
| 16709 | /* |
| 16710 | * 3-stack pin configuration: |
| 16711 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16712 | */ |
| 16713 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16714 | /* |
| 16715 | * Set pin mode and muting |
| 16716 | */ |
| 16717 | /* set front pin widgets 0x14 for output */ |
| 16718 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16719 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16720 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16721 | |
| 16722 | /* Mic (rear) pin: input vref at 80% */ |
| 16723 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16724 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16725 | /* Front Mic pin: input vref at 80% */ |
| 16726 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16727 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16728 | /* Line In pin: input */ |
| 16729 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16730 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16731 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16733 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16734 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16735 | /* CD pin widget for input */ |
| 16736 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16737 | |
| 16738 | { } |
| 16739 | }; |
| 16740 | |
| 16741 | /* |
| 16742 | * 6-stack pin configuration: |
| 16743 | */ |
| 16744 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16745 | /* |
| 16746 | * Set pin mode and muting |
| 16747 | */ |
| 16748 | /* set front pin widgets 0x14 for output */ |
| 16749 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16750 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16751 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16752 | |
| 16753 | /* Rear Pin: output 1 (0x0d) */ |
| 16754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16755 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16756 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16757 | /* CLFE Pin: output 2 (0x0e) */ |
| 16758 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16759 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16760 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16761 | /* Side Pin: output 3 (0x0f) */ |
| 16762 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16763 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16764 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16765 | |
| 16766 | /* Mic (rear) pin: input vref at 80% */ |
| 16767 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16768 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16769 | /* Front Mic pin: input vref at 80% */ |
| 16770 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16771 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16772 | /* Line In pin: input */ |
| 16773 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16774 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16775 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16776 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16777 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16778 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16779 | /* CD pin widget for input */ |
| 16780 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16781 | |
| 16782 | { } |
| 16783 | }; |
| 16784 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16785 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16786 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16787 | { } |
| 16788 | }; |
| 16789 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16790 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16791 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16792 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16793 | { } |
| 16794 | }; |
| 16795 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16796 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16797 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16798 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16799 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16800 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16801 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16802 | {} |
| 16803 | }; |
| 16804 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16805 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16806 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16807 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16808 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16809 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16810 | } |
| 16811 | |
| 16812 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16813 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16814 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16815 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16816 | } |
| 16817 | |
| 16818 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16819 | unsigned int res) |
| 16820 | { |
| 16821 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16822 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16823 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16824 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16825 | default: |
| 16826 | alc_automute_amp_unsol_event(codec, res); |
| 16827 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16828 | } |
| 16829 | } |
| 16830 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16831 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16832 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16833 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16834 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16835 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16836 | |
| 16837 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16838 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16839 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16840 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16841 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16842 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16843 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16844 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16845 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16846 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16847 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16848 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16849 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16850 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16851 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16852 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16853 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16854 | |
| 16855 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16856 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16857 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16858 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16859 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16860 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16861 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16862 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16863 | |
| 16864 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16865 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16866 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16867 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16868 | |
| 16869 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16870 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16871 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16872 | |
| 16873 | { } /* end */ |
| 16874 | }; |
| 16875 | |
| 16876 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16877 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16878 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16879 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16880 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16881 | spec->autocfg.hp_pins[0] = 0x15; |
| 16882 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16883 | } |
| 16884 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16885 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16886 | #define alc861vd_loopbacks alc880_loopbacks |
| 16887 | #endif |
| 16888 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16889 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16890 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16891 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16892 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16893 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16894 | |
| 16895 | /* |
| 16896 | * configuration and preset |
| 16897 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16898 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16899 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16900 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16901 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16902 | [ALC861VD_3ST] = "3stack", |
| 16903 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16904 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16905 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16906 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16907 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16908 | [ALC861VD_AUTO] = "auto", |
| 16909 | }; |
| 16910 | |
| 16911 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16912 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16913 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16914 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16915 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16916 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16917 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16918 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16919 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16920 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16921 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16922 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16923 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16924 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16925 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16926 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16927 | {} |
| 16928 | }; |
| 16929 | |
| 16930 | static struct alc_config_preset alc861vd_presets[] = { |
| 16931 | [ALC660VD_3ST] = { |
| 16932 | .mixers = { alc861vd_3st_mixer }, |
| 16933 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16934 | alc861vd_3stack_init_verbs }, |
| 16935 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16936 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16937 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16938 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16939 | .input_mux = &alc861vd_capture_source, |
| 16940 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16941 | [ALC660VD_3ST_DIG] = { |
| 16942 | .mixers = { alc861vd_3st_mixer }, |
| 16943 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16944 | alc861vd_3stack_init_verbs }, |
| 16945 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16946 | .dac_nids = alc660vd_dac_nids, |
| 16947 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16948 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16949 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16950 | .input_mux = &alc861vd_capture_source, |
| 16951 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16952 | [ALC861VD_3ST] = { |
| 16953 | .mixers = { alc861vd_3st_mixer }, |
| 16954 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16955 | alc861vd_3stack_init_verbs }, |
| 16956 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16957 | .dac_nids = alc861vd_dac_nids, |
| 16958 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16959 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16960 | .input_mux = &alc861vd_capture_source, |
| 16961 | }, |
| 16962 | [ALC861VD_3ST_DIG] = { |
| 16963 | .mixers = { alc861vd_3st_mixer }, |
| 16964 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16965 | alc861vd_3stack_init_verbs }, |
| 16966 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16967 | .dac_nids = alc861vd_dac_nids, |
| 16968 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16969 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16970 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16971 | .input_mux = &alc861vd_capture_source, |
| 16972 | }, |
| 16973 | [ALC861VD_6ST_DIG] = { |
| 16974 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16975 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16976 | alc861vd_6stack_init_verbs }, |
| 16977 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16978 | .dac_nids = alc861vd_dac_nids, |
| 16979 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16980 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16981 | .channel_mode = alc861vd_6stack_modes, |
| 16982 | .input_mux = &alc861vd_capture_source, |
| 16983 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16984 | [ALC861VD_LENOVO] = { |
| 16985 | .mixers = { alc861vd_lenovo_mixer }, |
| 16986 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16987 | alc861vd_3stack_init_verbs, |
| 16988 | alc861vd_eapd_verbs, |
| 16989 | alc861vd_lenovo_unsol_verbs }, |
| 16990 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16991 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16992 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16993 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16994 | .input_mux = &alc861vd_capture_source, |
| 16995 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16996 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16997 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16998 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16999 | [ALC861VD_DALLAS] = { |
| 17000 | .mixers = { alc861vd_dallas_mixer }, |
| 17001 | .init_verbs = { alc861vd_dallas_verbs }, |
| 17002 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17003 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17004 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17005 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17006 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17007 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17008 | .setup = alc861vd_dallas_setup, |
| 17009 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17010 | }, |
| 17011 | [ALC861VD_HP] = { |
| 17012 | .mixers = { alc861vd_hp_mixer }, |
| 17013 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17014 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17015 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17016 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17017 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17018 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17019 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17020 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17021 | .setup = alc861vd_dallas_setup, |
| 17022 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17023 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17024 | [ALC660VD_ASUS_V1S] = { |
| 17025 | .mixers = { alc861vd_lenovo_mixer }, |
| 17026 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17027 | alc861vd_3stack_init_verbs, |
| 17028 | alc861vd_eapd_verbs, |
| 17029 | alc861vd_lenovo_unsol_verbs }, |
| 17030 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17031 | .dac_nids = alc660vd_dac_nids, |
| 17032 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17033 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17034 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17035 | .input_mux = &alc861vd_capture_source, |
| 17036 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17037 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17038 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17039 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17040 | }; |
| 17041 | |
| 17042 | /* |
| 17043 | * BIOS auto configuration |
| 17044 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17045 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17046 | const struct auto_pin_cfg *cfg) |
| 17047 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17048 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17049 | } |
| 17050 | |
| 17051 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17052 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17053 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17054 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17055 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17056 | } |
| 17057 | |
| 17058 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17059 | { |
| 17060 | struct alc_spec *spec = codec->spec; |
| 17061 | int i; |
| 17062 | |
| 17063 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17064 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17065 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17066 | if (nid) |
| 17067 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17068 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17069 | } |
| 17070 | } |
| 17071 | |
| 17072 | |
| 17073 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17074 | { |
| 17075 | struct alc_spec *spec = codec->spec; |
| 17076 | hda_nid_t pin; |
| 17077 | |
| 17078 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17079 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17080 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17081 | pin = spec->autocfg.speaker_pins[0]; |
| 17082 | if (pin) |
| 17083 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17084 | } |
| 17085 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17086 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17087 | |
| 17088 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17089 | { |
| 17090 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17091 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17092 | int i; |
| 17093 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17094 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17095 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17096 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17097 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17098 | if (nid != ALC861VD_PIN_CD_NID && |
| 17099 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17100 | snd_hda_codec_write(codec, nid, 0, |
| 17101 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17102 | AMP_OUT_MUTE); |
| 17103 | } |
| 17104 | } |
| 17105 | } |
| 17106 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17107 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17108 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17109 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17110 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17111 | |
| 17112 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17113 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17114 | * different NIDs for mute/unmute switch and volume control */ |
| 17115 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17116 | const struct auto_pin_cfg *cfg) |
| 17117 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17118 | static const char * const chname[4] = { |
| 17119 | "Front", "Surround", "CLFE", "Side" |
| 17120 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17121 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17122 | hda_nid_t nid_v, nid_s; |
| 17123 | int i, err; |
| 17124 | |
| 17125 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17126 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17127 | continue; |
| 17128 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17129 | alc880_dac_to_idx( |
| 17130 | spec->multiout.dac_nids[i])); |
| 17131 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17132 | alc880_dac_to_idx( |
| 17133 | spec->multiout.dac_nids[i])); |
| 17134 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17135 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17136 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17137 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17138 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17139 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17140 | HDA_OUTPUT)); |
| 17141 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17142 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17143 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17144 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17145 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17146 | HDA_OUTPUT)); |
| 17147 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17148 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17149 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17150 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17151 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17152 | HDA_INPUT)); |
| 17153 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17154 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17155 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17156 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17157 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17158 | HDA_INPUT)); |
| 17159 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17160 | return err; |
| 17161 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17162 | const char *name = pfx; |
| 17163 | if (!name) |
| 17164 | name = chname[i]; |
| 17165 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17166 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17167 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17168 | HDA_OUTPUT)); |
| 17169 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17170 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17171 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17172 | name, i, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17173 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17174 | HDA_INPUT)); |
| 17175 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17176 | return err; |
| 17177 | } |
| 17178 | } |
| 17179 | return 0; |
| 17180 | } |
| 17181 | |
| 17182 | /* add playback controls for speaker and HP outputs */ |
| 17183 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17184 | * different NIDs for mute/unmute switch and volume control */ |
| 17185 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17186 | hda_nid_t pin, const char *pfx) |
| 17187 | { |
| 17188 | hda_nid_t nid_v, nid_s; |
| 17189 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17190 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17191 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17192 | return 0; |
| 17193 | |
| 17194 | if (alc880_is_fixed_pin(pin)) { |
| 17195 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17196 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17197 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17198 | spec->multiout.hp_nid = nid_v; |
| 17199 | else |
| 17200 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17201 | /* control HP volume/switch on the output mixer amp */ |
| 17202 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17203 | alc880_fixed_pin_idx(pin)); |
| 17204 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17205 | alc880_fixed_pin_idx(pin)); |
| 17206 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17207 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17208 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17209 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17210 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17211 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17212 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17213 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17214 | return err; |
| 17215 | } else if (alc880_is_multi_pin(pin)) { |
| 17216 | /* set manual connection */ |
| 17217 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17218 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17219 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17220 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17221 | return err; |
| 17222 | } |
| 17223 | return 0; |
| 17224 | } |
| 17225 | |
| 17226 | /* parse the BIOS configuration and set up the alc_spec |
| 17227 | * return 1 if successful, 0 if the proper config is not found, |
| 17228 | * or a negative error code |
| 17229 | * Based on ALC880 version - had to change it to override |
| 17230 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17231 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17232 | { |
| 17233 | struct alc_spec *spec = codec->spec; |
| 17234 | int err; |
| 17235 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17236 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17237 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17238 | alc861vd_ignore); |
| 17239 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17240 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17241 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17242 | return 0; /* can't find valid BIOS pin config */ |
| 17243 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17244 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17245 | if (err < 0) |
| 17246 | return err; |
| 17247 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17248 | if (err < 0) |
| 17249 | return err; |
| 17250 | err = alc861vd_auto_create_extra_out(spec, |
| 17251 | spec->autocfg.speaker_pins[0], |
| 17252 | "Speaker"); |
| 17253 | if (err < 0) |
| 17254 | return err; |
| 17255 | err = alc861vd_auto_create_extra_out(spec, |
| 17256 | spec->autocfg.hp_pins[0], |
| 17257 | "Headphone"); |
| 17258 | if (err < 0) |
| 17259 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17260 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17261 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17262 | return err; |
| 17263 | |
| 17264 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17265 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17266 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17267 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17268 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17269 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17270 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17271 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17272 | |
| 17273 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17274 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17275 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17276 | err = alc_auto_add_mic_boost(codec); |
| 17277 | if (err < 0) |
| 17278 | return err; |
| 17279 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17280 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17281 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17282 | return 1; |
| 17283 | } |
| 17284 | |
| 17285 | /* additional initialization for auto-configuration model */ |
| 17286 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17287 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17288 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17289 | alc861vd_auto_init_multi_out(codec); |
| 17290 | alc861vd_auto_init_hp_out(codec); |
| 17291 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17292 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17293 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17294 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17295 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17296 | } |
| 17297 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17298 | enum { |
| 17299 | ALC660VD_FIX_ASUS_GPIO1 |
| 17300 | }; |
| 17301 | |
| 17302 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17303 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17304 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17305 | .type = ALC_FIXUP_VERBS, |
| 17306 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17307 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17308 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17309 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17310 | { } |
| 17311 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17312 | }, |
| 17313 | }; |
| 17314 | |
| 17315 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17316 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17317 | {} |
| 17318 | }; |
| 17319 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17320 | static int patch_alc861vd(struct hda_codec *codec) |
| 17321 | { |
| 17322 | struct alc_spec *spec; |
| 17323 | int err, board_config; |
| 17324 | |
| 17325 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17326 | if (spec == NULL) |
| 17327 | return -ENOMEM; |
| 17328 | |
| 17329 | codec->spec = spec; |
| 17330 | |
| 17331 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17332 | alc861vd_models, |
| 17333 | alc861vd_cfg_tbl); |
| 17334 | |
| 17335 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17336 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17337 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17338 | board_config = ALC861VD_AUTO; |
| 17339 | } |
| 17340 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17341 | if (board_config == ALC861VD_AUTO) { |
| 17342 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17343 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17344 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17345 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17346 | if (board_config == ALC861VD_AUTO) { |
| 17347 | /* automatic parse from the BIOS config */ |
| 17348 | err = alc861vd_parse_auto_config(codec); |
| 17349 | if (err < 0) { |
| 17350 | alc_free(codec); |
| 17351 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17352 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17353 | printk(KERN_INFO |
| 17354 | "hda_codec: Cannot set up configuration " |
| 17355 | "from BIOS. Using base mode...\n"); |
| 17356 | board_config = ALC861VD_3ST; |
| 17357 | } |
| 17358 | } |
| 17359 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17360 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17361 | if (err < 0) { |
| 17362 | alc_free(codec); |
| 17363 | return err; |
| 17364 | } |
| 17365 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17366 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17367 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17368 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17369 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17370 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17371 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17372 | } |
| 17373 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17374 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17375 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17376 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17377 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17378 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17379 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17380 | if (!spec->adc_nids) { |
| 17381 | spec->adc_nids = alc861vd_adc_nids; |
| 17382 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17383 | } |
| 17384 | if (!spec->capsrc_nids) |
| 17385 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17386 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17387 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17388 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17389 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17390 | spec->vmaster_nid = 0x02; |
| 17391 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17392 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17393 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17394 | codec->patch_ops = alc_patch_ops; |
| 17395 | |
| 17396 | if (board_config == ALC861VD_AUTO) |
| 17397 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17398 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17399 | if (!spec->loopback.amplist) |
| 17400 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17401 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17402 | |
| 17403 | return 0; |
| 17404 | } |
| 17405 | |
| 17406 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17407 | * ALC662 support |
| 17408 | * |
| 17409 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17410 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17411 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17412 | * 6-channel independent captures. |
| 17413 | * |
| 17414 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17415 | * driver yet). |
| 17416 | */ |
| 17417 | #define ALC662_DIGOUT_NID 0x06 |
| 17418 | #define ALC662_DIGIN_NID 0x0a |
| 17419 | |
| 17420 | static hda_nid_t alc662_dac_nids[4] = { |
| 17421 | /* front, rear, clfe, rear_surr */ |
| 17422 | 0x02, 0x03, 0x04 |
| 17423 | }; |
| 17424 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17425 | static hda_nid_t alc272_dac_nids[2] = { |
| 17426 | 0x02, 0x03 |
| 17427 | }; |
| 17428 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17429 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17430 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17431 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17432 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17433 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17434 | static hda_nid_t alc272_adc_nids[1] = { |
| 17435 | /* ADC1-2 */ |
| 17436 | 0x08, |
| 17437 | }; |
| 17438 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17439 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17440 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17441 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17442 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17443 | /* input MUX */ |
| 17444 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17445 | static struct hda_input_mux alc662_capture_source = { |
| 17446 | .num_items = 4, |
| 17447 | .items = { |
| 17448 | { "Mic", 0x0 }, |
| 17449 | { "Front Mic", 0x1 }, |
| 17450 | { "Line", 0x2 }, |
| 17451 | { "CD", 0x4 }, |
| 17452 | }, |
| 17453 | }; |
| 17454 | |
| 17455 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17456 | .num_items = 2, |
| 17457 | .items = { |
| 17458 | { "Mic", 0x1 }, |
| 17459 | { "Line", 0x2 }, |
| 17460 | }, |
| 17461 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17462 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17463 | static struct hda_input_mux alc663_capture_source = { |
| 17464 | .num_items = 3, |
| 17465 | .items = { |
| 17466 | { "Mic", 0x0 }, |
| 17467 | { "Front Mic", 0x1 }, |
| 17468 | { "Line", 0x2 }, |
| 17469 | }, |
| 17470 | }; |
| 17471 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17472 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17473 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17474 | .num_items = 16, |
| 17475 | .items = { |
| 17476 | { "Autoselect Mic", 0x0 }, |
| 17477 | { "Internal Mic", 0x1 }, |
| 17478 | { "In-0x02", 0x2 }, |
| 17479 | { "In-0x03", 0x3 }, |
| 17480 | { "In-0x04", 0x4 }, |
| 17481 | { "In-0x05", 0x5 }, |
| 17482 | { "In-0x06", 0x6 }, |
| 17483 | { "In-0x07", 0x7 }, |
| 17484 | { "In-0x08", 0x8 }, |
| 17485 | { "In-0x09", 0x9 }, |
| 17486 | { "In-0x0a", 0x0a }, |
| 17487 | { "In-0x0b", 0x0b }, |
| 17488 | { "In-0x0c", 0x0c }, |
| 17489 | { "In-0x0d", 0x0d }, |
| 17490 | { "In-0x0e", 0x0e }, |
| 17491 | { "In-0x0f", 0x0f }, |
| 17492 | }, |
| 17493 | }; |
| 17494 | #endif |
| 17495 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17496 | /* |
| 17497 | * 2ch mode |
| 17498 | */ |
| 17499 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17500 | { 2, NULL } |
| 17501 | }; |
| 17502 | |
| 17503 | /* |
| 17504 | * 2ch mode |
| 17505 | */ |
| 17506 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17507 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17508 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17509 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17510 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17511 | { } /* end */ |
| 17512 | }; |
| 17513 | |
| 17514 | /* |
| 17515 | * 6ch mode |
| 17516 | */ |
| 17517 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17518 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17519 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17520 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17521 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17522 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17523 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17524 | { } /* end */ |
| 17525 | }; |
| 17526 | |
| 17527 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17528 | { 2, alc662_3ST_ch2_init }, |
| 17529 | { 6, alc662_3ST_ch6_init }, |
| 17530 | }; |
| 17531 | |
| 17532 | /* |
| 17533 | * 2ch mode |
| 17534 | */ |
| 17535 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17536 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17537 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17538 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17539 | { } /* end */ |
| 17540 | }; |
| 17541 | |
| 17542 | /* |
| 17543 | * 6ch mode |
| 17544 | */ |
| 17545 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17546 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17547 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17548 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17549 | { } /* end */ |
| 17550 | }; |
| 17551 | |
| 17552 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17553 | { 2, alc662_sixstack_ch6_init }, |
| 17554 | { 6, alc662_sixstack_ch8_init }, |
| 17555 | }; |
| 17556 | |
| 17557 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17558 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17559 | */ |
| 17560 | |
| 17561 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17562 | /* output mixer control */ |
| 17563 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17564 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17565 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17566 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17567 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17568 | 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] | 17569 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17570 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17571 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17572 | |
| 17573 | /*Input mixer control */ |
| 17574 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17575 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17576 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17577 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17579 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17580 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17581 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17582 | { } /* end */ |
| 17583 | }; |
| 17584 | |
| 17585 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17586 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17587 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17588 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17589 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17590 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17591 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17592 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17593 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17595 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17596 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17597 | { } /* end */ |
| 17598 | }; |
| 17599 | |
| 17600 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17601 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17602 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17603 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17604 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17605 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17606 | 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] | 17607 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17608 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17609 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17610 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17611 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17612 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17613 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17616 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17617 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17618 | { } /* end */ |
| 17619 | }; |
| 17620 | |
| 17621 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17622 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17623 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17624 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17625 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17626 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17627 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17628 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17629 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17630 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17631 | { } /* end */ |
| 17632 | }; |
| 17633 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17634 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17635 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17636 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17637 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17638 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17639 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17640 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17641 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17642 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17643 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17644 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17645 | { } /* end */ |
| 17646 | }; |
| 17647 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17648 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17649 | ALC262_HIPPO_MASTER_SWITCH, |
| 17650 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17651 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17652 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17653 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17654 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17655 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17656 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17659 | { } /* end */ |
| 17660 | }; |
| 17661 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17662 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17663 | .ops = &snd_hda_bind_vol, |
| 17664 | .values = { |
| 17665 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17666 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17667 | 0 |
| 17668 | }, |
| 17669 | }; |
| 17670 | |
| 17671 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17672 | .ops = &snd_hda_bind_sw, |
| 17673 | .values = { |
| 17674 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17675 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17676 | 0 |
| 17677 | }, |
| 17678 | }; |
| 17679 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17680 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17681 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17682 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17683 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17685 | { } /* end */ |
| 17686 | }; |
| 17687 | |
| 17688 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17689 | .ops = &snd_hda_bind_sw, |
| 17690 | .values = { |
| 17691 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17692 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17693 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17694 | 0 |
| 17695 | }, |
| 17696 | }; |
| 17697 | |
| 17698 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17699 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17700 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17701 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17702 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17703 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17704 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17705 | |
| 17706 | { } /* end */ |
| 17707 | }; |
| 17708 | |
| 17709 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17710 | .ops = &snd_hda_bind_sw, |
| 17711 | .values = { |
| 17712 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17713 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17714 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17715 | 0 |
| 17716 | }, |
| 17717 | }; |
| 17718 | |
| 17719 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17720 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17721 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17724 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17725 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17726 | { } /* end */ |
| 17727 | }; |
| 17728 | |
| 17729 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17730 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17731 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17732 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17733 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17735 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17736 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17737 | { } /* end */ |
| 17738 | }; |
| 17739 | |
| 17740 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17741 | .ops = &snd_hda_bind_vol, |
| 17742 | .values = { |
| 17743 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17744 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17745 | 0 |
| 17746 | }, |
| 17747 | }; |
| 17748 | |
| 17749 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17750 | .ops = &snd_hda_bind_sw, |
| 17751 | .values = { |
| 17752 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17753 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17754 | 0 |
| 17755 | }, |
| 17756 | }; |
| 17757 | |
| 17758 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17759 | HDA_BIND_VOL("Master Playback Volume", |
| 17760 | &alc663_asus_two_bind_master_vol), |
| 17761 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17762 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17763 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17766 | { } /* end */ |
| 17767 | }; |
| 17768 | |
| 17769 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17770 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17771 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17772 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17773 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17774 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17775 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17776 | { } /* end */ |
| 17777 | }; |
| 17778 | |
| 17779 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17780 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17781 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17782 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17783 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17784 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17785 | |
| 17786 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17787 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17788 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17789 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17790 | { } /* end */ |
| 17791 | }; |
| 17792 | |
| 17793 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17794 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17795 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17796 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17797 | |
| 17798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17800 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17801 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17803 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17804 | { } /* end */ |
| 17805 | }; |
| 17806 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17807 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17808 | .ops = &snd_hda_bind_sw, |
| 17809 | .values = { |
| 17810 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17811 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17812 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17813 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17814 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17815 | 0 |
| 17816 | }, |
| 17817 | }; |
| 17818 | |
| 17819 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17820 | .ops = &snd_hda_bind_sw, |
| 17821 | .values = { |
| 17822 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17823 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17824 | 0 |
| 17825 | }, |
| 17826 | }; |
| 17827 | |
| 17828 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17829 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17830 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17831 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17832 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17833 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17834 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17835 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17836 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17838 | { } /* end */ |
| 17839 | }; |
| 17840 | |
| 17841 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17842 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17843 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17844 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17845 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17846 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17849 | { } /* end */ |
| 17850 | }; |
| 17851 | |
| 17852 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17853 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17854 | { |
| 17855 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17856 | .name = "Channel Mode", |
| 17857 | .info = alc_ch_mode_info, |
| 17858 | .get = alc_ch_mode_get, |
| 17859 | .put = alc_ch_mode_put, |
| 17860 | }, |
| 17861 | { } /* end */ |
| 17862 | }; |
| 17863 | |
| 17864 | static struct hda_verb alc662_init_verbs[] = { |
| 17865 | /* ADC: mute amp left and right */ |
| 17866 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17867 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17868 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17869 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17870 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17871 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17872 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17873 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17874 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17875 | |
| 17876 | /* Front Pin: output 0 (0x0c) */ |
| 17877 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17878 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17879 | |
| 17880 | /* Rear Pin: output 1 (0x0d) */ |
| 17881 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17883 | |
| 17884 | /* CLFE Pin: output 2 (0x0e) */ |
| 17885 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17886 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17887 | |
| 17888 | /* Mic (rear) pin: input vref at 80% */ |
| 17889 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17890 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17891 | /* Front Mic pin: input vref at 80% */ |
| 17892 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17893 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17894 | /* Line In pin: input */ |
| 17895 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17896 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17897 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17898 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17899 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17900 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17901 | /* CD pin widget for input */ |
| 17902 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17903 | |
| 17904 | /* FIXME: use matrix-type input source selection */ |
| 17905 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17906 | /* Input mixer */ |
| 17907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17908 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17909 | |
| 17910 | /* always trun on EAPD */ |
| 17911 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17912 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17913 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17914 | { } |
| 17915 | }; |
| 17916 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17917 | static struct hda_verb alc663_init_verbs[] = { |
| 17918 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17919 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17920 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17921 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17924 | { } |
| 17925 | }; |
| 17926 | |
| 17927 | static struct hda_verb alc272_init_verbs[] = { |
| 17928 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17929 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17930 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17931 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17932 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17933 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17934 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17935 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17936 | { } |
| 17937 | }; |
| 17938 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17939 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17940 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17941 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17942 | {} |
| 17943 | }; |
| 17944 | |
| 17945 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17946 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17947 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17948 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17949 | }; |
| 17950 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17951 | /* Set Unsolicited Event*/ |
| 17952 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17953 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17954 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17955 | {} |
| 17956 | }; |
| 17957 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17958 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17960 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17961 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17962 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17963 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17964 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17965 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17966 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17967 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17968 | {} |
| 17969 | }; |
| 17970 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17971 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17972 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17973 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17974 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17975 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17977 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17978 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17979 | {} |
| 17980 | }; |
| 17981 | |
| 17982 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17983 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17984 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17985 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17986 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17989 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17990 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17991 | {} |
| 17992 | }; |
| 17993 | |
| 17994 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17995 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17997 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18000 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18001 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18002 | {} |
| 18003 | }; |
| 18004 | |
| 18005 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 18006 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18007 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18008 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18009 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18010 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18011 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18012 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18013 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18014 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18015 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18016 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18017 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18018 | {} |
| 18019 | }; |
| 18020 | |
| 18021 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18022 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18023 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18024 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18025 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18029 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18030 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18031 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18032 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18033 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18034 | {} |
| 18035 | }; |
| 18036 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18037 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18038 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18039 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18040 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18041 | |
| 18042 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18043 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18044 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18045 | |
| 18046 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18047 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18048 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18049 | {} |
| 18050 | }; |
| 18051 | |
| 18052 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18053 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18054 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18055 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18056 | |
| 18057 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18058 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18059 | {} |
| 18060 | }; |
| 18061 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18062 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18063 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18064 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18065 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18066 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18067 | {} |
| 18068 | }; |
| 18069 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18070 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18071 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18072 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18073 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18074 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18075 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18076 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18077 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18080 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18081 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18082 | {} |
| 18083 | }; |
| 18084 | |
| 18085 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18086 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18087 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18088 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18089 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18090 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18091 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18092 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18093 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18094 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18095 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18096 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18097 | {} |
| 18098 | }; |
| 18099 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18100 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18101 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18102 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18103 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18104 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18105 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18107 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18108 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18109 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18110 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18113 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18114 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18115 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18116 | {} |
| 18117 | }; |
| 18118 | |
| 18119 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18120 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18122 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18123 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18124 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18125 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18126 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18127 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18128 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18129 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18130 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18132 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18133 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18134 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18135 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18136 | {} |
| 18137 | }; |
| 18138 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18139 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18140 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18141 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18142 | { } /* end */ |
| 18143 | }; |
| 18144 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18145 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18146 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18147 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18148 | { } /* end */ |
| 18149 | }; |
| 18150 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18151 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18152 | { |
| 18153 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18154 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18155 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18156 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18157 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18158 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18159 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18160 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18161 | } |
| 18162 | |
| 18163 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18164 | { |
| 18165 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18166 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18167 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18168 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18169 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18170 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18171 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18172 | HDA_AMP_MUTE, bits); |
| 18173 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18174 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18175 | } |
| 18176 | |
| 18177 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18178 | unsigned int res) |
| 18179 | { |
| 18180 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18181 | alc662_lenovo_101e_all_automute(codec); |
| 18182 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18183 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18184 | } |
| 18185 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18186 | /* unsolicited event for HP jack sensing */ |
| 18187 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18188 | unsigned int res) |
| 18189 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18190 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18191 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18192 | else |
| 18193 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18194 | } |
| 18195 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18196 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18197 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18198 | struct alc_spec *spec = codec->spec; |
| 18199 | |
| 18200 | alc262_hippo1_setup(codec); |
| 18201 | spec->ext_mic.pin = 0x18; |
| 18202 | spec->ext_mic.mux_idx = 0; |
| 18203 | spec->int_mic.pin = 0x19; |
| 18204 | spec->int_mic.mux_idx = 1; |
| 18205 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18206 | } |
| 18207 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18208 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18209 | { |
| 18210 | alc262_hippo_automute(codec); |
| 18211 | alc_mic_automute(codec); |
| 18212 | } |
| 18213 | |
| 18214 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18215 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18216 | struct alc_spec *spec = codec->spec; |
| 18217 | |
| 18218 | spec->autocfg.hp_pins[0] = 0x14; |
| 18219 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18220 | } |
| 18221 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18222 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18223 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18224 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18225 | { |
| 18226 | unsigned int present; |
| 18227 | unsigned char bits; |
| 18228 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18229 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18230 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18231 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18232 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18233 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18234 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18235 | } |
| 18236 | |
| 18237 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18238 | { |
| 18239 | unsigned int present; |
| 18240 | unsigned char bits; |
| 18241 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18242 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18243 | bits = present ? HDA_AMP_MUTE : 0; |
| 18244 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18245 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18246 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18247 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18248 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18249 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18250 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18251 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18252 | } |
| 18253 | |
| 18254 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18255 | { |
| 18256 | unsigned int present; |
| 18257 | unsigned char bits; |
| 18258 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18259 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18260 | bits = present ? HDA_AMP_MUTE : 0; |
| 18261 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18262 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18263 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18264 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18265 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18266 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18267 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18268 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18269 | } |
| 18270 | |
| 18271 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18272 | { |
| 18273 | unsigned int present; |
| 18274 | unsigned char bits; |
| 18275 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18276 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18277 | bits = present ? 0 : PIN_OUT; |
| 18278 | snd_hda_codec_write(codec, 0x14, 0, |
| 18279 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18280 | } |
| 18281 | |
| 18282 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18283 | { |
| 18284 | unsigned int present1, present2; |
| 18285 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18286 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18287 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18288 | |
| 18289 | if (present1 || present2) { |
| 18290 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18291 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18292 | } else { |
| 18293 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18294 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18295 | } |
| 18296 | } |
| 18297 | |
| 18298 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18299 | { |
| 18300 | unsigned int present1, present2; |
| 18301 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18302 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18303 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18304 | |
| 18305 | if (present1 || present2) { |
| 18306 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18307 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18308 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18309 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18310 | } else { |
| 18311 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18312 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18313 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18314 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18315 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18316 | } |
| 18317 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18318 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18319 | { |
| 18320 | unsigned int present1, present2; |
| 18321 | |
| 18322 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18323 | AC_VERB_GET_PIN_SENSE, 0) |
| 18324 | & AC_PINSENSE_PRESENCE; |
| 18325 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18326 | AC_VERB_GET_PIN_SENSE, 0) |
| 18327 | & AC_PINSENSE_PRESENCE; |
| 18328 | |
| 18329 | if (present1 || present2) { |
| 18330 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18331 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18332 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18333 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18334 | } else { |
| 18335 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18336 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18337 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18338 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18339 | } |
| 18340 | } |
| 18341 | |
| 18342 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18343 | { |
| 18344 | unsigned int present1, present2; |
| 18345 | |
| 18346 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18347 | AC_VERB_GET_PIN_SENSE, 0) |
| 18348 | & AC_PINSENSE_PRESENCE; |
| 18349 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18350 | AC_VERB_GET_PIN_SENSE, 0) |
| 18351 | & AC_PINSENSE_PRESENCE; |
| 18352 | |
| 18353 | if (present1 || present2) { |
| 18354 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18355 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18356 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18357 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18358 | } else { |
| 18359 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18360 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18361 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18362 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18363 | } |
| 18364 | } |
| 18365 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18366 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18367 | unsigned int res) |
| 18368 | { |
| 18369 | switch (res >> 26) { |
| 18370 | case ALC880_HP_EVENT: |
| 18371 | alc663_m51va_speaker_automute(codec); |
| 18372 | break; |
| 18373 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18374 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18375 | break; |
| 18376 | } |
| 18377 | } |
| 18378 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18379 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18380 | { |
| 18381 | struct alc_spec *spec = codec->spec; |
| 18382 | spec->ext_mic.pin = 0x18; |
| 18383 | spec->ext_mic.mux_idx = 0; |
| 18384 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18385 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18386 | spec->auto_mic = 1; |
| 18387 | } |
| 18388 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18389 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18390 | { |
| 18391 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18392 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18393 | } |
| 18394 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18395 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18396 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18397 | |
| 18398 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18399 | { |
| 18400 | struct alc_spec *spec = codec->spec; |
| 18401 | spec->ext_mic.pin = 0x18; |
| 18402 | spec->ext_mic.mux_idx = 0; |
| 18403 | spec->int_mic.pin = 0x19; |
| 18404 | spec->int_mic.mux_idx = 1; |
| 18405 | spec->auto_mic = 1; |
| 18406 | } |
| 18407 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18408 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18409 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18410 | /* ***************** Mode2 ******************************/ |
| 18411 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18412 | unsigned int res) |
| 18413 | { |
| 18414 | switch (res >> 26) { |
| 18415 | case ALC880_HP_EVENT: |
| 18416 | alc662_f5z_speaker_automute(codec); |
| 18417 | break; |
| 18418 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18419 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18420 | break; |
| 18421 | } |
| 18422 | } |
| 18423 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18424 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18425 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18426 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18427 | { |
| 18428 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18429 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18430 | } |
| 18431 | /* ***************** Mode3 ******************************/ |
| 18432 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18433 | unsigned int res) |
| 18434 | { |
| 18435 | switch (res >> 26) { |
| 18436 | case ALC880_HP_EVENT: |
| 18437 | alc663_two_hp_m1_speaker_automute(codec); |
| 18438 | break; |
| 18439 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18440 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18441 | break; |
| 18442 | } |
| 18443 | } |
| 18444 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18445 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18446 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18447 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18448 | { |
| 18449 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18450 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18451 | } |
| 18452 | /* ***************** Mode4 ******************************/ |
| 18453 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18454 | unsigned int res) |
| 18455 | { |
| 18456 | switch (res >> 26) { |
| 18457 | case ALC880_HP_EVENT: |
| 18458 | alc663_21jd_two_speaker_automute(codec); |
| 18459 | break; |
| 18460 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18461 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18462 | break; |
| 18463 | } |
| 18464 | } |
| 18465 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18466 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18467 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18468 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18469 | { |
| 18470 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18471 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18472 | } |
| 18473 | /* ***************** Mode5 ******************************/ |
| 18474 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18475 | unsigned int res) |
| 18476 | { |
| 18477 | switch (res >> 26) { |
| 18478 | case ALC880_HP_EVENT: |
| 18479 | alc663_15jd_two_speaker_automute(codec); |
| 18480 | break; |
| 18481 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18482 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18483 | break; |
| 18484 | } |
| 18485 | } |
| 18486 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18487 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18488 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18489 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18490 | { |
| 18491 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18492 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18493 | } |
| 18494 | /* ***************** Mode6 ******************************/ |
| 18495 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18496 | unsigned int res) |
| 18497 | { |
| 18498 | switch (res >> 26) { |
| 18499 | case ALC880_HP_EVENT: |
| 18500 | alc663_two_hp_m2_speaker_automute(codec); |
| 18501 | break; |
| 18502 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18503 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18504 | break; |
| 18505 | } |
| 18506 | } |
| 18507 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18508 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18509 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18510 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18511 | { |
| 18512 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18513 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18514 | } |
| 18515 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18516 | /* ***************** Mode7 ******************************/ |
| 18517 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18518 | unsigned int res) |
| 18519 | { |
| 18520 | switch (res >> 26) { |
| 18521 | case ALC880_HP_EVENT: |
| 18522 | alc663_two_hp_m7_speaker_automute(codec); |
| 18523 | break; |
| 18524 | case ALC880_MIC_EVENT: |
| 18525 | alc_mic_automute(codec); |
| 18526 | break; |
| 18527 | } |
| 18528 | } |
| 18529 | |
| 18530 | #define alc663_mode7_setup alc663_mode1_setup |
| 18531 | |
| 18532 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18533 | { |
| 18534 | alc663_two_hp_m7_speaker_automute(codec); |
| 18535 | alc_mic_automute(codec); |
| 18536 | } |
| 18537 | |
| 18538 | /* ***************** Mode8 ******************************/ |
| 18539 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18540 | unsigned int res) |
| 18541 | { |
| 18542 | switch (res >> 26) { |
| 18543 | case ALC880_HP_EVENT: |
| 18544 | alc663_two_hp_m8_speaker_automute(codec); |
| 18545 | break; |
| 18546 | case ALC880_MIC_EVENT: |
| 18547 | alc_mic_automute(codec); |
| 18548 | break; |
| 18549 | } |
| 18550 | } |
| 18551 | |
| 18552 | #define alc663_mode8_setup alc663_m51va_setup |
| 18553 | |
| 18554 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18555 | { |
| 18556 | alc663_two_hp_m8_speaker_automute(codec); |
| 18557 | alc_mic_automute(codec); |
| 18558 | } |
| 18559 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18560 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18561 | { |
| 18562 | unsigned int present; |
| 18563 | unsigned char bits; |
| 18564 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18565 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18566 | bits = present ? HDA_AMP_MUTE : 0; |
| 18567 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18568 | HDA_AMP_MUTE, bits); |
| 18569 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18570 | HDA_AMP_MUTE, bits); |
| 18571 | } |
| 18572 | |
| 18573 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18574 | { |
| 18575 | unsigned int present; |
| 18576 | unsigned char bits; |
| 18577 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18578 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18579 | bits = present ? HDA_AMP_MUTE : 0; |
| 18580 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18581 | HDA_AMP_MUTE, bits); |
| 18582 | } |
| 18583 | |
| 18584 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18585 | unsigned int res) |
| 18586 | { |
| 18587 | switch (res >> 26) { |
| 18588 | case ALC880_HP_EVENT: |
| 18589 | alc663_g71v_hp_automute(codec); |
| 18590 | break; |
| 18591 | case ALC880_FRONT_EVENT: |
| 18592 | alc663_g71v_front_automute(codec); |
| 18593 | break; |
| 18594 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18595 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18596 | break; |
| 18597 | } |
| 18598 | } |
| 18599 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18600 | #define alc663_g71v_setup alc663_m51va_setup |
| 18601 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18602 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18603 | { |
| 18604 | alc663_g71v_front_automute(codec); |
| 18605 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18606 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18607 | } |
| 18608 | |
| 18609 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18610 | unsigned int res) |
| 18611 | { |
| 18612 | switch (res >> 26) { |
| 18613 | case ALC880_HP_EVENT: |
| 18614 | alc663_m51va_speaker_automute(codec); |
| 18615 | break; |
| 18616 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18617 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18618 | break; |
| 18619 | } |
| 18620 | } |
| 18621 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18622 | #define alc663_g50v_setup alc663_m51va_setup |
| 18623 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18624 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18625 | { |
| 18626 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18627 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18628 | } |
| 18629 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18630 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18631 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18632 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18633 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18634 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18635 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18636 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18637 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18638 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18639 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18640 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18641 | { } /* end */ |
| 18642 | }; |
| 18643 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18644 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18645 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18646 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18647 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18648 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18649 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18650 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18652 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18653 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18654 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18655 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18656 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18657 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18658 | { } /* end */ |
| 18659 | }; |
| 18660 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18661 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18662 | #define alc662_loopbacks alc880_loopbacks |
| 18663 | #endif |
| 18664 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18665 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18666 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18667 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18668 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18669 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18670 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18671 | |
| 18672 | /* |
| 18673 | * configuration and preset |
| 18674 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18675 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18676 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18677 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18678 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18679 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18680 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18681 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18682 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18683 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18684 | [ALC663_ASUS_M51VA] = "m51va", |
| 18685 | [ALC663_ASUS_G71V] = "g71v", |
| 18686 | [ALC663_ASUS_H13] = "h13", |
| 18687 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18688 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18689 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18690 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18691 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18692 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18693 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18694 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18695 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18696 | [ALC272_DELL] = "dell", |
| 18697 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18698 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18699 | [ALC662_AUTO] = "auto", |
| 18700 | }; |
| 18701 | |
| 18702 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18703 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18704 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18705 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18706 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18707 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18708 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18709 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18710 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18711 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18712 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18713 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18714 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18715 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18716 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18717 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18718 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18719 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18720 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18721 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18722 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18723 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18724 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18725 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18726 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18727 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18728 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18729 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18730 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18731 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18732 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18733 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18734 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18735 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18736 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18737 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18738 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18739 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18740 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18741 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18742 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18743 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18744 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18745 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18746 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18747 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18748 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18749 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18750 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18751 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18752 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18753 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18754 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18755 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18756 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18757 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18758 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18759 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18760 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18761 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18762 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18763 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18764 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18765 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18766 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18767 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18768 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18769 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18770 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18771 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18772 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18773 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18774 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18775 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18776 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18777 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18778 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18779 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18780 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18781 | {} |
| 18782 | }; |
| 18783 | |
| 18784 | static struct alc_config_preset alc662_presets[] = { |
| 18785 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18786 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18787 | .init_verbs = { alc662_init_verbs }, |
| 18788 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18789 | .dac_nids = alc662_dac_nids, |
| 18790 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18791 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18792 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18793 | .channel_mode = alc662_3ST_2ch_modes, |
| 18794 | .input_mux = &alc662_capture_source, |
| 18795 | }, |
| 18796 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18797 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18798 | .init_verbs = { alc662_init_verbs }, |
| 18799 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18800 | .dac_nids = alc662_dac_nids, |
| 18801 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18802 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18803 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18804 | .channel_mode = alc662_3ST_6ch_modes, |
| 18805 | .need_dac_fix = 1, |
| 18806 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18807 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18808 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18809 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18810 | .init_verbs = { alc662_init_verbs }, |
| 18811 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18812 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18813 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18814 | .channel_mode = alc662_3ST_6ch_modes, |
| 18815 | .need_dac_fix = 1, |
| 18816 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18817 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18818 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18819 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18820 | .init_verbs = { alc662_init_verbs }, |
| 18821 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18822 | .dac_nids = alc662_dac_nids, |
| 18823 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18824 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18825 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18826 | .channel_mode = alc662_5stack_modes, |
| 18827 | .input_mux = &alc662_capture_source, |
| 18828 | }, |
| 18829 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18830 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18831 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18832 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18833 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18834 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18835 | .channel_mode = alc662_3ST_2ch_modes, |
| 18836 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18837 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18838 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18839 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18840 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18841 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18842 | .init_verbs = { alc662_init_verbs, |
| 18843 | alc662_eeepc_sue_init_verbs }, |
| 18844 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18845 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18846 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18847 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18848 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18849 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18850 | .init_hook = alc662_eeepc_inithook, |
| 18851 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18852 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18853 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18854 | alc662_chmode_mixer }, |
| 18855 | .init_verbs = { alc662_init_verbs, |
| 18856 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18857 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18858 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18859 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18860 | .channel_mode = alc662_3ST_6ch_modes, |
| 18861 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18862 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18863 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18864 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18865 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18866 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18867 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18868 | .init_verbs = { alc662_init_verbs, |
| 18869 | alc662_ecs_init_verbs }, |
| 18870 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18871 | .dac_nids = alc662_dac_nids, |
| 18872 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18873 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18874 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18875 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18876 | .init_hook = alc662_eeepc_inithook, |
| 18877 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18878 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18879 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18880 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18881 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18882 | .dac_nids = alc662_dac_nids, |
| 18883 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18884 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18885 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18886 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18887 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18888 | .init_hook = alc663_m51va_inithook, |
| 18889 | }, |
| 18890 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18891 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18892 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18893 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18894 | .dac_nids = alc662_dac_nids, |
| 18895 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18896 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18897 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18898 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18899 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18900 | .init_hook = alc663_g71v_inithook, |
| 18901 | }, |
| 18902 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18903 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18904 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18905 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18906 | .dac_nids = alc662_dac_nids, |
| 18907 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18908 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18909 | .unsol_event = alc663_m51va_unsol_event, |
| 18910 | .init_hook = alc663_m51va_inithook, |
| 18911 | }, |
| 18912 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18913 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18914 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18915 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18916 | .dac_nids = alc662_dac_nids, |
| 18917 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18918 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18919 | .channel_mode = alc662_3ST_6ch_modes, |
| 18920 | .input_mux = &alc663_capture_source, |
| 18921 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18922 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18923 | .init_hook = alc663_g50v_inithook, |
| 18924 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18925 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18926 | .mixers = { alc663_m51va_mixer }, |
| 18927 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18928 | .init_verbs = { alc662_init_verbs, |
| 18929 | alc663_21jd_amic_init_verbs }, |
| 18930 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18931 | .hp_nid = 0x03, |
| 18932 | .dac_nids = alc662_dac_nids, |
| 18933 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18934 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18935 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18936 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18937 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18938 | .init_hook = alc663_mode1_inithook, |
| 18939 | }, |
| 18940 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18941 | .mixers = { alc662_1bjd_mixer }, |
| 18942 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18943 | .init_verbs = { alc662_init_verbs, |
| 18944 | alc662_1bjd_amic_init_verbs }, |
| 18945 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18946 | .dac_nids = alc662_dac_nids, |
| 18947 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18948 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18949 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18950 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18951 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18952 | .init_hook = alc662_mode2_inithook, |
| 18953 | }, |
| 18954 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18955 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18956 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18957 | .init_verbs = { alc662_init_verbs, |
| 18958 | alc663_two_hp_amic_m1_init_verbs }, |
| 18959 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18960 | .hp_nid = 0x03, |
| 18961 | .dac_nids = alc662_dac_nids, |
| 18962 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18963 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18964 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18965 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18966 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18967 | .init_hook = alc663_mode3_inithook, |
| 18968 | }, |
| 18969 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18970 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18971 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18972 | .init_verbs = { alc662_init_verbs, |
| 18973 | alc663_21jd_amic_init_verbs}, |
| 18974 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18975 | .hp_nid = 0x03, |
| 18976 | .dac_nids = alc662_dac_nids, |
| 18977 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18978 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18979 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18980 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18981 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18982 | .init_hook = alc663_mode4_inithook, |
| 18983 | }, |
| 18984 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18985 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18986 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18987 | .init_verbs = { alc662_init_verbs, |
| 18988 | alc663_15jd_amic_init_verbs }, |
| 18989 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18990 | .hp_nid = 0x03, |
| 18991 | .dac_nids = alc662_dac_nids, |
| 18992 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18993 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18994 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18995 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18996 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18997 | .init_hook = alc663_mode5_inithook, |
| 18998 | }, |
| 18999 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19000 | .mixers = { alc663_two_hp_m2_mixer }, |
| 19001 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19002 | .init_verbs = { alc662_init_verbs, |
| 19003 | alc663_two_hp_amic_m2_init_verbs }, |
| 19004 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19005 | .hp_nid = 0x03, |
| 19006 | .dac_nids = alc662_dac_nids, |
| 19007 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19008 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19009 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19010 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19011 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19012 | .init_hook = alc663_mode6_inithook, |
| 19013 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19014 | [ALC663_ASUS_MODE7] = { |
| 19015 | .mixers = { alc663_mode7_mixer }, |
| 19016 | .cap_mixer = alc662_auto_capture_mixer, |
| 19017 | .init_verbs = { alc662_init_verbs, |
| 19018 | alc663_mode7_init_verbs }, |
| 19019 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19020 | .hp_nid = 0x03, |
| 19021 | .dac_nids = alc662_dac_nids, |
| 19022 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19023 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19024 | .channel_mode = alc662_3ST_2ch_modes, |
| 19025 | .unsol_event = alc663_mode7_unsol_event, |
| 19026 | .setup = alc663_mode7_setup, |
| 19027 | .init_hook = alc663_mode7_inithook, |
| 19028 | }, |
| 19029 | [ALC663_ASUS_MODE8] = { |
| 19030 | .mixers = { alc663_mode8_mixer }, |
| 19031 | .cap_mixer = alc662_auto_capture_mixer, |
| 19032 | .init_verbs = { alc662_init_verbs, |
| 19033 | alc663_mode8_init_verbs }, |
| 19034 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19035 | .hp_nid = 0x03, |
| 19036 | .dac_nids = alc662_dac_nids, |
| 19037 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19038 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19039 | .channel_mode = alc662_3ST_2ch_modes, |
| 19040 | .unsol_event = alc663_mode8_unsol_event, |
| 19041 | .setup = alc663_mode8_setup, |
| 19042 | .init_hook = alc663_mode8_inithook, |
| 19043 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19044 | [ALC272_DELL] = { |
| 19045 | .mixers = { alc663_m51va_mixer }, |
| 19046 | .cap_mixer = alc272_auto_capture_mixer, |
| 19047 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 19048 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19049 | .dac_nids = alc662_dac_nids, |
| 19050 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19051 | .adc_nids = alc272_adc_nids, |
| 19052 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 19053 | .capsrc_nids = alc272_capsrc_nids, |
| 19054 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19055 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19056 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19057 | .init_hook = alc663_m51va_inithook, |
| 19058 | }, |
| 19059 | [ALC272_DELL_ZM1] = { |
| 19060 | .mixers = { alc663_m51va_mixer }, |
| 19061 | .cap_mixer = alc662_auto_capture_mixer, |
| 19062 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 19063 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19064 | .dac_nids = alc662_dac_nids, |
| 19065 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19066 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19067 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19068 | .capsrc_nids = alc662_capsrc_nids, |
| 19069 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19070 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19071 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19072 | .init_hook = alc663_m51va_inithook, |
| 19073 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19074 | [ALC272_SAMSUNG_NC10] = { |
| 19075 | .mixers = { alc272_nc10_mixer }, |
| 19076 | .init_verbs = { alc662_init_verbs, |
| 19077 | alc663_21jd_amic_init_verbs }, |
| 19078 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19079 | .dac_nids = alc272_dac_nids, |
| 19080 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19081 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19082 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19083 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19084 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19085 | .init_hook = alc663_mode4_inithook, |
| 19086 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19087 | }; |
| 19088 | |
| 19089 | |
| 19090 | /* |
| 19091 | * BIOS auto configuration |
| 19092 | */ |
| 19093 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19094 | /* convert from MIX nid to DAC */ |
| 19095 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19096 | { |
| 19097 | if (nid == 0x0f) |
| 19098 | return 0x02; |
| 19099 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19100 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19101 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19102 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19103 | else |
| 19104 | return 0; |
| 19105 | } |
| 19106 | |
| 19107 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19108 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19109 | hda_nid_t dac) |
| 19110 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19111 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19112 | int i, num; |
| 19113 | |
| 19114 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19115 | for (i = 0; i < num; i++) { |
| 19116 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19117 | return mix[i]; |
| 19118 | } |
| 19119 | return 0; |
| 19120 | } |
| 19121 | |
| 19122 | /* look for an empty DAC slot */ |
| 19123 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19124 | { |
| 19125 | struct alc_spec *spec = codec->spec; |
| 19126 | hda_nid_t srcs[5]; |
| 19127 | int i, j, num; |
| 19128 | |
| 19129 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19130 | if (num < 0) |
| 19131 | return 0; |
| 19132 | for (i = 0; i < num; i++) { |
| 19133 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19134 | if (!nid) |
| 19135 | continue; |
| 19136 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19137 | if (spec->multiout.dac_nids[j] == nid) |
| 19138 | break; |
| 19139 | if (j >= spec->multiout.num_dacs) |
| 19140 | return nid; |
| 19141 | } |
| 19142 | return 0; |
| 19143 | } |
| 19144 | |
| 19145 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19146 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19147 | const struct auto_pin_cfg *cfg) |
| 19148 | { |
| 19149 | struct alc_spec *spec = codec->spec; |
| 19150 | int i; |
| 19151 | hda_nid_t dac; |
| 19152 | |
| 19153 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19154 | for (i = 0; i < cfg->line_outs; i++) { |
| 19155 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19156 | if (!dac) |
| 19157 | continue; |
| 19158 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19159 | } |
| 19160 | return 0; |
| 19161 | } |
| 19162 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19163 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 19164 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19165 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19166 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19167 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19168 | } |
| 19169 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19170 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19171 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19172 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19173 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19174 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19175 | } |
| 19176 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19177 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19178 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19179 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19180 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19181 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19182 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19183 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19184 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19185 | |
| 19186 | /* add playback controls from the parsed DAC table */ |
| 19187 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19188 | const struct auto_pin_cfg *cfg) |
| 19189 | { |
| 19190 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19191 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19192 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19193 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19194 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19195 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19196 | int i, err; |
| 19197 | |
| 19198 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19199 | nid = spec->multiout.dac_nids[i]; |
| 19200 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19201 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19202 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19203 | if (!mix) |
| 19204 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19205 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19206 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19207 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19208 | if (err < 0) |
| 19209 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19210 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19211 | if (err < 0) |
| 19212 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19213 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19214 | if (err < 0) |
| 19215 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19216 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19217 | if (err < 0) |
| 19218 | return err; |
| 19219 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19220 | const char *name = pfx; |
| 19221 | if (!name) |
| 19222 | name = chname[i]; |
| 19223 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19224 | if (err < 0) |
| 19225 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19226 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19227 | if (err < 0) |
| 19228 | return err; |
| 19229 | } |
| 19230 | } |
| 19231 | return 0; |
| 19232 | } |
| 19233 | |
| 19234 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19235 | /* return DAC nid if any new DAC is assigned */ |
| 19236 | 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] | 19237 | const char *pfx) |
| 19238 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19239 | struct alc_spec *spec = codec->spec; |
| 19240 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19241 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19242 | |
| 19243 | if (!pin) |
| 19244 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19245 | nid = alc662_look_for_dac(codec, pin); |
| 19246 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19247 | /* the corresponding DAC is already occupied */ |
| 19248 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19249 | return 0; /* no way */ |
| 19250 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19251 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19252 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19253 | } |
| 19254 | |
| 19255 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19256 | if (!mix) |
| 19257 | return 0; |
| 19258 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19259 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19260 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19261 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19262 | if (err < 0) |
| 19263 | return err; |
| 19264 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19265 | } |
| 19266 | |
| 19267 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19268 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19269 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19270 | |
| 19271 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19272 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19273 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19274 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19275 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19276 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19277 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19278 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19279 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19280 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19281 | if (num <= 1) |
| 19282 | return; |
| 19283 | for (i = 0; i < num; i++) { |
| 19284 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19285 | continue; |
| 19286 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19287 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19288 | } |
| 19289 | } |
| 19290 | |
| 19291 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19292 | { |
| 19293 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19294 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19295 | int i; |
| 19296 | |
| 19297 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19298 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19299 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19300 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19301 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19302 | } |
| 19303 | } |
| 19304 | |
| 19305 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19306 | { |
| 19307 | struct alc_spec *spec = codec->spec; |
| 19308 | hda_nid_t pin; |
| 19309 | |
| 19310 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19311 | if (pin) |
| 19312 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19313 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19314 | pin = spec->autocfg.speaker_pins[0]; |
| 19315 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19316 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19317 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19318 | } |
| 19319 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19320 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19321 | |
| 19322 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19323 | { |
| 19324 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19325 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19326 | int i; |
| 19327 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19328 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19329 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19330 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19331 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19332 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19333 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19334 | snd_hda_codec_write(codec, nid, 0, |
| 19335 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19336 | AMP_OUT_MUTE); |
| 19337 | } |
| 19338 | } |
| 19339 | } |
| 19340 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19341 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19342 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19343 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19344 | { |
| 19345 | struct alc_spec *spec = codec->spec; |
| 19346 | int err; |
| 19347 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19348 | |
| 19349 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19350 | alc662_ignore); |
| 19351 | if (err < 0) |
| 19352 | return err; |
| 19353 | if (!spec->autocfg.line_outs) |
| 19354 | return 0; /* can't find valid BIOS pin config */ |
| 19355 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19356 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19357 | if (err < 0) |
| 19358 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19359 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19360 | if (err < 0) |
| 19361 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19362 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19363 | spec->autocfg.speaker_pins[0], |
| 19364 | "Speaker"); |
| 19365 | if (err < 0) |
| 19366 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19367 | if (err) |
| 19368 | spec->multiout.extra_out_nid[0] = err; |
| 19369 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19370 | "Headphone"); |
| 19371 | if (err < 0) |
| 19372 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19373 | if (err) |
| 19374 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19375 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19376 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19377 | return err; |
| 19378 | |
| 19379 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19380 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19381 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19382 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19383 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19384 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19385 | |
| 19386 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19387 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19388 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19389 | add_verb(spec, alc662_init_verbs); |
| 19390 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19391 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19392 | add_verb(spec, alc663_init_verbs); |
| 19393 | |
| 19394 | if (codec->vendor_id == 0x10ec0272) |
| 19395 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19396 | |
| 19397 | err = alc_auto_add_mic_boost(codec); |
| 19398 | if (err < 0) |
| 19399 | return err; |
| 19400 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19401 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19402 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19403 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19404 | else |
| 19405 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19406 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19407 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19408 | } |
| 19409 | |
| 19410 | /* additional initialization for auto-configuration model */ |
| 19411 | static void alc662_auto_init(struct hda_codec *codec) |
| 19412 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19413 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19414 | alc662_auto_init_multi_out(codec); |
| 19415 | alc662_auto_init_hp_out(codec); |
| 19416 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19417 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19418 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19419 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19420 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19421 | } |
| 19422 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19423 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19424 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19425 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19426 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19427 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19428 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19429 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19430 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19431 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19432 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19433 | printk(KERN_WARNING |
| 19434 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19435 | } |
| 19436 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19437 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19438 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19439 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19440 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19441 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19442 | }; |
| 19443 | |
| 19444 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19445 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19446 | .type = ALC_FIXUP_PINS, |
| 19447 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19448 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19449 | { } |
| 19450 | } |
| 19451 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19452 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19453 | .type = ALC_FIXUP_PINS, |
| 19454 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19455 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19456 | { } |
| 19457 | } |
| 19458 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19459 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19460 | .type = ALC_FIXUP_FUNC, |
| 19461 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19462 | }, |
| 19463 | [ALC662_FIXUP_CZC_P10T] = { |
| 19464 | .type = ALC_FIXUP_VERBS, |
| 19465 | .v.verbs = (const struct hda_verb[]) { |
| 19466 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19467 | {} |
| 19468 | } |
| 19469 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19470 | }; |
| 19471 | |
| 19472 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19473 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19474 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19475 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19476 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19477 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19478 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19479 | {} |
| 19480 | }; |
| 19481 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19482 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19483 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19484 | {} |
| 19485 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19486 | |
| 19487 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19488 | static int patch_alc662(struct hda_codec *codec) |
| 19489 | { |
| 19490 | struct alc_spec *spec; |
| 19491 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19492 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19493 | |
| 19494 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19495 | if (!spec) |
| 19496 | return -ENOMEM; |
| 19497 | |
| 19498 | codec->spec = spec; |
| 19499 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19500 | alc_auto_parse_customize_define(codec); |
| 19501 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19502 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19503 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19504 | coef = alc_read_coef_idx(codec, 0); |
| 19505 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19506 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19507 | else if (coef & (1 << 14) && |
| 19508 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19509 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19510 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19511 | else if (coef == 0x4011) |
| 19512 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19513 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19514 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19515 | alc662_models, |
| 19516 | alc662_cfg_tbl); |
| 19517 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19518 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19519 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19520 | board_config = ALC662_AUTO; |
| 19521 | } |
| 19522 | |
| 19523 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19524 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19525 | alc662_fixup_tbl, alc662_fixups); |
| 19526 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19527 | /* automatic parse from the BIOS config */ |
| 19528 | err = alc662_parse_auto_config(codec); |
| 19529 | if (err < 0) { |
| 19530 | alc_free(codec); |
| 19531 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19532 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19533 | printk(KERN_INFO |
| 19534 | "hda_codec: Cannot set up configuration " |
| 19535 | "from BIOS. Using base mode...\n"); |
| 19536 | board_config = ALC662_3ST_2ch_DIG; |
| 19537 | } |
| 19538 | } |
| 19539 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19540 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19541 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19542 | if (err < 0) { |
| 19543 | alc_free(codec); |
| 19544 | return err; |
| 19545 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19546 | } |
| 19547 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19548 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19549 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19550 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19551 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19552 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19553 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19554 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19555 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19556 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19557 | if (!spec->adc_nids) { |
| 19558 | spec->adc_nids = alc662_adc_nids; |
| 19559 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19560 | } |
| 19561 | if (!spec->capsrc_nids) |
| 19562 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19563 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19564 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19565 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19566 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19567 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19568 | switch (codec->vendor_id) { |
| 19569 | case 0x10ec0662: |
| 19570 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19571 | break; |
| 19572 | case 0x10ec0272: |
| 19573 | case 0x10ec0663: |
| 19574 | case 0x10ec0665: |
| 19575 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19576 | break; |
| 19577 | case 0x10ec0273: |
| 19578 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19579 | break; |
| 19580 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19581 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19582 | spec->vmaster_nid = 0x02; |
| 19583 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19584 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19585 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19586 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19587 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19588 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19589 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19590 | alc_init_jacks(codec); |
| 19591 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19592 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19593 | if (!spec->loopback.amplist) |
| 19594 | spec->loopback.amplist = alc662_loopbacks; |
| 19595 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19596 | |
| 19597 | return 0; |
| 19598 | } |
| 19599 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19600 | static int patch_alc888(struct hda_codec *codec) |
| 19601 | { |
| 19602 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19603 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19604 | if (codec->vendor_id == 0x10ec0887) |
| 19605 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19606 | else |
| 19607 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19608 | if (!codec->chip_name) { |
| 19609 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19610 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19611 | } |
| 19612 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19613 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19614 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19615 | } |
| 19616 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19617 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19618 | * ALC680 support |
| 19619 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19620 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19621 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19622 | #define alc680_modes alc260_modes |
| 19623 | |
| 19624 | static hda_nid_t alc680_dac_nids[3] = { |
| 19625 | /* Lout1, Lout2, hp */ |
| 19626 | 0x02, 0x03, 0x04 |
| 19627 | }; |
| 19628 | |
| 19629 | static hda_nid_t alc680_adc_nids[3] = { |
| 19630 | /* ADC0-2 */ |
| 19631 | /* DMIC, MIC, Line-in*/ |
| 19632 | 0x07, 0x08, 0x09 |
| 19633 | }; |
| 19634 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19635 | /* |
| 19636 | * Analog capture ADC cgange |
| 19637 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19638 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19639 | { |
| 19640 | struct alc_spec *spec = codec->spec; |
| 19641 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19642 | int pin_found = 0; |
| 19643 | int type_found = AUTO_PIN_LAST; |
| 19644 | hda_nid_t nid; |
| 19645 | int i; |
| 19646 | |
| 19647 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19648 | nid = cfg->inputs[i].pin; |
| 19649 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19650 | AC_PINCAP_PRES_DETECT)) |
| 19651 | continue; |
| 19652 | if (snd_hda_jack_detect(codec, nid)) { |
| 19653 | if (cfg->inputs[i].type < type_found) { |
| 19654 | type_found = cfg->inputs[i].type; |
| 19655 | pin_found = nid; |
| 19656 | } |
| 19657 | } |
| 19658 | } |
| 19659 | |
| 19660 | nid = 0x07; |
| 19661 | if (pin_found) |
| 19662 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19663 | |
| 19664 | if (nid != spec->cur_adc) |
| 19665 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19666 | spec->cur_adc = nid; |
| 19667 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19668 | spec->cur_adc_format); |
| 19669 | } |
| 19670 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19671 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19672 | struct hda_codec *codec, |
| 19673 | unsigned int stream_tag, |
| 19674 | unsigned int format, |
| 19675 | struct snd_pcm_substream *substream) |
| 19676 | { |
| 19677 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19678 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19679 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19680 | spec->cur_adc_stream_tag = stream_tag; |
| 19681 | spec->cur_adc_format = format; |
| 19682 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19683 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19684 | return 0; |
| 19685 | } |
| 19686 | |
| 19687 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19688 | struct hda_codec *codec, |
| 19689 | struct snd_pcm_substream *substream) |
| 19690 | { |
| 19691 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19692 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19693 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19694 | return 0; |
| 19695 | } |
| 19696 | |
| 19697 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19698 | .substreams = 1, /* can be overridden */ |
| 19699 | .channels_min = 2, |
| 19700 | .channels_max = 2, |
| 19701 | /* NID is set in alc_build_pcms */ |
| 19702 | .ops = { |
| 19703 | .prepare = alc680_capture_pcm_prepare, |
| 19704 | .cleanup = alc680_capture_pcm_cleanup |
| 19705 | }, |
| 19706 | }; |
| 19707 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19708 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19709 | /* output mixer control */ |
| 19710 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19711 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19712 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19714 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19715 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19716 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19717 | { } |
| 19718 | }; |
| 19719 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19720 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19721 | .ops = &snd_hda_bind_vol, |
| 19722 | .values = { |
| 19723 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19724 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19725 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19726 | 0 |
| 19727 | }, |
| 19728 | }; |
| 19729 | |
| 19730 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19731 | .ops = &snd_hda_bind_sw, |
| 19732 | .values = { |
| 19733 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19734 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19735 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19736 | 0 |
| 19737 | }, |
| 19738 | }; |
| 19739 | |
| 19740 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19741 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19742 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19743 | { } /* end */ |
| 19744 | }; |
| 19745 | |
| 19746 | /* |
| 19747 | * generic initialization of ADC, input mixers and output mixers |
| 19748 | */ |
| 19749 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19750 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19751 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19752 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19753 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19754 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19755 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19756 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19757 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19758 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19759 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19760 | |
| 19761 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19762 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19763 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19764 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19766 | |
| 19767 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19768 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19769 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19770 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19771 | { } |
| 19772 | }; |
| 19773 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19774 | /* toggle speaker-output according to the hp-jack state */ |
| 19775 | static void alc680_base_setup(struct hda_codec *codec) |
| 19776 | { |
| 19777 | struct alc_spec *spec = codec->spec; |
| 19778 | |
| 19779 | spec->autocfg.hp_pins[0] = 0x16; |
| 19780 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19781 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19782 | spec->autocfg.num_inputs = 2; |
| 19783 | spec->autocfg.inputs[0].pin = 0x18; |
| 19784 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19785 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19786 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19787 | } |
| 19788 | |
| 19789 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19790 | unsigned int res) |
| 19791 | { |
| 19792 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19793 | alc_automute_amp(codec); |
| 19794 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19795 | alc680_rec_autoswitch(codec); |
| 19796 | } |
| 19797 | |
| 19798 | static void alc680_inithook(struct hda_codec *codec) |
| 19799 | { |
| 19800 | alc_automute_amp(codec); |
| 19801 | alc680_rec_autoswitch(codec); |
| 19802 | } |
| 19803 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19804 | /* create input playback/capture controls for the given pin */ |
| 19805 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19806 | const char *ctlname, int idx) |
| 19807 | { |
| 19808 | hda_nid_t dac; |
| 19809 | int err; |
| 19810 | |
| 19811 | switch (nid) { |
| 19812 | case 0x14: |
| 19813 | dac = 0x02; |
| 19814 | break; |
| 19815 | case 0x15: |
| 19816 | dac = 0x03; |
| 19817 | break; |
| 19818 | case 0x16: |
| 19819 | dac = 0x04; |
| 19820 | break; |
| 19821 | default: |
| 19822 | return 0; |
| 19823 | } |
| 19824 | if (spec->multiout.dac_nids[0] != dac && |
| 19825 | spec->multiout.dac_nids[1] != dac) { |
| 19826 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19827 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19828 | HDA_OUTPUT)); |
| 19829 | if (err < 0) |
| 19830 | return err; |
| 19831 | |
| 19832 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19833 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19834 | |
| 19835 | if (err < 0) |
| 19836 | return err; |
| 19837 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19838 | } |
| 19839 | |
| 19840 | return 0; |
| 19841 | } |
| 19842 | |
| 19843 | /* add playback controls from the parsed DAC table */ |
| 19844 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19845 | const struct auto_pin_cfg *cfg) |
| 19846 | { |
| 19847 | hda_nid_t nid; |
| 19848 | int err; |
| 19849 | |
| 19850 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19851 | |
| 19852 | nid = cfg->line_out_pins[0]; |
| 19853 | if (nid) { |
| 19854 | const char *name; |
| 19855 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19856 | name = "Speaker"; |
| 19857 | else |
| 19858 | name = "Front"; |
| 19859 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19860 | if (err < 0) |
| 19861 | return err; |
| 19862 | } |
| 19863 | |
| 19864 | nid = cfg->speaker_pins[0]; |
| 19865 | if (nid) { |
| 19866 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19867 | if (err < 0) |
| 19868 | return err; |
| 19869 | } |
| 19870 | nid = cfg->hp_pins[0]; |
| 19871 | if (nid) { |
| 19872 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19873 | if (err < 0) |
| 19874 | return err; |
| 19875 | } |
| 19876 | |
| 19877 | return 0; |
| 19878 | } |
| 19879 | |
| 19880 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19881 | hda_nid_t nid, int pin_type) |
| 19882 | { |
| 19883 | alc_set_pin_output(codec, nid, pin_type); |
| 19884 | } |
| 19885 | |
| 19886 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19887 | { |
| 19888 | struct alc_spec *spec = codec->spec; |
| 19889 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19890 | if (nid) { |
| 19891 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19892 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19893 | } |
| 19894 | } |
| 19895 | |
| 19896 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19897 | { |
| 19898 | struct alc_spec *spec = codec->spec; |
| 19899 | hda_nid_t pin; |
| 19900 | |
| 19901 | pin = spec->autocfg.hp_pins[0]; |
| 19902 | if (pin) |
| 19903 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19904 | pin = spec->autocfg.speaker_pins[0]; |
| 19905 | if (pin) |
| 19906 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19907 | } |
| 19908 | |
| 19909 | /* pcm configuration: identical with ALC880 */ |
| 19910 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19911 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19912 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19913 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19914 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19915 | |
| 19916 | /* |
| 19917 | * BIOS auto configuration |
| 19918 | */ |
| 19919 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19920 | { |
| 19921 | struct alc_spec *spec = codec->spec; |
| 19922 | int err; |
| 19923 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19924 | |
| 19925 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19926 | alc680_ignore); |
| 19927 | if (err < 0) |
| 19928 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19929 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19930 | if (!spec->autocfg.line_outs) { |
| 19931 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19932 | spec->multiout.max_channels = 2; |
| 19933 | spec->no_analog = 1; |
| 19934 | goto dig_only; |
| 19935 | } |
| 19936 | return 0; /* can't find valid BIOS pin config */ |
| 19937 | } |
| 19938 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19939 | if (err < 0) |
| 19940 | return err; |
| 19941 | |
| 19942 | spec->multiout.max_channels = 2; |
| 19943 | |
| 19944 | dig_only: |
| 19945 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19946 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19947 | if (spec->kctls.list) |
| 19948 | add_mixer(spec, spec->kctls.list); |
| 19949 | |
| 19950 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19951 | |
| 19952 | err = alc_auto_add_mic_boost(codec); |
| 19953 | if (err < 0) |
| 19954 | return err; |
| 19955 | |
| 19956 | return 1; |
| 19957 | } |
| 19958 | |
| 19959 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19960 | |
| 19961 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19962 | static void alc680_auto_init(struct hda_codec *codec) |
| 19963 | { |
| 19964 | struct alc_spec *spec = codec->spec; |
| 19965 | alc680_auto_init_multi_out(codec); |
| 19966 | alc680_auto_init_hp_out(codec); |
| 19967 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19968 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19969 | if (spec->unsol_event) |
| 19970 | alc_inithook(codec); |
| 19971 | } |
| 19972 | |
| 19973 | /* |
| 19974 | * configuration and preset |
| 19975 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19976 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19977 | [ALC680_BASE] = "base", |
| 19978 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19979 | }; |
| 19980 | |
| 19981 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19982 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19983 | {} |
| 19984 | }; |
| 19985 | |
| 19986 | static struct alc_config_preset alc680_presets[] = { |
| 19987 | [ALC680_BASE] = { |
| 19988 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19989 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19990 | .init_verbs = { alc680_init_verbs }, |
| 19991 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19992 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19993 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19994 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19995 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19996 | .unsol_event = alc680_unsol_event, |
| 19997 | .setup = alc680_base_setup, |
| 19998 | .init_hook = alc680_inithook, |
| 19999 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20000 | }, |
| 20001 | }; |
| 20002 | |
| 20003 | static int patch_alc680(struct hda_codec *codec) |
| 20004 | { |
| 20005 | struct alc_spec *spec; |
| 20006 | int board_config; |
| 20007 | int err; |
| 20008 | |
| 20009 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 20010 | if (spec == NULL) |
| 20011 | return -ENOMEM; |
| 20012 | |
| 20013 | codec->spec = spec; |
| 20014 | |
| 20015 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 20016 | alc680_models, |
| 20017 | alc680_cfg_tbl); |
| 20018 | |
| 20019 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 20020 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 20021 | codec->chip_name); |
| 20022 | board_config = ALC680_AUTO; |
| 20023 | } |
| 20024 | |
| 20025 | if (board_config == ALC680_AUTO) { |
| 20026 | /* automatic parse from the BIOS config */ |
| 20027 | err = alc680_parse_auto_config(codec); |
| 20028 | if (err < 0) { |
| 20029 | alc_free(codec); |
| 20030 | return err; |
| 20031 | } else if (!err) { |
| 20032 | printk(KERN_INFO |
| 20033 | "hda_codec: Cannot set up configuration " |
| 20034 | "from BIOS. Using base mode...\n"); |
| 20035 | board_config = ALC680_BASE; |
| 20036 | } |
| 20037 | } |
| 20038 | |
| 20039 | if (board_config != ALC680_AUTO) |
| 20040 | setup_preset(codec, &alc680_presets[board_config]); |
| 20041 | |
| 20042 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20043 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20044 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20045 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20046 | |
| 20047 | if (!spec->adc_nids) { |
| 20048 | spec->adc_nids = alc680_adc_nids; |
| 20049 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 20050 | } |
| 20051 | |
| 20052 | if (!spec->cap_mixer) |
| 20053 | set_capture_mixer(codec); |
| 20054 | |
| 20055 | spec->vmaster_nid = 0x02; |
| 20056 | |
| 20057 | codec->patch_ops = alc_patch_ops; |
| 20058 | if (board_config == ALC680_AUTO) |
| 20059 | spec->init_hook = alc680_auto_init; |
| 20060 | |
| 20061 | return 0; |
| 20062 | } |
| 20063 | |
| 20064 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20065 | * patch entries |
| 20066 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20067 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20068 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20069 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20070 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20071 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20072 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20073 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20074 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20075 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20076 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20077 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20078 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20079 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20080 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20081 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20082 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20083 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20084 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20085 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20086 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20087 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20088 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20089 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20090 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20091 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20092 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20093 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20094 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20095 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20096 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20097 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20098 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20099 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20100 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20101 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20102 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20103 | {} /* terminator */ |
| 20104 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20105 | |
| 20106 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20107 | |
| 20108 | MODULE_LICENSE("GPL"); |
| 20109 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20110 | |
| 20111 | static struct hda_codec_preset_list realtek_list = { |
| 20112 | .preset = snd_hda_preset_realtek, |
| 20113 | .owner = THIS_MODULE, |
| 20114 | }; |
| 20115 | |
| 20116 | static int __init patch_realtek_init(void) |
| 20117 | { |
| 20118 | return snd_hda_add_codec_preset(&realtek_list); |
| 20119 | } |
| 20120 | |
| 20121 | static void __exit patch_realtek_exit(void) |
| 20122 | { |
| 20123 | snd_hda_delete_codec_preset(&realtek_list); |
| 20124 | } |
| 20125 | |
| 20126 | module_init(patch_realtek_init) |
| 20127 | module_exit(patch_realtek_exit) |