Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 285 | struct alc_jack { |
| 286 | hda_nid_t nid; |
| 287 | int type; |
| 288 | struct snd_jack *jack; |
| 289 | }; |
| 290 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 291 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 292 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 293 | struct alc_customize_define { |
| 294 | unsigned int sku_cfg; |
| 295 | unsigned char port_connectivity; |
| 296 | unsigned char check_sum; |
| 297 | unsigned char customization; |
| 298 | unsigned char external_amp; |
| 299 | unsigned int enable_pcbeep:1; |
| 300 | unsigned int platform_type:1; |
| 301 | unsigned int swap:1; |
| 302 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 303 | 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] | 304 | }; |
| 305 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 306 | struct alc_fixup; |
| 307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | struct alc_spec { |
| 309 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 310 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 312 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 313 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 315 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 316 | * don't forget NULL |
| 317 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 318 | */ |
| 319 | unsigned int num_init_verbs; |
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_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | struct hda_pcm_stream *stream_analog_playback; |
| 323 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 324 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 325 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 327 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | struct hda_pcm_stream *stream_digital_playback; |
| 329 | struct hda_pcm_stream *stream_digital_capture; |
| 330 | |
| 331 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 332 | struct hda_multi_out multiout; /* playback set-up |
| 333 | * max_channels, dacs must be set |
| 334 | * dig_out_nid and hp_nid are optional |
| 335 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 336 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 337 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 338 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | |
| 340 | /* capture */ |
| 341 | unsigned int num_adc_nids; |
| 342 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 343 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 344 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 346 | /* capture setup for dynamic dual-adc switch */ |
| 347 | unsigned int cur_adc_idx; |
| 348 | hda_nid_t cur_adc; |
| 349 | unsigned int cur_adc_stream_tag; |
| 350 | unsigned int cur_adc_format; |
| 351 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 353 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | const struct hda_input_mux *input_mux; |
| 355 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 356 | struct alc_mic_route ext_mic; |
| 357 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | |
| 359 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 360 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 362 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 363 | int const_channel_count; |
| 364 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | |
| 366 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 367 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 368 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 369 | /* jack detection */ |
| 370 | struct snd_array jacks; |
| 371 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 372 | /* dynamic controls, init_verbs and input_mux */ |
| 373 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 374 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 375 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 376 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 377 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 378 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 379 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 380 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 381 | /* hooks */ |
| 382 | void (*init_hook)(struct hda_codec *codec); |
| 383 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 384 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 385 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 386 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 387 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 388 | /* for pin sensing */ |
| 389 | unsigned int sense_updated: 1; |
| 390 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 391 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 392 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 393 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 394 | /* other flags */ |
| 395 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 396 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 397 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 398 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 399 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 400 | /* for virtual master */ |
| 401 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 402 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 403 | struct hda_loopback_check loopback; |
| 404 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 405 | |
| 406 | /* for PLL fix */ |
| 407 | hda_nid_t pll_nid; |
| 408 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 409 | |
| 410 | /* fix-up list */ |
| 411 | int fixup_id; |
| 412 | const struct alc_fixup *fixup_list; |
| 413 | const char *fixup_name; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 414 | }; |
| 415 | |
| 416 | /* |
| 417 | * configuration template - to be copied to the spec instance |
| 418 | */ |
| 419 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 420 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 421 | * with spec |
| 422 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 423 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 424 | const struct hda_verb *init_verbs[5]; |
| 425 | unsigned int num_dacs; |
| 426 | hda_nid_t *dac_nids; |
| 427 | hda_nid_t dig_out_nid; /* optional */ |
| 428 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 429 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 430 | unsigned int num_adc_nids; |
| 431 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 432 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 433 | hda_nid_t dig_in_nid; |
| 434 | unsigned int num_channel_mode; |
| 435 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 436 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 437 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 438 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 439 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 440 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 441 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 442 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 443 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 444 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 445 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 446 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | }; |
| 448 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | |
| 450 | /* |
| 451 | * input MUX handling |
| 452 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 453 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 454 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | { |
| 456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 457 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 458 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 459 | if (mux_idx >= spec->num_mux_defs) |
| 460 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 461 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 462 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 463 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 467 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | { |
| 469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 470 | struct alc_spec *spec = codec->spec; |
| 471 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 472 | |
| 473 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 474 | return 0; |
| 475 | } |
| 476 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 478 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
| 480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 481 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 482 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 484 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 485 | hda_nid_t nid = spec->capsrc_nids ? |
| 486 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 487 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 489 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 490 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 491 | if (!imux->num_items && mux_idx > 0) |
| 492 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 493 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 494 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 495 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 496 | /* Matrix-mixer style (e.g. ALC882) */ |
| 497 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 498 | unsigned int i, idx; |
| 499 | |
| 500 | idx = ucontrol->value.enumerated.item[0]; |
| 501 | if (idx >= imux->num_items) |
| 502 | idx = imux->num_items - 1; |
| 503 | if (*cur_val == idx) |
| 504 | return 0; |
| 505 | for (i = 0; i < imux->num_items; i++) { |
| 506 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 507 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 508 | imux->items[i].index, |
| 509 | HDA_AMP_MUTE, v); |
| 510 | } |
| 511 | *cur_val = idx; |
| 512 | return 1; |
| 513 | } else { |
| 514 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 515 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 516 | &spec->cur_mux[adc_idx]); |
| 517 | } |
| 518 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 519 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | /* |
| 521 | * channel mode setting |
| 522 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 524 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | { |
| 526 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 527 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 528 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 529 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 530 | } |
| 531 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 532 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 533 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | { |
| 535 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 536 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 537 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 539 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | } |
| 541 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 542 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 543 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | { |
| 545 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 546 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 547 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 548 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 549 | &spec->ext_channel_count); |
| 550 | if (err >= 0 && !spec->const_channel_count) { |
| 551 | spec->multiout.max_channels = spec->ext_channel_count; |
| 552 | if (spec->need_dac_fix) |
| 553 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 554 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 555 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | } |
| 557 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | * 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] | 560 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | * being part of a format specifier. Maximum allowed length of a value is |
| 562 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 563 | * |
| 564 | * Note: some retasking pin complexes seem to ignore requests for input |
| 565 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 566 | * are requested. Therefore order this list so that this behaviour will not |
| 567 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 568 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 569 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 570 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 571 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 572 | "Mic 50pc bias", "Mic 80pc bias", |
| 573 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 574 | }; |
| 575 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 576 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | }; |
| 578 | /* 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] | 579 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 580 | * addition, "input" pins may or may not process the mic bias option |
| 581 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 582 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 583 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 584 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 585 | #define ALC_PIN_DIR_IN 0x00 |
| 586 | #define ALC_PIN_DIR_OUT 0x01 |
| 587 | #define ALC_PIN_DIR_INOUT 0x02 |
| 588 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 589 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 590 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 591 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | * For each direction the minimum and maximum values are given. |
| 593 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 594 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 595 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 596 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 597 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 598 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 599 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 600 | }; |
| 601 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 602 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 603 | #define alc_pin_mode_n_items(_dir) \ |
| 604 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 605 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 606 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 607 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 608 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | unsigned int item_num = uinfo->value.enumerated.item; |
| 610 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 611 | |
| 612 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 613 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 614 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 615 | |
| 616 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 617 | item_num = alc_pin_mode_min(dir); |
| 618 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 619 | return 0; |
| 620 | } |
| 621 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 623 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 624 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 625 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 626 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 627 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 628 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 629 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 630 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 631 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 632 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 633 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 634 | /* Find enumerated value for current pinctl setting */ |
| 635 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 636 | 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] | 637 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 638 | *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] | 639 | return 0; |
| 640 | } |
| 641 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 643 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 644 | { |
| 645 | signed int change; |
| 646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 647 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 648 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 649 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 650 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 651 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 652 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 653 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 654 | 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] | 655 | val = alc_pin_mode_min(dir); |
| 656 | |
| 657 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 658 | if (change) { |
| 659 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 660 | snd_hda_codec_write_cache(codec, nid, 0, |
| 661 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 662 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 663 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 664 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 665 | * for the requested pin mode. Enum values of 2 or less are |
| 666 | * input modes. |
| 667 | * |
| 668 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 669 | * reduces noise slightly (particularly on input) so we'll |
| 670 | * do it. However, having both input and output buffers |
| 671 | * enabled simultaneously doesn't seem to be problematic if |
| 672 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 673 | */ |
| 674 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 675 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 676 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 677 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 678 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 679 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 680 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 681 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 682 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 683 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 684 | } |
| 685 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 686 | return change; |
| 687 | } |
| 688 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 689 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 690 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 691 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 692 | .info = alc_pin_mode_info, \ |
| 693 | .get = alc_pin_mode_get, \ |
| 694 | .put = alc_pin_mode_put, \ |
| 695 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 696 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 697 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 698 | * together using a mask with more than one bit set. This control is |
| 699 | * currently used only by the ALC260 test model. At this stage they are not |
| 700 | * needed for any "production" models. |
| 701 | */ |
| 702 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 703 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 704 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 706 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 707 | { |
| 708 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 709 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 710 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 711 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 712 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 713 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 714 | |
| 715 | *valp = (val & mask) != 0; |
| 716 | return 0; |
| 717 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 718 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 719 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 720 | { |
| 721 | signed int change; |
| 722 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 723 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 724 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 725 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 726 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 727 | AC_VERB_GET_GPIO_DATA, |
| 728 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 729 | |
| 730 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 731 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 732 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 733 | gpio_data &= ~mask; |
| 734 | else |
| 735 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 736 | snd_hda_codec_write_cache(codec, nid, 0, |
| 737 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 738 | |
| 739 | return change; |
| 740 | } |
| 741 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 742 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 743 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 744 | .info = alc_gpio_data_info, \ |
| 745 | .get = alc_gpio_data_get, \ |
| 746 | .put = alc_gpio_data_put, \ |
| 747 | .private_value = nid | (mask<<16) } |
| 748 | #endif /* CONFIG_SND_DEBUG */ |
| 749 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 750 | /* A switch control to allow the enabling of the digital IO pins on the |
| 751 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 752 | * to provide something in the test model allowing digital outputs to be |
| 753 | * identified if present. If models are found which can utilise these |
| 754 | * outputs a more complete mixer control can be devised for those models if |
| 755 | * necessary. |
| 756 | */ |
| 757 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 758 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 759 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 760 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 761 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 762 | { |
| 763 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 764 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 765 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 766 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 767 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 768 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 769 | |
| 770 | *valp = (val & mask) != 0; |
| 771 | return 0; |
| 772 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 773 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 774 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 775 | { |
| 776 | signed int change; |
| 777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 778 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 779 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 780 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 781 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 782 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 783 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 784 | |
| 785 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 786 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 787 | if (val==0) |
| 788 | ctrl_data &= ~mask; |
| 789 | else |
| 790 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 791 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 792 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 793 | |
| 794 | return change; |
| 795 | } |
| 796 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 797 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 798 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 799 | .info = alc_spdif_ctrl_info, \ |
| 800 | .get = alc_spdif_ctrl_get, \ |
| 801 | .put = alc_spdif_ctrl_put, \ |
| 802 | .private_value = nid | (mask<<16) } |
| 803 | #endif /* CONFIG_SND_DEBUG */ |
| 804 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 805 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 806 | * Again, this is only used in the ALC26x test models to help identify when |
| 807 | * the EAPD line must be asserted for features to work. |
| 808 | */ |
| 809 | #ifdef CONFIG_SND_DEBUG |
| 810 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 811 | |
| 812 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 813 | struct snd_ctl_elem_value *ucontrol) |
| 814 | { |
| 815 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 816 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 817 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 818 | long *valp = ucontrol->value.integer.value; |
| 819 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 820 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 821 | |
| 822 | *valp = (val & mask) != 0; |
| 823 | return 0; |
| 824 | } |
| 825 | |
| 826 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 827 | struct snd_ctl_elem_value *ucontrol) |
| 828 | { |
| 829 | int change; |
| 830 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 831 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 832 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 833 | long val = *ucontrol->value.integer.value; |
| 834 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 835 | AC_VERB_GET_EAPD_BTLENABLE, |
| 836 | 0x00); |
| 837 | |
| 838 | /* Set/unset the masked control bit(s) as needed */ |
| 839 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 840 | if (!val) |
| 841 | ctrl_data &= ~mask; |
| 842 | else |
| 843 | ctrl_data |= mask; |
| 844 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 845 | ctrl_data); |
| 846 | |
| 847 | return change; |
| 848 | } |
| 849 | |
| 850 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 851 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 852 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 853 | .info = alc_eapd_ctrl_info, \ |
| 854 | .get = alc_eapd_ctrl_get, \ |
| 855 | .put = alc_eapd_ctrl_put, \ |
| 856 | .private_value = nid | (mask<<16) } |
| 857 | #endif /* CONFIG_SND_DEBUG */ |
| 858 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 860 | * set up the input pin config (depending on the given auto-pin type) |
| 861 | */ |
| 862 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 863 | int auto_pin_type) |
| 864 | { |
| 865 | unsigned int val = PIN_IN; |
| 866 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 867 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 868 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 869 | unsigned int oldval; |
| 870 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 871 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 872 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 873 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 874 | /* if the default pin setup is vref50, we give it priority */ |
| 875 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 876 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 877 | else if (pincap & AC_PINCAP_VREF_50) |
| 878 | val = PIN_VREF50; |
| 879 | else if (pincap & AC_PINCAP_VREF_100) |
| 880 | val = PIN_VREF100; |
| 881 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 882 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 883 | } |
| 884 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 885 | } |
| 886 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 887 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 888 | { |
| 889 | struct alc_spec *spec = codec->spec; |
| 890 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 891 | |
| 892 | if (!cfg->line_outs) { |
| 893 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 894 | cfg->line_out_pins[cfg->line_outs]) |
| 895 | cfg->line_outs++; |
| 896 | } |
| 897 | if (!cfg->speaker_outs) { |
| 898 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 899 | cfg->speaker_pins[cfg->speaker_outs]) |
| 900 | cfg->speaker_outs++; |
| 901 | } |
| 902 | if (!cfg->hp_outs) { |
| 903 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 904 | cfg->hp_pins[cfg->hp_outs]) |
| 905 | cfg->hp_outs++; |
| 906 | } |
| 907 | } |
| 908 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 909 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 910 | */ |
| 911 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 912 | { |
| 913 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 914 | return; |
| 915 | spec->mixers[spec->num_mixers++] = mix; |
| 916 | } |
| 917 | |
| 918 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 919 | { |
| 920 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 921 | return; |
| 922 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 923 | } |
| 924 | |
| 925 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 926 | * set up from the preset table |
| 927 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 928 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 929 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 930 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 931 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 932 | int i; |
| 933 | |
| 934 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 935 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 936 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 937 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 938 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 939 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 940 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 941 | spec->channel_mode = preset->channel_mode; |
| 942 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 943 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 944 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 945 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 946 | if (preset->const_channel_count) |
| 947 | spec->multiout.max_channels = preset->const_channel_count; |
| 948 | else |
| 949 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 950 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 951 | |
| 952 | spec->multiout.num_dacs = preset->num_dacs; |
| 953 | spec->multiout.dac_nids = preset->dac_nids; |
| 954 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 955 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 956 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 957 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 958 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 959 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 960 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 961 | spec->input_mux = preset->input_mux; |
| 962 | |
| 963 | spec->num_adc_nids = preset->num_adc_nids; |
| 964 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 965 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 966 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 967 | |
| 968 | spec->unsol_event = preset->unsol_event; |
| 969 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 970 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 971 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 972 | spec->loopback.amplist = preset->loopbacks; |
| 973 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 974 | |
| 975 | if (preset->setup) |
| 976 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 977 | |
| 978 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 979 | } |
| 980 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 981 | /* Enable GPIO mask and set output */ |
| 982 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 983 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 984 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 985 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 986 | { } |
| 987 | }; |
| 988 | |
| 989 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 990 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 991 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 992 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 993 | { } |
| 994 | }; |
| 995 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 996 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 997 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 998 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 999 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 1000 | { } |
| 1001 | }; |
| 1002 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 1003 | /* |
| 1004 | * Fix hardware PLL issue |
| 1005 | * On some codecs, the analog PLL gating control must be off while |
| 1006 | * the default value is 1. |
| 1007 | */ |
| 1008 | static void alc_fix_pll(struct hda_codec *codec) |
| 1009 | { |
| 1010 | struct alc_spec *spec = codec->spec; |
| 1011 | unsigned int val; |
| 1012 | |
| 1013 | if (!spec->pll_nid) |
| 1014 | return; |
| 1015 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1016 | spec->pll_coef_idx); |
| 1017 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1018 | AC_VERB_GET_PROC_COEF, 0); |
| 1019 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1020 | spec->pll_coef_idx); |
| 1021 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1022 | val & ~(1 << spec->pll_coef_bit)); |
| 1023 | } |
| 1024 | |
| 1025 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1026 | unsigned int coef_idx, unsigned int coef_bit) |
| 1027 | { |
| 1028 | struct alc_spec *spec = codec->spec; |
| 1029 | spec->pll_nid = nid; |
| 1030 | spec->pll_coef_idx = coef_idx; |
| 1031 | spec->pll_coef_bit = coef_bit; |
| 1032 | alc_fix_pll(codec); |
| 1033 | } |
| 1034 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1035 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
| 1036 | static void alc_free_jack_priv(struct snd_jack *jack) |
| 1037 | { |
| 1038 | struct alc_jack *jacks = jack->private_data; |
| 1039 | jacks->nid = 0; |
| 1040 | jacks->jack = NULL; |
| 1041 | } |
| 1042 | |
| 1043 | static int alc_add_jack(struct hda_codec *codec, |
| 1044 | hda_nid_t nid, int type) |
| 1045 | { |
| 1046 | struct alc_spec *spec; |
| 1047 | struct alc_jack *jack; |
| 1048 | const char *name; |
| 1049 | int err; |
| 1050 | |
| 1051 | spec = codec->spec; |
| 1052 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 1053 | jack = snd_array_new(&spec->jacks); |
| 1054 | if (!jack) |
| 1055 | return -ENOMEM; |
| 1056 | |
| 1057 | jack->nid = nid; |
| 1058 | jack->type = type; |
| 1059 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
| 1060 | |
| 1061 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 1062 | if (err < 0) |
| 1063 | return err; |
| 1064 | jack->jack->private_data = jack; |
| 1065 | jack->jack->private_free = alc_free_jack_priv; |
| 1066 | return 0; |
| 1067 | } |
| 1068 | |
| 1069 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1070 | { |
| 1071 | struct alc_spec *spec = codec->spec; |
| 1072 | struct alc_jack *jacks = spec->jacks.list; |
| 1073 | |
| 1074 | if (jacks) { |
| 1075 | int i; |
| 1076 | for (i = 0; i < spec->jacks.used; i++) { |
| 1077 | if (jacks->nid == nid) { |
| 1078 | unsigned int present; |
| 1079 | present = snd_hda_jack_detect(codec, nid); |
| 1080 | |
| 1081 | present = (present) ? jacks->type : 0; |
| 1082 | |
| 1083 | snd_jack_report(jacks->jack, present); |
| 1084 | } |
| 1085 | jacks++; |
| 1086 | } |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | static int alc_init_jacks(struct hda_codec *codec) |
| 1091 | { |
| 1092 | struct alc_spec *spec = codec->spec; |
| 1093 | int err; |
| 1094 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1095 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1096 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1097 | if (hp_nid) { |
| 1098 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); |
| 1099 | if (err < 0) |
| 1100 | return err; |
| 1101 | alc_report_jack(codec, hp_nid); |
| 1102 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1103 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1104 | if (mic_nid) { |
| 1105 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); |
| 1106 | if (err < 0) |
| 1107 | return err; |
| 1108 | alc_report_jack(codec, mic_nid); |
| 1109 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1110 | |
| 1111 | return 0; |
| 1112 | } |
| 1113 | #else |
| 1114 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 1115 | { |
| 1116 | } |
| 1117 | |
| 1118 | static inline int alc_init_jacks(struct hda_codec *codec) |
| 1119 | { |
| 1120 | return 0; |
| 1121 | } |
| 1122 | #endif |
| 1123 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1124 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1125 | { |
| 1126 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1127 | unsigned int mute; |
| 1128 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1129 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1131 | spec->jack_present = 0; |
| 1132 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1133 | nid = spec->autocfg.hp_pins[i]; |
| 1134 | if (!nid) |
| 1135 | break; |
| 1136 | if (snd_hda_jack_detect(codec, nid)) { |
| 1137 | spec->jack_present = 1; |
| 1138 | break; |
| 1139 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1140 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1141 | } |
| 1142 | |
| 1143 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1144 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1145 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1146 | nid = spec->autocfg.speaker_pins[i]; |
| 1147 | if (!nid) |
| 1148 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1149 | if (pinctl) { |
| 1150 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1151 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1152 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1153 | } else { |
| 1154 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1155 | HDA_AMP_MUTE, mute); |
| 1156 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1157 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1158 | } |
| 1159 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1160 | static void alc_automute_pin(struct hda_codec *codec) |
| 1161 | { |
| 1162 | alc_automute_speaker(codec, 1); |
| 1163 | } |
| 1164 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1165 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1166 | hda_nid_t nid) |
| 1167 | { |
| 1168 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1169 | int i, nums; |
| 1170 | |
| 1171 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1172 | for (i = 0; i < nums; i++) |
| 1173 | if (conn[i] == nid) |
| 1174 | return i; |
| 1175 | return -1; |
| 1176 | } |
| 1177 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1178 | /* switch the current ADC according to the jack state */ |
| 1179 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1180 | { |
| 1181 | struct alc_spec *spec = codec->spec; |
| 1182 | unsigned int present; |
| 1183 | hda_nid_t new_adc; |
| 1184 | |
| 1185 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1186 | if (present) |
| 1187 | spec->cur_adc_idx = 1; |
| 1188 | else |
| 1189 | spec->cur_adc_idx = 0; |
| 1190 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1191 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1192 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1193 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1194 | spec->cur_adc = new_adc; |
| 1195 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1196 | spec->cur_adc_stream_tag, 0, |
| 1197 | spec->cur_adc_format); |
| 1198 | } |
| 1199 | } |
| 1200 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1201 | static void alc_mic_automute(struct hda_codec *codec) |
| 1202 | { |
| 1203 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1204 | struct alc_mic_route *dead, *alive; |
| 1205 | unsigned int present, type; |
| 1206 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1207 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1208 | if (!spec->auto_mic) |
| 1209 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1210 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1211 | return; |
| 1212 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1213 | return; |
| 1214 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1215 | if (spec->dual_adc_switch) { |
| 1216 | alc_dual_mic_adc_auto_switch(codec); |
| 1217 | return; |
| 1218 | } |
| 1219 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1220 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1221 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1222 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1223 | if (present) { |
| 1224 | alive = &spec->ext_mic; |
| 1225 | dead = &spec->int_mic; |
| 1226 | } else { |
| 1227 | alive = &spec->int_mic; |
| 1228 | dead = &spec->ext_mic; |
| 1229 | } |
| 1230 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1231 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1232 | if (type == AC_WID_AUD_MIX) { |
| 1233 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1234 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1235 | alive->mux_idx, |
| 1236 | HDA_AMP_MUTE, 0); |
| 1237 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1238 | dead->mux_idx, |
| 1239 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1240 | } else { |
| 1241 | /* MUX style (e.g. ALC880) */ |
| 1242 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1243 | AC_VERB_SET_CONNECT_SEL, |
| 1244 | alive->mux_idx); |
| 1245 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1246 | alc_report_jack(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1247 | |
| 1248 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1249 | } |
| 1250 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1251 | /* unsolicited event for HP jack sensing */ |
| 1252 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1253 | { |
| 1254 | if (codec->vendor_id == 0x10ec0880) |
| 1255 | res >>= 28; |
| 1256 | else |
| 1257 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1258 | switch (res) { |
| 1259 | case ALC880_HP_EVENT: |
| 1260 | alc_automute_pin(codec); |
| 1261 | break; |
| 1262 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1263 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1264 | break; |
| 1265 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1266 | } |
| 1267 | |
| 1268 | static void alc_inithook(struct hda_codec *codec) |
| 1269 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1270 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1271 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1272 | } |
| 1273 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1274 | /* additional initialization for ALC888 variants */ |
| 1275 | static void alc888_coef_init(struct hda_codec *codec) |
| 1276 | { |
| 1277 | unsigned int tmp; |
| 1278 | |
| 1279 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1280 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1281 | 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] | 1282 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1283 | /* alc888S-VC */ |
| 1284 | snd_hda_codec_read(codec, 0x20, 0, |
| 1285 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1286 | else |
| 1287 | /* alc888-VB */ |
| 1288 | snd_hda_codec_read(codec, 0x20, 0, |
| 1289 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1290 | } |
| 1291 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1292 | static void alc889_coef_init(struct hda_codec *codec) |
| 1293 | { |
| 1294 | unsigned int tmp; |
| 1295 | |
| 1296 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1297 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1298 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1299 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1300 | } |
| 1301 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1302 | /* turn on/off EAPD control (only if available) */ |
| 1303 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1304 | { |
| 1305 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1306 | return; |
| 1307 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1308 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1309 | on ? 2 : 0); |
| 1310 | } |
| 1311 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1312 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1313 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1314 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1315 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1316 | switch (type) { |
| 1317 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1318 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1319 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1320 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1321 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1322 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1323 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1324 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1325 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1326 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1327 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1328 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1329 | set_eapd(codec, 0x0f, 1); |
| 1330 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1331 | break; |
| 1332 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1333 | case 0x10ec0267: |
| 1334 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1335 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1336 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1337 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1338 | case 0x10ec0660: |
| 1339 | case 0x10ec0662: |
| 1340 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1341 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1342 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1343 | set_eapd(codec, 0x14, 1); |
| 1344 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1345 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1346 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1347 | switch (codec->vendor_id) { |
| 1348 | case 0x10ec0260: |
| 1349 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1350 | AC_VERB_SET_COEF_INDEX, 7); |
| 1351 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1352 | AC_VERB_GET_PROC_COEF, 0); |
| 1353 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1354 | AC_VERB_SET_COEF_INDEX, 7); |
| 1355 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1356 | AC_VERB_SET_PROC_COEF, |
| 1357 | tmp | 0x2010); |
| 1358 | break; |
| 1359 | case 0x10ec0262: |
| 1360 | case 0x10ec0880: |
| 1361 | case 0x10ec0882: |
| 1362 | case 0x10ec0883: |
| 1363 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1364 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1365 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1366 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1367 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1368 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1369 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1370 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1371 | #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] | 1372 | case 0x10ec0267: |
| 1373 | case 0x10ec0268: |
| 1374 | snd_hda_codec_write(codec, 0x20, 0, |
| 1375 | AC_VERB_SET_COEF_INDEX, 7); |
| 1376 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1377 | AC_VERB_GET_PROC_COEF, 0); |
| 1378 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1379 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1380 | snd_hda_codec_write(codec, 0x20, 0, |
| 1381 | AC_VERB_SET_PROC_COEF, |
| 1382 | tmp | 0x3000); |
| 1383 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1384 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1385 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1386 | break; |
| 1387 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1388 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1389 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1390 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1391 | { |
| 1392 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1393 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1394 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1395 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1396 | if (!cfg->hp_pins[0]) { |
| 1397 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1398 | return; |
| 1399 | } |
| 1400 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1401 | if (!cfg->speaker_pins[0]) { |
| 1402 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1403 | return; |
| 1404 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1405 | sizeof(cfg->speaker_pins)); |
| 1406 | cfg->speaker_outs = cfg->line_outs; |
| 1407 | } |
| 1408 | |
| 1409 | if (!cfg->hp_pins[0]) { |
| 1410 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1411 | sizeof(cfg->hp_pins)); |
| 1412 | cfg->hp_outs = cfg->line_outs; |
| 1413 | } |
| 1414 | |
| 1415 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1416 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1417 | cfg->hp_pins[i]); |
| 1418 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1419 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1420 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1421 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1422 | spec->unsol_event = alc_sku_unsol_event; |
| 1423 | } |
| 1424 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1425 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1426 | { |
| 1427 | struct alc_spec *spec = codec->spec; |
| 1428 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1429 | hda_nid_t fixed, ext; |
| 1430 | int i; |
| 1431 | |
| 1432 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1433 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1434 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1435 | return; |
| 1436 | |
| 1437 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1438 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1439 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1440 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1441 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1442 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1443 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1444 | if (fixed) |
| 1445 | return; /* already occupied */ |
| 1446 | fixed = nid; |
| 1447 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1448 | case INPUT_PIN_ATTR_UNUSED: |
| 1449 | return; /* invalid entry */ |
| 1450 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1451 | if (ext) |
| 1452 | return; /* already occupied */ |
| 1453 | ext = nid; |
| 1454 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1455 | } |
| 1456 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1457 | if (!ext || !fixed) |
| 1458 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1459 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1460 | return; /* no unsol support */ |
| 1461 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1462 | ext, fixed); |
| 1463 | spec->ext_mic.pin = ext; |
| 1464 | spec->int_mic.pin = fixed; |
| 1465 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1466 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1467 | spec->auto_mic = 1; |
| 1468 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1469 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1470 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1471 | spec->unsol_event = alc_sku_unsol_event; |
| 1472 | } |
| 1473 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1474 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1475 | * the driver to ignore any present sku defines. |
| 1476 | */ |
| 1477 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1478 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1479 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1480 | { |
| 1481 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1482 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1483 | struct alc_spec *spec = codec->spec; |
| 1484 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1485 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1486 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1487 | if (spec->cdefine.fixup) { |
| 1488 | ass = spec->cdefine.sku_cfg; |
| 1489 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1490 | return -1; |
| 1491 | goto do_sku; |
| 1492 | } |
| 1493 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1494 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1495 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1496 | goto do_sku; |
| 1497 | |
| 1498 | nid = 0x1d; |
| 1499 | if (codec->vendor_id == 0x10ec0260) |
| 1500 | nid = 0x17; |
| 1501 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1502 | |
| 1503 | if (!(ass & 1)) { |
| 1504 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1505 | codec->chip_name, ass); |
| 1506 | return -1; |
| 1507 | } |
| 1508 | |
| 1509 | /* check sum */ |
| 1510 | tmp = 0; |
| 1511 | for (i = 1; i < 16; i++) { |
| 1512 | if ((ass >> i) & 1) |
| 1513 | tmp++; |
| 1514 | } |
| 1515 | if (((ass >> 16) & 0xf) != tmp) |
| 1516 | return -1; |
| 1517 | |
| 1518 | spec->cdefine.port_connectivity = ass >> 30; |
| 1519 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1520 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1521 | spec->cdefine.customization = ass >> 8; |
| 1522 | do_sku: |
| 1523 | spec->cdefine.sku_cfg = ass; |
| 1524 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1525 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1526 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1527 | spec->cdefine.override = ass & 0x1; |
| 1528 | |
| 1529 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1530 | nid, spec->cdefine.sku_cfg); |
| 1531 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1532 | spec->cdefine.port_connectivity); |
| 1533 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1534 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1535 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1536 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1537 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1538 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1539 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1540 | |
| 1541 | return 0; |
| 1542 | } |
| 1543 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1544 | /* check subsystem ID and set up device-specific initialization; |
| 1545 | * return 1 if initialized, 0 if invalid SSID |
| 1546 | */ |
| 1547 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1548 | * 31 ~ 16 : Manufacture ID |
| 1549 | * 15 ~ 8 : SKU ID |
| 1550 | * 7 ~ 0 : Assembly ID |
| 1551 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1552 | */ |
| 1553 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1554 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1555 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1556 | { |
| 1557 | unsigned int ass, tmp, i; |
| 1558 | unsigned nid; |
| 1559 | struct alc_spec *spec = codec->spec; |
| 1560 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1561 | if (spec->cdefine.fixup) { |
| 1562 | ass = spec->cdefine.sku_cfg; |
| 1563 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1564 | return 0; |
| 1565 | goto do_sku; |
| 1566 | } |
| 1567 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1568 | ass = codec->subsystem_id & 0xffff; |
| 1569 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1570 | goto do_sku; |
| 1571 | |
| 1572 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1573 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1574 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1575 | * 29~21 : reserve |
| 1576 | * 20 : PCBEEP input |
| 1577 | * 19~16 : Check sum (15:1) |
| 1578 | * 15~1 : Custom |
| 1579 | * 0 : override |
| 1580 | */ |
| 1581 | nid = 0x1d; |
| 1582 | if (codec->vendor_id == 0x10ec0260) |
| 1583 | nid = 0x17; |
| 1584 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1585 | snd_printd("realtek: No valid SSID, " |
| 1586 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1587 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1588 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1589 | return 0; |
| 1590 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1591 | return 0; |
| 1592 | |
| 1593 | /* check sum */ |
| 1594 | tmp = 0; |
| 1595 | for (i = 1; i < 16; i++) { |
| 1596 | if ((ass >> i) & 1) |
| 1597 | tmp++; |
| 1598 | } |
| 1599 | if (((ass >> 16) & 0xf) != tmp) |
| 1600 | return 0; |
| 1601 | do_sku: |
| 1602 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1603 | ass & 0xffff, codec->vendor_id); |
| 1604 | /* |
| 1605 | * 0 : override |
| 1606 | * 1 : Swap Jack |
| 1607 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1608 | * 3~5 : External Amplifier control |
| 1609 | * 7~6 : Reserved |
| 1610 | */ |
| 1611 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1612 | switch (tmp) { |
| 1613 | case 1: |
| 1614 | spec->init_amp = ALC_INIT_GPIO1; |
| 1615 | break; |
| 1616 | case 3: |
| 1617 | spec->init_amp = ALC_INIT_GPIO2; |
| 1618 | break; |
| 1619 | case 7: |
| 1620 | spec->init_amp = ALC_INIT_GPIO3; |
| 1621 | break; |
| 1622 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1623 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1624 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1625 | break; |
| 1626 | } |
| 1627 | |
| 1628 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1629 | * when the external headphone out jack is plugged" |
| 1630 | */ |
| 1631 | if (!(ass & 0x8000)) |
| 1632 | return 1; |
| 1633 | /* |
| 1634 | * 10~8 : Jack location |
| 1635 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1636 | * 14~13: Resvered |
| 1637 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1638 | * when the external headphone out jack is plugged" |
| 1639 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1640 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1641 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1642 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1643 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1644 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1645 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1646 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1647 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1648 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1649 | else if (tmp == 3) |
| 1650 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1651 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1652 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1653 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1654 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1655 | return 1; |
| 1656 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1657 | } |
| 1658 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1659 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1660 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1661 | return 1; |
| 1662 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1663 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1664 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1665 | hda_nid_t porta, hda_nid_t porte, |
| 1666 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1667 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1668 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1669 | struct alc_spec *spec = codec->spec; |
| 1670 | snd_printd("realtek: " |
| 1671 | "Enable default setup for auto mode as fallback\n"); |
| 1672 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1673 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1674 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1675 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1676 | } |
| 1677 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1678 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1679 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1680 | */ |
| 1681 | |
| 1682 | struct alc_pincfg { |
| 1683 | hda_nid_t nid; |
| 1684 | u32 val; |
| 1685 | }; |
| 1686 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1687 | struct alc_model_fixup { |
| 1688 | const int id; |
| 1689 | const char *name; |
| 1690 | }; |
| 1691 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1692 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1693 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1694 | bool chained; |
| 1695 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1696 | union { |
| 1697 | unsigned int sku; |
| 1698 | const struct alc_pincfg *pins; |
| 1699 | const struct hda_verb *verbs; |
| 1700 | void (*func)(struct hda_codec *codec, |
| 1701 | const struct alc_fixup *fix, |
| 1702 | int action); |
| 1703 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1704 | }; |
| 1705 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1706 | enum { |
| 1707 | ALC_FIXUP_INVALID, |
| 1708 | ALC_FIXUP_SKU, |
| 1709 | ALC_FIXUP_PINS, |
| 1710 | ALC_FIXUP_VERBS, |
| 1711 | ALC_FIXUP_FUNC, |
| 1712 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1713 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1714 | enum { |
| 1715 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1716 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1717 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1718 | }; |
| 1719 | |
| 1720 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1721 | { |
| 1722 | struct alc_spec *spec = codec->spec; |
| 1723 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1724 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1725 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1726 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1727 | int depth = 0; |
| 1728 | |
| 1729 | if (!spec->fixup_list) |
| 1730 | return; |
| 1731 | |
| 1732 | while (id >= 0) { |
| 1733 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1734 | const struct alc_pincfg *cfg; |
| 1735 | |
| 1736 | switch (fix->type) { |
| 1737 | case ALC_FIXUP_SKU: |
| 1738 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1739 | break;; |
| 1740 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1741 | "Apply sku override for %s\n", |
| 1742 | codec->chip_name, modelname); |
| 1743 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1744 | spec->cdefine.fixup = 1; |
| 1745 | break; |
| 1746 | case ALC_FIXUP_PINS: |
| 1747 | cfg = fix->v.pins; |
| 1748 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1749 | break; |
| 1750 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1751 | "Apply pincfg for %s\n", |
| 1752 | codec->chip_name, modelname); |
| 1753 | for (; cfg->nid; cfg++) |
| 1754 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1755 | cfg->val); |
| 1756 | break; |
| 1757 | case ALC_FIXUP_VERBS: |
| 1758 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1759 | break; |
| 1760 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1761 | "Apply fix-verbs for %s\n", |
| 1762 | codec->chip_name, modelname); |
| 1763 | add_verb(codec->spec, fix->v.verbs); |
| 1764 | break; |
| 1765 | case ALC_FIXUP_FUNC: |
| 1766 | if (!fix->v.func) |
| 1767 | break; |
| 1768 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1769 | "Apply fix-func for %s\n", |
| 1770 | codec->chip_name, modelname); |
| 1771 | fix->v.func(codec, fix, action); |
| 1772 | break; |
| 1773 | default: |
| 1774 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1775 | "Invalid fixup type %d\n", |
| 1776 | codec->chip_name, fix->type); |
| 1777 | break; |
| 1778 | } |
| 1779 | if (!fix[id].chained) |
| 1780 | break; |
| 1781 | if (++depth > 10) |
| 1782 | break; |
| 1783 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1784 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1785 | } |
| 1786 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1787 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1788 | const struct alc_model_fixup *models, |
| 1789 | const struct snd_pci_quirk *quirk, |
| 1790 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1791 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1792 | struct alc_spec *spec = codec->spec; |
| 1793 | int id = -1; |
| 1794 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1795 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1796 | if (codec->modelname && models) { |
| 1797 | while (models->name) { |
| 1798 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1799 | id = models->id; |
| 1800 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1801 | break; |
| 1802 | } |
| 1803 | models++; |
| 1804 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1805 | } |
| 1806 | if (id < 0) { |
| 1807 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1808 | if (quirk) { |
| 1809 | id = quirk->value; |
| 1810 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1811 | name = quirk->name; |
| 1812 | #endif |
| 1813 | } |
| 1814 | } |
| 1815 | |
| 1816 | spec->fixup_id = id; |
| 1817 | if (id >= 0) { |
| 1818 | spec->fixup_list = fixlist; |
| 1819 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1820 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1821 | } |
| 1822 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1823 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1824 | unsigned int coef_idx) |
| 1825 | { |
| 1826 | unsigned int val; |
| 1827 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1828 | coef_idx); |
| 1829 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1830 | AC_VERB_GET_PROC_COEF, 0); |
| 1831 | return val; |
| 1832 | } |
| 1833 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1834 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1835 | unsigned int coef_val) |
| 1836 | { |
| 1837 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1838 | coef_idx); |
| 1839 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1840 | coef_val); |
| 1841 | } |
| 1842 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1843 | /* set right pin controls for digital I/O */ |
| 1844 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1845 | { |
| 1846 | struct alc_spec *spec = codec->spec; |
| 1847 | int i; |
| 1848 | hda_nid_t pin; |
| 1849 | |
| 1850 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1851 | pin = spec->autocfg.dig_out_pins[i]; |
| 1852 | if (pin) { |
| 1853 | snd_hda_codec_write(codec, pin, 0, |
| 1854 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1855 | PIN_OUT); |
| 1856 | } |
| 1857 | } |
| 1858 | pin = spec->autocfg.dig_in_pin; |
| 1859 | if (pin) |
| 1860 | snd_hda_codec_write(codec, pin, 0, |
| 1861 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1862 | PIN_IN); |
| 1863 | } |
| 1864 | |
| 1865 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1866 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1867 | { |
| 1868 | struct alc_spec *spec = codec->spec; |
| 1869 | int i, err; |
| 1870 | hda_nid_t dig_nid; |
| 1871 | |
| 1872 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1873 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1874 | err = snd_hda_get_connections(codec, |
| 1875 | spec->autocfg.dig_out_pins[i], |
| 1876 | &dig_nid, 1); |
| 1877 | if (err < 0) |
| 1878 | continue; |
| 1879 | if (!i) { |
| 1880 | spec->multiout.dig_out_nid = dig_nid; |
| 1881 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1882 | } else { |
| 1883 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1884 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1885 | break; |
| 1886 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1887 | } |
| 1888 | } |
| 1889 | |
| 1890 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1891 | dig_nid = codec->start_nid; |
| 1892 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1893 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1894 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1895 | continue; |
| 1896 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1897 | continue; |
| 1898 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1899 | continue; |
| 1900 | err = get_connection_index(codec, dig_nid, |
| 1901 | spec->autocfg.dig_in_pin); |
| 1902 | if (err >= 0) { |
| 1903 | spec->dig_in_nid = dig_nid; |
| 1904 | break; |
| 1905 | } |
| 1906 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1907 | } |
| 1908 | } |
| 1909 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1910 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1911 | * ALC888 |
| 1912 | */ |
| 1913 | |
| 1914 | /* |
| 1915 | * 2ch mode |
| 1916 | */ |
| 1917 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1918 | /* Mic-in jack as mic in */ |
| 1919 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1920 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1921 | /* Line-in jack as Line in */ |
| 1922 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1923 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1924 | /* Line-Out as Front */ |
| 1925 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1926 | { } /* end */ |
| 1927 | }; |
| 1928 | |
| 1929 | /* |
| 1930 | * 4ch mode |
| 1931 | */ |
| 1932 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1933 | /* Mic-in jack as mic in */ |
| 1934 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1935 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1936 | /* Line-in jack as Surround */ |
| 1937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1939 | /* Line-Out as Front */ |
| 1940 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1941 | { } /* end */ |
| 1942 | }; |
| 1943 | |
| 1944 | /* |
| 1945 | * 6ch mode |
| 1946 | */ |
| 1947 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1948 | /* Mic-in jack as CLFE */ |
| 1949 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1950 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1951 | /* Line-in jack as Surround */ |
| 1952 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1953 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1954 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1955 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1956 | { } /* end */ |
| 1957 | }; |
| 1958 | |
| 1959 | /* |
| 1960 | * 8ch mode |
| 1961 | */ |
| 1962 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1963 | /* Mic-in jack as CLFE */ |
| 1964 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1965 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1966 | /* Line-in jack as Surround */ |
| 1967 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1968 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1969 | /* Line-Out as Side */ |
| 1970 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1971 | { } /* end */ |
| 1972 | }; |
| 1973 | |
| 1974 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1975 | { 2, alc888_4ST_ch2_intel_init }, |
| 1976 | { 4, alc888_4ST_ch4_intel_init }, |
| 1977 | { 6, alc888_4ST_ch6_intel_init }, |
| 1978 | { 8, alc888_4ST_ch8_intel_init }, |
| 1979 | }; |
| 1980 | |
| 1981 | /* |
| 1982 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1983 | */ |
| 1984 | |
| 1985 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1986 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1987 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1988 | /* Connect Internal HP to Front */ |
| 1989 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1990 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1991 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1992 | /* Connect Bass HP to Front */ |
| 1993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1994 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1995 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1996 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1997 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1998 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1999 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2000 | /* Connect Mic jack to CLFE */ |
| 2001 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2002 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2003 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2004 | /* Connect Line-in jack to Surround */ |
| 2005 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2006 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2007 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2008 | /* Connect HP out jack to Front */ |
| 2009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2010 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2011 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2012 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2013 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2014 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2015 | {} |
| 2016 | }; |
| 2017 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2018 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2019 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 2020 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2021 | } |
| 2022 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2023 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 2024 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2025 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2026 | if (codec->vendor_id == 0x10ec0880) |
| 2027 | res >>= 28; |
| 2028 | else |
| 2029 | res >>= 26; |
| 2030 | if (res == ALC880_HP_EVENT) |
| 2031 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2032 | } |
| 2033 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2034 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2035 | { |
| 2036 | struct alc_spec *spec = codec->spec; |
| 2037 | |
| 2038 | spec->autocfg.hp_pins[0] = 0x15; |
| 2039 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2040 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2041 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2042 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2043 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2044 | } |
| 2045 | |
| 2046 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2047 | { |
| 2048 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2049 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2050 | } |
| 2051 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2052 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2053 | { |
| 2054 | struct alc_spec *spec = codec->spec; |
| 2055 | |
| 2056 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2057 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2058 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2059 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2060 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2061 | |
| 2062 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2063 | * ALC888 Acer Aspire 4930G model |
| 2064 | */ |
| 2065 | |
| 2066 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2067 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2068 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2069 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2071 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2072 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2073 | /* Connect Internal HP to front */ |
| 2074 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2075 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2076 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2077 | /* Connect HP out to front */ |
| 2078 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2079 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2080 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2081 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2082 | { } |
| 2083 | }; |
| 2084 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2085 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2086 | * ALC888 Acer Aspire 6530G model |
| 2087 | */ |
| 2088 | |
| 2089 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2090 | /* Route to built-in subwoofer as well as speakers */ |
| 2091 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2092 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2093 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2094 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2095 | /* Bias voltage on for external mic port */ |
| 2096 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2097 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2098 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2099 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2101 | /* Enable unsolicited event for HP jack */ |
| 2102 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2103 | /* Enable speaker output */ |
| 2104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2106 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2107 | /* Enable headphone output */ |
| 2108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2111 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2112 | { } |
| 2113 | }; |
| 2114 | |
| 2115 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2116 | *ALC888 Acer Aspire 7730G model |
| 2117 | */ |
| 2118 | |
| 2119 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2120 | /* Bias voltage on for external mic port */ |
| 2121 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2122 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2123 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2124 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2125 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2126 | /* Enable unsolicited event for HP jack */ |
| 2127 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2128 | /* Enable speaker output */ |
| 2129 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2130 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2131 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2132 | /* Enable headphone output */ |
| 2133 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2135 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2136 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2137 | /*Enable internal subwoofer */ |
| 2138 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2139 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2140 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2141 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2142 | { } |
| 2143 | }; |
| 2144 | |
| 2145 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2146 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2147 | */ |
| 2148 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2149 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2150 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2152 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2154 | /* Enable unsolicited event for HP jack */ |
| 2155 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2156 | /* Connect Internal Front to Front */ |
| 2157 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2158 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2159 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2160 | /* Connect Internal Rear to Rear */ |
| 2161 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2162 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2163 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2164 | /* Connect Internal CLFE to CLFE */ |
| 2165 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2166 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2167 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2168 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2170 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2172 | /* Enable all DACs */ |
| 2173 | /* DAC DISABLE/MUTE 1? */ |
| 2174 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2175 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2176 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2177 | /* DAC DISABLE/MUTE 2? */ |
| 2178 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2179 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2180 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2181 | /* DMIC fix |
| 2182 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2183 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2184 | * makes the signal become a difference/sum signal instead of standard |
| 2185 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2186 | * codec replicate the sum signal to both channels, turning it into a |
| 2187 | * normal mono mic. |
| 2188 | */ |
| 2189 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2190 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2191 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2192 | { } |
| 2193 | }; |
| 2194 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2195 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2196 | /* Front mic only available on one ADC */ |
| 2197 | { |
| 2198 | .num_items = 4, |
| 2199 | .items = { |
| 2200 | { "Mic", 0x0 }, |
| 2201 | { "Line", 0x2 }, |
| 2202 | { "CD", 0x4 }, |
| 2203 | { "Front Mic", 0xb }, |
| 2204 | }, |
| 2205 | }, |
| 2206 | { |
| 2207 | .num_items = 3, |
| 2208 | .items = { |
| 2209 | { "Mic", 0x0 }, |
| 2210 | { "Line", 0x2 }, |
| 2211 | { "CD", 0x4 }, |
| 2212 | }, |
| 2213 | } |
| 2214 | }; |
| 2215 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2216 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2217 | /* Interal mic only available on one ADC */ |
| 2218 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2219 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2220 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2221 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2222 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2223 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2224 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2225 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2226 | }, |
| 2227 | }, |
| 2228 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2229 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2230 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2231 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2232 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2233 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2234 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2235 | }, |
| 2236 | } |
| 2237 | }; |
| 2238 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2239 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2240 | /* Digital mic only available on first "ADC" */ |
| 2241 | { |
| 2242 | .num_items = 5, |
| 2243 | .items = { |
| 2244 | { "Mic", 0x0 }, |
| 2245 | { "Line", 0x2 }, |
| 2246 | { "CD", 0x4 }, |
| 2247 | { "Front Mic", 0xb }, |
| 2248 | { "Input Mix", 0xa }, |
| 2249 | }, |
| 2250 | }, |
| 2251 | { |
| 2252 | .num_items = 4, |
| 2253 | .items = { |
| 2254 | { "Mic", 0x0 }, |
| 2255 | { "Line", 0x2 }, |
| 2256 | { "CD", 0x4 }, |
| 2257 | { "Input Mix", 0xa }, |
| 2258 | }, |
| 2259 | }, |
| 2260 | { |
| 2261 | .num_items = 4, |
| 2262 | .items = { |
| 2263 | { "Mic", 0x0 }, |
| 2264 | { "Line", 0x2 }, |
| 2265 | { "CD", 0x4 }, |
| 2266 | { "Input Mix", 0xa }, |
| 2267 | }, |
| 2268 | } |
| 2269 | }; |
| 2270 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2271 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2272 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2273 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2274 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2275 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2276 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2277 | HDA_OUTPUT), |
| 2278 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2279 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2280 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2281 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2282 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2283 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2288 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2290 | { } /* end */ |
| 2291 | }; |
| 2292 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame^] | 2293 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2294 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2295 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2296 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2297 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2298 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0f, 2, 0x0, |
| 2299 | HDA_OUTPUT), |
| 2300 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0f, 2, 2, HDA_INPUT), |
| 2301 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2302 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), |
| 2303 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2304 | HDA_BIND_MUTE("Side Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2305 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2306 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2307 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2308 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2309 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2310 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2311 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2312 | { } /* end */ |
| 2313 | }; |
| 2314 | |
| 2315 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2316 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2317 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2318 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2319 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2320 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2321 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2322 | HDA_OUTPUT), |
| 2323 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2324 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2325 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2326 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2327 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2329 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2331 | { } /* end */ |
| 2332 | }; |
| 2333 | |
| 2334 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2335 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2336 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2337 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2338 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2339 | spec->autocfg.hp_pins[0] = 0x15; |
| 2340 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2341 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2342 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2343 | } |
| 2344 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2345 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2346 | { |
| 2347 | struct alc_spec *spec = codec->spec; |
| 2348 | |
| 2349 | spec->autocfg.hp_pins[0] = 0x15; |
| 2350 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2351 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2352 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2353 | } |
| 2354 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2355 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2356 | { |
| 2357 | struct alc_spec *spec = codec->spec; |
| 2358 | |
| 2359 | spec->autocfg.hp_pins[0] = 0x15; |
| 2360 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2361 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2362 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2363 | } |
| 2364 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2365 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2366 | { |
| 2367 | struct alc_spec *spec = codec->spec; |
| 2368 | |
| 2369 | spec->autocfg.hp_pins[0] = 0x15; |
| 2370 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2371 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2372 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2373 | } |
| 2374 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2375 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2376 | * ALC880 3-stack model |
| 2377 | * |
| 2378 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2379 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2380 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2381 | */ |
| 2382 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2383 | static hda_nid_t alc880_dac_nids[4] = { |
| 2384 | /* front, rear, clfe, rear_surr */ |
| 2385 | 0x02, 0x05, 0x04, 0x03 |
| 2386 | }; |
| 2387 | |
| 2388 | static hda_nid_t alc880_adc_nids[3] = { |
| 2389 | /* ADC0-2 */ |
| 2390 | 0x07, 0x08, 0x09, |
| 2391 | }; |
| 2392 | |
| 2393 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2394 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2395 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2396 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2397 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2398 | /* ADC1-2 */ |
| 2399 | 0x08, 0x09, |
| 2400 | }; |
| 2401 | |
| 2402 | #define ALC880_DIGOUT_NID 0x06 |
| 2403 | #define ALC880_DIGIN_NID 0x0a |
| 2404 | |
| 2405 | static struct hda_input_mux alc880_capture_source = { |
| 2406 | .num_items = 4, |
| 2407 | .items = { |
| 2408 | { "Mic", 0x0 }, |
| 2409 | { "Front Mic", 0x3 }, |
| 2410 | { "Line", 0x2 }, |
| 2411 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2412 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2413 | }; |
| 2414 | |
| 2415 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2416 | /* 2ch mode */ |
| 2417 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2418 | /* set line-in to input, mute it */ |
| 2419 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2420 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2421 | /* set mic-in to input vref 80%, mute it */ |
| 2422 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2423 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2424 | { } /* end */ |
| 2425 | }; |
| 2426 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2427 | /* 6ch mode */ |
| 2428 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2429 | /* set line-in to output, unmute it */ |
| 2430 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2431 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2432 | /* set mic-in to output, unmute it */ |
| 2433 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2434 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2435 | { } /* end */ |
| 2436 | }; |
| 2437 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2438 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2439 | { 2, alc880_threestack_ch2_init }, |
| 2440 | { 6, alc880_threestack_ch6_init }, |
| 2441 | }; |
| 2442 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2443 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2444 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2445 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2446 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2447 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2448 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2449 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2450 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2451 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2452 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2453 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2455 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2458 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2459 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2461 | { |
| 2462 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2463 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2464 | .info = alc_ch_mode_info, |
| 2465 | .get = alc_ch_mode_get, |
| 2466 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2467 | }, |
| 2468 | { } /* end */ |
| 2469 | }; |
| 2470 | |
| 2471 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2472 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2473 | struct snd_ctl_elem_info *uinfo) |
| 2474 | { |
| 2475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2476 | struct alc_spec *spec = codec->spec; |
| 2477 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2478 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2479 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2480 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2481 | HDA_INPUT); |
| 2482 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2483 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2484 | return err; |
| 2485 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2486 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2487 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2488 | unsigned int size, unsigned int __user *tlv) |
| 2489 | { |
| 2490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2491 | struct alc_spec *spec = codec->spec; |
| 2492 | int err; |
| 2493 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2494 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2495 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2496 | HDA_INPUT); |
| 2497 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2498 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2499 | return err; |
| 2500 | } |
| 2501 | |
| 2502 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2503 | struct snd_ctl_elem_value *ucontrol); |
| 2504 | |
| 2505 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2506 | struct snd_ctl_elem_value *ucontrol, |
| 2507 | getput_call_t func) |
| 2508 | { |
| 2509 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2510 | struct alc_spec *spec = codec->spec; |
| 2511 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2512 | int err; |
| 2513 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2514 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2515 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2516 | 3, 0, HDA_INPUT); |
| 2517 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2518 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2519 | return err; |
| 2520 | } |
| 2521 | |
| 2522 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2523 | struct snd_ctl_elem_value *ucontrol) |
| 2524 | { |
| 2525 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2526 | snd_hda_mixer_amp_volume_get); |
| 2527 | } |
| 2528 | |
| 2529 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2530 | struct snd_ctl_elem_value *ucontrol) |
| 2531 | { |
| 2532 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2533 | snd_hda_mixer_amp_volume_put); |
| 2534 | } |
| 2535 | |
| 2536 | /* capture mixer elements */ |
| 2537 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2538 | |
| 2539 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2540 | struct snd_ctl_elem_value *ucontrol) |
| 2541 | { |
| 2542 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2543 | snd_hda_mixer_amp_switch_get); |
| 2544 | } |
| 2545 | |
| 2546 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2547 | struct snd_ctl_elem_value *ucontrol) |
| 2548 | { |
| 2549 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2550 | snd_hda_mixer_amp_switch_put); |
| 2551 | } |
| 2552 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2553 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2554 | { \ |
| 2555 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2556 | .name = "Capture Switch", \ |
| 2557 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2558 | .count = num, \ |
| 2559 | .info = alc_cap_sw_info, \ |
| 2560 | .get = alc_cap_sw_get, \ |
| 2561 | .put = alc_cap_sw_put, \ |
| 2562 | }, \ |
| 2563 | { \ |
| 2564 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2565 | .name = "Capture Volume", \ |
| 2566 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2567 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2568 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2569 | .count = num, \ |
| 2570 | .info = alc_cap_vol_info, \ |
| 2571 | .get = alc_cap_vol_get, \ |
| 2572 | .put = alc_cap_vol_put, \ |
| 2573 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2574 | } |
| 2575 | |
| 2576 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2577 | { \ |
| 2578 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2579 | /* .name = "Capture Source", */ \ |
| 2580 | .name = "Input Source", \ |
| 2581 | .count = num, \ |
| 2582 | .info = alc_mux_enum_info, \ |
| 2583 | .get = alc_mux_enum_get, \ |
| 2584 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2585 | } |
| 2586 | |
| 2587 | #define DEFINE_CAPMIX(num) \ |
| 2588 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2589 | _DEFINE_CAPMIX(num), \ |
| 2590 | _DEFINE_CAPSRC(num), \ |
| 2591 | { } /* end */ \ |
| 2592 | } |
| 2593 | |
| 2594 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2595 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2596 | _DEFINE_CAPMIX(num), \ |
| 2597 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2598 | } |
| 2599 | |
| 2600 | /* up to three ADCs */ |
| 2601 | DEFINE_CAPMIX(1); |
| 2602 | DEFINE_CAPMIX(2); |
| 2603 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2604 | DEFINE_CAPMIX_NOSRC(1); |
| 2605 | DEFINE_CAPMIX_NOSRC(2); |
| 2606 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2607 | |
| 2608 | /* |
| 2609 | * ALC880 5-stack model |
| 2610 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2611 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2612 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2613 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2614 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2615 | */ |
| 2616 | |
| 2617 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2618 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2619 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2620 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2621 | { } /* end */ |
| 2622 | }; |
| 2623 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2624 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2625 | /* 6ch mode */ |
| 2626 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2627 | /* set line-in to input, mute it */ |
| 2628 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2629 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2630 | { } /* end */ |
| 2631 | }; |
| 2632 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2633 | /* 8ch mode */ |
| 2634 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2635 | /* set line-in to output, unmute it */ |
| 2636 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2637 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2638 | { } /* end */ |
| 2639 | }; |
| 2640 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2641 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2642 | { 6, alc880_fivestack_ch6_init }, |
| 2643 | { 8, alc880_fivestack_ch8_init }, |
| 2644 | }; |
| 2645 | |
| 2646 | |
| 2647 | /* |
| 2648 | * ALC880 6-stack model |
| 2649 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2650 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2651 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2652 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2653 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2654 | */ |
| 2655 | |
| 2656 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2657 | /* front, rear, clfe, rear_surr */ |
| 2658 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2659 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2660 | |
| 2661 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2662 | .num_items = 4, |
| 2663 | .items = { |
| 2664 | { "Mic", 0x0 }, |
| 2665 | { "Front Mic", 0x1 }, |
| 2666 | { "Line", 0x2 }, |
| 2667 | { "CD", 0x4 }, |
| 2668 | }, |
| 2669 | }; |
| 2670 | |
| 2671 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2672 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2673 | { 8, NULL }, |
| 2674 | }; |
| 2675 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2676 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2677 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2678 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2679 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2680 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2681 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2682 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2683 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2684 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2685 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2686 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2687 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2688 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2693 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2694 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2695 | { |
| 2696 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2697 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2698 | .info = alc_ch_mode_info, |
| 2699 | .get = alc_ch_mode_get, |
| 2700 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2701 | }, |
| 2702 | { } /* end */ |
| 2703 | }; |
| 2704 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2705 | |
| 2706 | /* |
| 2707 | * ALC880 W810 model |
| 2708 | * |
| 2709 | * W810 has rear IO for: |
| 2710 | * Front (DAC 02) |
| 2711 | * Surround (DAC 03) |
| 2712 | * Center/LFE (DAC 04) |
| 2713 | * Digital out (06) |
| 2714 | * |
| 2715 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2716 | * 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] | 2717 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2718 | * There is a variable resistor to control the speaker or headphone |
| 2719 | * volume. This is a hardware-only device without a software API. |
| 2720 | * |
| 2721 | * Plugging headphones in will disable the internal speakers. This is |
| 2722 | * implemented in hardware, not via the driver using jack sense. In |
| 2723 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2724 | * disable both the speakers and headphones. |
| 2725 | * |
| 2726 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2727 | * These may not do anything useful with this driver yet, because I |
| 2728 | * haven't setup any initialization verbs for these yet... |
| 2729 | */ |
| 2730 | |
| 2731 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2732 | /* front, rear/surround, clfe */ |
| 2733 | 0x02, 0x03, 0x04 |
| 2734 | }; |
| 2735 | |
| 2736 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2737 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2738 | { 6, NULL } |
| 2739 | }; |
| 2740 | |
| 2741 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2742 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2743 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2744 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2745 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2746 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2748 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2749 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2750 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2751 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2752 | { } /* end */ |
| 2753 | }; |
| 2754 | |
| 2755 | |
| 2756 | /* |
| 2757 | * Z710V model |
| 2758 | * |
| 2759 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2760 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2761 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2762 | */ |
| 2763 | |
| 2764 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2765 | 0x02 |
| 2766 | }; |
| 2767 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2768 | |
| 2769 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2770 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2771 | { 2, NULL } |
| 2772 | }; |
| 2773 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2774 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2775 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2776 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2777 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2778 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2780 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2782 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2783 | { } /* end */ |
| 2784 | }; |
| 2785 | |
| 2786 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2787 | /* |
| 2788 | * ALC880 F1734 model |
| 2789 | * |
| 2790 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2791 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2792 | */ |
| 2793 | |
| 2794 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2795 | 0x03 |
| 2796 | }; |
| 2797 | #define ALC880_F1734_HP_DAC 0x02 |
| 2798 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2799 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2800 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2801 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2802 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2803 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2808 | { } /* end */ |
| 2809 | }; |
| 2810 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2811 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2812 | .num_items = 2, |
| 2813 | .items = { |
| 2814 | { "Mic", 0x1 }, |
| 2815 | { "CD", 0x4 }, |
| 2816 | }, |
| 2817 | }; |
| 2818 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2819 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2820 | /* |
| 2821 | * ALC880 ASUS model |
| 2822 | * |
| 2823 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2824 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2825 | * Mic = 0x18, Line = 0x1a |
| 2826 | */ |
| 2827 | |
| 2828 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2829 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2830 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2831 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2832 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2833 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2834 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2835 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2836 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2837 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2838 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2839 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2840 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2841 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2842 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2843 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2846 | { |
| 2847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2848 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2849 | .info = alc_ch_mode_info, |
| 2850 | .get = alc_ch_mode_get, |
| 2851 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2852 | }, |
| 2853 | { } /* end */ |
| 2854 | }; |
| 2855 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2856 | /* |
| 2857 | * ALC880 ASUS W1V model |
| 2858 | * |
| 2859 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2860 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2861 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2862 | */ |
| 2863 | |
| 2864 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2865 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2866 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2867 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2868 | { } /* end */ |
| 2869 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2871 | /* TCL S700 */ |
| 2872 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2873 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2874 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2875 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2876 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2877 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2880 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2881 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2882 | { } /* end */ |
| 2883 | }; |
| 2884 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2885 | /* Uniwill */ |
| 2886 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2887 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2888 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2889 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2890 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2891 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2892 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2893 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2894 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2895 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2896 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2897 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2898 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2899 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2900 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2901 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2902 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2903 | { |
| 2904 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2905 | .name = "Channel Mode", |
| 2906 | .info = alc_ch_mode_info, |
| 2907 | .get = alc_ch_mode_get, |
| 2908 | .put = alc_ch_mode_put, |
| 2909 | }, |
| 2910 | { } /* end */ |
| 2911 | }; |
| 2912 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2913 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2914 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2915 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2916 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2917 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2918 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2919 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2920 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2921 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2922 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2923 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2924 | { } /* end */ |
| 2925 | }; |
| 2926 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2927 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2928 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2929 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2930 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2931 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2934 | { } /* end */ |
| 2935 | }; |
| 2936 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2937 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2938 | * virtual master controls |
| 2939 | */ |
| 2940 | |
| 2941 | /* |
| 2942 | * slave controls for virtual master |
| 2943 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2944 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2945 | "Front Playback Volume", |
| 2946 | "Surround Playback Volume", |
| 2947 | "Center Playback Volume", |
| 2948 | "LFE Playback Volume", |
| 2949 | "Side Playback Volume", |
| 2950 | "Headphone Playback Volume", |
| 2951 | "Speaker Playback Volume", |
| 2952 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2953 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2954 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2955 | NULL, |
| 2956 | }; |
| 2957 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2958 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2959 | "Front Playback Switch", |
| 2960 | "Surround Playback Switch", |
| 2961 | "Center Playback Switch", |
| 2962 | "LFE Playback Switch", |
| 2963 | "Side Playback Switch", |
| 2964 | "Headphone Playback Switch", |
| 2965 | "Speaker Playback Switch", |
| 2966 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2967 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2968 | "Line-Out Playback Switch", |
| 2969 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2970 | NULL, |
| 2971 | }; |
| 2972 | |
| 2973 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2974 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2975 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2976 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2977 | #define NID_MAPPING (-1) |
| 2978 | |
| 2979 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2980 | #define SUBDEV_HP_ (1 << 6) |
| 2981 | #define SUBDEV_LINE_ (2 << 6) |
| 2982 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2983 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2984 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2985 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2986 | static void alc_free_kctls(struct hda_codec *codec); |
| 2987 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2988 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2989 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2990 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2991 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2992 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2993 | { } /* end */ |
| 2994 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2995 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2997 | static int alc_build_controls(struct hda_codec *codec) |
| 2998 | { |
| 2999 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 3000 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3001 | struct snd_kcontrol_new *knew; |
| 3002 | int i, j, err; |
| 3003 | unsigned int u; |
| 3004 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3005 | |
| 3006 | for (i = 0; i < spec->num_mixers; i++) { |
| 3007 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3008 | if (err < 0) |
| 3009 | return err; |
| 3010 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3011 | if (spec->cap_mixer) { |
| 3012 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3013 | if (err < 0) |
| 3014 | return err; |
| 3015 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3016 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3017 | err = snd_hda_create_spdif_out_ctls(codec, |
| 3018 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3019 | if (err < 0) |
| 3020 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3021 | if (!spec->no_analog) { |
| 3022 | err = snd_hda_create_spdif_share_sw(codec, |
| 3023 | &spec->multiout); |
| 3024 | if (err < 0) |
| 3025 | return err; |
| 3026 | spec->multiout.share_spdif = 1; |
| 3027 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3028 | } |
| 3029 | if (spec->dig_in_nid) { |
| 3030 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3031 | if (err < 0) |
| 3032 | return err; |
| 3033 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3034 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3035 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3036 | /* create beep controls if needed */ |
| 3037 | if (spec->beep_amp) { |
| 3038 | struct snd_kcontrol_new *knew; |
| 3039 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3040 | struct snd_kcontrol *kctl; |
| 3041 | kctl = snd_ctl_new1(knew, codec); |
| 3042 | if (!kctl) |
| 3043 | return -ENOMEM; |
| 3044 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3045 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3046 | if (err < 0) |
| 3047 | return err; |
| 3048 | } |
| 3049 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3050 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3051 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3052 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3053 | if (!spec->no_analog && |
| 3054 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3055 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3056 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3057 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3058 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3059 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3060 | if (err < 0) |
| 3061 | return err; |
| 3062 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3063 | if (!spec->no_analog && |
| 3064 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3065 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3066 | NULL, alc_slave_sws); |
| 3067 | if (err < 0) |
| 3068 | return err; |
| 3069 | } |
| 3070 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3071 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3072 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3073 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3074 | if (!kctl) |
| 3075 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3076 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3077 | hda_nid_t *nids = spec->capsrc_nids; |
| 3078 | if (!nids) |
| 3079 | nids = spec->adc_nids; |
| 3080 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3081 | if (err < 0) |
| 3082 | return err; |
| 3083 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3084 | } |
| 3085 | if (spec->cap_mixer) { |
| 3086 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3087 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3088 | if (kname && strcmp(knew->name, kname) == 0) |
| 3089 | continue; |
| 3090 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3091 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3092 | err = snd_hda_add_nid(codec, kctl, i, |
| 3093 | spec->adc_nids[i]); |
| 3094 | if (err < 0) |
| 3095 | return err; |
| 3096 | } |
| 3097 | } |
| 3098 | } |
| 3099 | |
| 3100 | /* other nid->control mapping */ |
| 3101 | for (i = 0; i < spec->num_mixers; i++) { |
| 3102 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3103 | if (knew->iface != NID_MAPPING) |
| 3104 | continue; |
| 3105 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3106 | if (kctl == NULL) |
| 3107 | continue; |
| 3108 | u = knew->subdevice; |
| 3109 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3110 | nid = u & 0x3f; |
| 3111 | if (nid == 0) |
| 3112 | continue; |
| 3113 | switch (u & 0xc0) { |
| 3114 | case SUBDEV_SPEAKER_: |
| 3115 | nid = spec->autocfg.speaker_pins[nid]; |
| 3116 | break; |
| 3117 | case SUBDEV_LINE_: |
| 3118 | nid = spec->autocfg.line_out_pins[nid]; |
| 3119 | break; |
| 3120 | case SUBDEV_HP_: |
| 3121 | nid = spec->autocfg.hp_pins[nid]; |
| 3122 | break; |
| 3123 | default: |
| 3124 | continue; |
| 3125 | } |
| 3126 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3127 | if (err < 0) |
| 3128 | return err; |
| 3129 | } |
| 3130 | u = knew->private_value; |
| 3131 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3132 | nid = u & 0xff; |
| 3133 | if (nid == 0) |
| 3134 | continue; |
| 3135 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3136 | if (err < 0) |
| 3137 | return err; |
| 3138 | } |
| 3139 | } |
| 3140 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3141 | |
| 3142 | alc_free_kctls(codec); /* no longer needed */ |
| 3143 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3144 | return 0; |
| 3145 | } |
| 3146 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3147 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3148 | /* |
| 3149 | * initialize the codec volumes, etc |
| 3150 | */ |
| 3151 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3152 | /* |
| 3153 | * generic initialization of ADC, input mixers and output mixers |
| 3154 | */ |
| 3155 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3156 | /* |
| 3157 | * Unmute ADC0-2 and set the default input to mic-in |
| 3158 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3159 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3161 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3162 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3163 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3164 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3165 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3166 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3167 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3168 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3169 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3170 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3171 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3174 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3176 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3177 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3178 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3179 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3180 | /* |
| 3181 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3182 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3183 | /* set vol=0 to output mixers */ |
| 3184 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3185 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3186 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3187 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3188 | /* set up input amps for analog loopback */ |
| 3189 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3192 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3195 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3196 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3197 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3198 | |
| 3199 | { } |
| 3200 | }; |
| 3201 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3202 | /* |
| 3203 | * 3-stack pin configuration: |
| 3204 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3205 | */ |
| 3206 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3207 | /* |
| 3208 | * preset connection lists of input pins |
| 3209 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3210 | */ |
| 3211 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3212 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3213 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3214 | |
| 3215 | /* |
| 3216 | * Set pin mode and muting |
| 3217 | */ |
| 3218 | /* set front pin widgets 0x14 for output */ |
| 3219 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3220 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3221 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3222 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3223 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3224 | /* Mic2 (as headphone out) for HP output */ |
| 3225 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3226 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3227 | /* Line In pin widget for input */ |
| 3228 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3229 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3230 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3231 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3232 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3233 | /* CD pin widget for input */ |
| 3234 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3235 | |
| 3236 | { } |
| 3237 | }; |
| 3238 | |
| 3239 | /* |
| 3240 | * 5-stack pin configuration: |
| 3241 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3242 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3243 | */ |
| 3244 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3245 | /* |
| 3246 | * preset connection lists of input pins |
| 3247 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3248 | */ |
| 3249 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3250 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3251 | |
| 3252 | /* |
| 3253 | * Set pin mode and muting |
| 3254 | */ |
| 3255 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3257 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3259 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3260 | /* unmute pins for output (no gain on this amp) */ |
| 3261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3262 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3263 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3264 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3265 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3266 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3267 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3269 | /* Mic2 (as headphone out) for HP output */ |
| 3270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3271 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | /* Line In pin widget for input */ |
| 3273 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3274 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3275 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3276 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3277 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3278 | /* CD pin widget for input */ |
| 3279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3280 | |
| 3281 | { } |
| 3282 | }; |
| 3283 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3284 | /* |
| 3285 | * W810 pin configuration: |
| 3286 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3287 | */ |
| 3288 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3289 | /* hphone/speaker input selector: front DAC */ |
| 3290 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3291 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3294 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3295 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3296 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3297 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3298 | |
| 3299 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3300 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3302 | { } |
| 3303 | }; |
| 3304 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3305 | /* |
| 3306 | * Z71V pin configuration: |
| 3307 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3308 | */ |
| 3309 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3310 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3311 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3312 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3313 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3314 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3316 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3318 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3319 | |
| 3320 | { } |
| 3321 | }; |
| 3322 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3323 | /* |
| 3324 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3325 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3326 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3327 | */ |
| 3328 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3329 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3330 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3332 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3333 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3334 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3335 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3336 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3337 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3338 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3339 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3340 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3341 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3342 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3343 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3344 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3345 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3346 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3347 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3348 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3349 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3350 | { } |
| 3351 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3352 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3353 | /* |
| 3354 | * Uniwill pin configuration: |
| 3355 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3356 | * line = 0x1a |
| 3357 | */ |
| 3358 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3359 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3360 | |
| 3361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3362 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3366 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3367 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3368 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3372 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3373 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3375 | |
| 3376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3378 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3379 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3382 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3383 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3384 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3385 | |
| 3386 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3387 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3388 | |
| 3389 | { } |
| 3390 | }; |
| 3391 | |
| 3392 | /* |
| 3393 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3394 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3395 | */ |
| 3396 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3397 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3398 | |
| 3399 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3400 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3401 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3403 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3404 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3406 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3408 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3409 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3411 | |
| 3412 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3413 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3414 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3415 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3416 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3417 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3418 | |
| 3419 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3420 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3421 | |
| 3422 | { } |
| 3423 | }; |
| 3424 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3425 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3426 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3427 | { } |
| 3428 | }; |
| 3429 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3430 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3431 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3432 | { |
| 3433 | unsigned int present; |
| 3434 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3435 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3436 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3437 | bits = present ? HDA_AMP_MUTE : 0; |
| 3438 | 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] | 3439 | } |
| 3440 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3441 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3442 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3443 | struct alc_spec *spec = codec->spec; |
| 3444 | |
| 3445 | spec->autocfg.hp_pins[0] = 0x14; |
| 3446 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3447 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3448 | } |
| 3449 | |
| 3450 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3451 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3452 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3453 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3454 | } |
| 3455 | |
| 3456 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3457 | unsigned int res) |
| 3458 | { |
| 3459 | /* Looks like the unsol event is incompatible with the standard |
| 3460 | * definition. 4bit tag is placed at 28 bit! |
| 3461 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3462 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3463 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3464 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3465 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3466 | default: |
| 3467 | alc_automute_amp_unsol_event(codec, res); |
| 3468 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3469 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3470 | } |
| 3471 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3472 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3473 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3474 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3475 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3476 | spec->autocfg.hp_pins[0] = 0x14; |
| 3477 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3478 | } |
| 3479 | |
| 3480 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3481 | { |
| 3482 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3483 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3484 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3485 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3486 | present &= HDA_AMP_VOLMASK; |
| 3487 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3488 | HDA_AMP_VOLMASK, present); |
| 3489 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3490 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3491 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3492 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3493 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3494 | unsigned int res) |
| 3495 | { |
| 3496 | /* Looks like the unsol event is incompatible with the standard |
| 3497 | * definition. 4bit tag is placed at 28 bit! |
| 3498 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3499 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3500 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3501 | else |
| 3502 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3503 | } |
| 3504 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3505 | /* |
| 3506 | * F1734 pin configuration: |
| 3507 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3508 | */ |
| 3509 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3510 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3511 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3512 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3513 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3514 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3515 | |
| 3516 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3517 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3518 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3519 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3520 | |
| 3521 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3522 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3523 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3524 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3525 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3526 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3527 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3528 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3529 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3530 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3531 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3532 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3533 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3534 | { } |
| 3535 | }; |
| 3536 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3537 | /* |
| 3538 | * ASUS pin configuration: |
| 3539 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3540 | */ |
| 3541 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3542 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3543 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3544 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3545 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3546 | |
| 3547 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3548 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3549 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3550 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3551 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3552 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3553 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3555 | |
| 3556 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3557 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3558 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3559 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3560 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3561 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3562 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3563 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3564 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3565 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3566 | { } |
| 3567 | }; |
| 3568 | |
| 3569 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3570 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3571 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3572 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3574 | /* Clevo m520g init */ |
| 3575 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3576 | /* headphone output */ |
| 3577 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3578 | /* line-out */ |
| 3579 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3580 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3581 | /* Line-in */ |
| 3582 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3583 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3584 | /* CD */ |
| 3585 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3586 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3587 | /* Mic1 (rear panel) */ |
| 3588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3589 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3590 | /* Mic2 (front panel) */ |
| 3591 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3592 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3593 | /* headphone */ |
| 3594 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3595 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3596 | /* change to EAPD mode */ |
| 3597 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3598 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3599 | |
| 3600 | { } |
| 3601 | }; |
| 3602 | |
| 3603 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3604 | /* change to EAPD mode */ |
| 3605 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3606 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3607 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3608 | /* Headphone output */ |
| 3609 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3610 | /* Front output*/ |
| 3611 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3612 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3613 | |
| 3614 | /* Line In pin widget for input */ |
| 3615 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3616 | /* CD pin widget for input */ |
| 3617 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3618 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3619 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3620 | |
| 3621 | /* change to EAPD mode */ |
| 3622 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3623 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3624 | |
| 3625 | { } |
| 3626 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3627 | |
| 3628 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3629 | * LG m1 express dual |
| 3630 | * |
| 3631 | * Pin assignment: |
| 3632 | * Rear Line-In/Out (blue): 0x14 |
| 3633 | * Build-in Mic-In: 0x15 |
| 3634 | * Speaker-out: 0x17 |
| 3635 | * HP-Out (green): 0x1b |
| 3636 | * Mic-In/Out (red): 0x19 |
| 3637 | * SPDIF-Out: 0x1e |
| 3638 | */ |
| 3639 | |
| 3640 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3641 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3642 | 0x05, 0x02, 0x03 |
| 3643 | }; |
| 3644 | |
| 3645 | /* seems analog CD is not working */ |
| 3646 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3647 | .num_items = 3, |
| 3648 | .items = { |
| 3649 | { "Mic", 0x1 }, |
| 3650 | { "Line", 0x5 }, |
| 3651 | { "Internal Mic", 0x6 }, |
| 3652 | }, |
| 3653 | }; |
| 3654 | |
| 3655 | /* 2,4,6 channel modes */ |
| 3656 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3657 | /* set line-in and mic-in to input */ |
| 3658 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3659 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3660 | { } |
| 3661 | }; |
| 3662 | |
| 3663 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3664 | /* set line-in to out and mic-in to input */ |
| 3665 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3666 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3667 | { } |
| 3668 | }; |
| 3669 | |
| 3670 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3671 | /* set line-in and mic-in to output */ |
| 3672 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3673 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3674 | { } |
| 3675 | }; |
| 3676 | |
| 3677 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3678 | { 2, alc880_lg_ch2_init }, |
| 3679 | { 4, alc880_lg_ch4_init }, |
| 3680 | { 6, alc880_lg_ch6_init }, |
| 3681 | }; |
| 3682 | |
| 3683 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3685 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3686 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3687 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3688 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3689 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3690 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3691 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3692 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3694 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3695 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3696 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3697 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3698 | { |
| 3699 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3700 | .name = "Channel Mode", |
| 3701 | .info = alc_ch_mode_info, |
| 3702 | .get = alc_ch_mode_get, |
| 3703 | .put = alc_ch_mode_put, |
| 3704 | }, |
| 3705 | { } /* end */ |
| 3706 | }; |
| 3707 | |
| 3708 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3709 | /* set capture source to mic-in */ |
| 3710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3711 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3712 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3713 | /* mute all amp mixer inputs */ |
| 3714 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3716 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3717 | /* line-in to input */ |
| 3718 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3719 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3720 | /* built-in mic */ |
| 3721 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3723 | /* speaker-out */ |
| 3724 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3725 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3726 | /* mic-in to input */ |
| 3727 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3728 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3729 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3730 | /* HP-out */ |
| 3731 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3733 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3734 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3735 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3736 | { } |
| 3737 | }; |
| 3738 | |
| 3739 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3740 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3741 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3742 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3743 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3744 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3745 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3746 | } |
| 3747 | |
| 3748 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3749 | * LG LW20 |
| 3750 | * |
| 3751 | * Pin assignment: |
| 3752 | * Speaker-out: 0x14 |
| 3753 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3754 | * Built-in Mic-In: 0x19 |
| 3755 | * Line-In: 0x1b |
| 3756 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3757 | * SPDIF-Out: 0x1e |
| 3758 | */ |
| 3759 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3760 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3761 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3762 | .items = { |
| 3763 | { "Mic", 0x0 }, |
| 3764 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3765 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3766 | }, |
| 3767 | }; |
| 3768 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3769 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3770 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3771 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3773 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3774 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3775 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3776 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3777 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3778 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3779 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3780 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3781 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3784 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3785 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3786 | { |
| 3787 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3788 | .name = "Channel Mode", |
| 3789 | .info = alc_ch_mode_info, |
| 3790 | .get = alc_ch_mode_get, |
| 3791 | .put = alc_ch_mode_put, |
| 3792 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3793 | { } /* end */ |
| 3794 | }; |
| 3795 | |
| 3796 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3797 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3798 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3799 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3800 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3801 | /* set capture source to mic-in */ |
| 3802 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3803 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3804 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3806 | /* speaker-out */ |
| 3807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3809 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3810 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3811 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3812 | /* mic-in to input */ |
| 3813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3814 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3815 | /* built-in mic */ |
| 3816 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3817 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3818 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3819 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3820 | { } |
| 3821 | }; |
| 3822 | |
| 3823 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3824 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3825 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3826 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3827 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3828 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3829 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3830 | } |
| 3831 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3832 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3833 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3834 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3837 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3838 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3839 | { } /* end */ |
| 3840 | }; |
| 3841 | |
| 3842 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3843 | .num_items = 2, |
| 3844 | .items = { |
| 3845 | { "Mic", 0x0 }, |
| 3846 | { "Internal Mic", 0x1 }, |
| 3847 | }, |
| 3848 | }; |
| 3849 | |
| 3850 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3851 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3852 | |
| 3853 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3854 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3855 | |
| 3856 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3857 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3858 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3859 | /* Mic2 (as headphone out) for HP output */ |
| 3860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3862 | /* Internal Speaker */ |
| 3863 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3864 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3865 | |
| 3866 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3867 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3868 | |
| 3869 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3870 | { } |
| 3871 | }; |
| 3872 | |
| 3873 | /* toggle speaker-output according to the hp-jack state */ |
| 3874 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3875 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3876 | struct alc_spec *spec = codec->spec; |
| 3877 | alc_automute_amp(codec); |
| 3878 | /* toggle EAPD */ |
| 3879 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3880 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3881 | else |
| 3882 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3883 | } |
| 3884 | |
| 3885 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3886 | unsigned int res) |
| 3887 | { |
| 3888 | /* Looks like the unsol event is incompatible with the standard |
| 3889 | * definition. 4bit tag is placed at 28 bit! |
| 3890 | */ |
| 3891 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3892 | alc880_medion_rim_automute(codec); |
| 3893 | } |
| 3894 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3895 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3896 | { |
| 3897 | struct alc_spec *spec = codec->spec; |
| 3898 | |
| 3899 | spec->autocfg.hp_pins[0] = 0x14; |
| 3900 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3901 | } |
| 3902 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3903 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3904 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3905 | { 0x0b, HDA_INPUT, 0 }, |
| 3906 | { 0x0b, HDA_INPUT, 1 }, |
| 3907 | { 0x0b, HDA_INPUT, 2 }, |
| 3908 | { 0x0b, HDA_INPUT, 3 }, |
| 3909 | { 0x0b, HDA_INPUT, 4 }, |
| 3910 | { } /* end */ |
| 3911 | }; |
| 3912 | |
| 3913 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3914 | { 0x0b, HDA_INPUT, 1 }, |
| 3915 | { 0x0b, HDA_INPUT, 6 }, |
| 3916 | { 0x0b, HDA_INPUT, 7 }, |
| 3917 | { } /* end */ |
| 3918 | }; |
| 3919 | #endif |
| 3920 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3921 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3922 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3923 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3924 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3925 | static int alc_init(struct hda_codec *codec) |
| 3926 | { |
| 3927 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3928 | unsigned int i; |
| 3929 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3930 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3931 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3932 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3933 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3934 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3935 | |
| 3936 | if (spec->init_hook) |
| 3937 | spec->init_hook(codec); |
| 3938 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3939 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3940 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3941 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3942 | return 0; |
| 3943 | } |
| 3944 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3945 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3946 | { |
| 3947 | struct alc_spec *spec = codec->spec; |
| 3948 | |
| 3949 | if (spec->unsol_event) |
| 3950 | spec->unsol_event(codec, res); |
| 3951 | } |
| 3952 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3953 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3954 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3955 | { |
| 3956 | struct alc_spec *spec = codec->spec; |
| 3957 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3958 | } |
| 3959 | #endif |
| 3960 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3961 | /* |
| 3962 | * Analog playback callbacks |
| 3963 | */ |
| 3964 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3965 | struct hda_codec *codec, |
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; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3969 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3970 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3971 | } |
| 3972 | |
| 3973 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3974 | struct hda_codec *codec, |
| 3975 | unsigned int stream_tag, |
| 3976 | unsigned int format, |
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; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3980 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3981 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3982 | } |
| 3983 | |
| 3984 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3985 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3986 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3987 | { |
| 3988 | struct alc_spec *spec = codec->spec; |
| 3989 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3990 | } |
| 3991 | |
| 3992 | /* |
| 3993 | * Digital out |
| 3994 | */ |
| 3995 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3996 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3997 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3998 | { |
| 3999 | struct alc_spec *spec = codec->spec; |
| 4000 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 4001 | } |
| 4002 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4003 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4004 | struct hda_codec *codec, |
| 4005 | unsigned int stream_tag, |
| 4006 | unsigned int format, |
| 4007 | struct snd_pcm_substream *substream) |
| 4008 | { |
| 4009 | struct alc_spec *spec = codec->spec; |
| 4010 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 4011 | stream_tag, format, substream); |
| 4012 | } |
| 4013 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4014 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4015 | struct hda_codec *codec, |
| 4016 | struct snd_pcm_substream *substream) |
| 4017 | { |
| 4018 | struct alc_spec *spec = codec->spec; |
| 4019 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 4020 | } |
| 4021 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4022 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 4023 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4024 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4025 | { |
| 4026 | struct alc_spec *spec = codec->spec; |
| 4027 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4028 | } |
| 4029 | |
| 4030 | /* |
| 4031 | * Analog capture |
| 4032 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4033 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4034 | struct hda_codec *codec, |
| 4035 | unsigned int stream_tag, |
| 4036 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4037 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4038 | { |
| 4039 | struct alc_spec *spec = codec->spec; |
| 4040 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4041 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4042 | stream_tag, 0, format); |
| 4043 | return 0; |
| 4044 | } |
| 4045 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4046 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4047 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4048 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4049 | { |
| 4050 | struct alc_spec *spec = codec->spec; |
| 4051 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4052 | snd_hda_codec_cleanup_stream(codec, |
| 4053 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4054 | return 0; |
| 4055 | } |
| 4056 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4057 | /* analog capture with dynamic dual-adc changes */ |
| 4058 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4059 | struct hda_codec *codec, |
| 4060 | unsigned int stream_tag, |
| 4061 | unsigned int format, |
| 4062 | struct snd_pcm_substream *substream) |
| 4063 | { |
| 4064 | struct alc_spec *spec = codec->spec; |
| 4065 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4066 | spec->cur_adc_stream_tag = stream_tag; |
| 4067 | spec->cur_adc_format = format; |
| 4068 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4069 | return 0; |
| 4070 | } |
| 4071 | |
| 4072 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4073 | struct hda_codec *codec, |
| 4074 | struct snd_pcm_substream *substream) |
| 4075 | { |
| 4076 | struct alc_spec *spec = codec->spec; |
| 4077 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4078 | spec->cur_adc = 0; |
| 4079 | return 0; |
| 4080 | } |
| 4081 | |
| 4082 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4083 | .substreams = 1, |
| 4084 | .channels_min = 2, |
| 4085 | .channels_max = 2, |
| 4086 | .nid = 0, /* fill later */ |
| 4087 | .ops = { |
| 4088 | .prepare = dualmic_capture_pcm_prepare, |
| 4089 | .cleanup = dualmic_capture_pcm_cleanup |
| 4090 | }, |
| 4091 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4092 | |
| 4093 | /* |
| 4094 | */ |
| 4095 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4096 | .substreams = 1, |
| 4097 | .channels_min = 2, |
| 4098 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4099 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4100 | .ops = { |
| 4101 | .open = alc880_playback_pcm_open, |
| 4102 | .prepare = alc880_playback_pcm_prepare, |
| 4103 | .cleanup = alc880_playback_pcm_cleanup |
| 4104 | }, |
| 4105 | }; |
| 4106 | |
| 4107 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4108 | .substreams = 1, |
| 4109 | .channels_min = 2, |
| 4110 | .channels_max = 2, |
| 4111 | /* NID is set in alc_build_pcms */ |
| 4112 | }; |
| 4113 | |
| 4114 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4115 | .substreams = 1, |
| 4116 | .channels_min = 2, |
| 4117 | .channels_max = 2, |
| 4118 | /* NID is set in alc_build_pcms */ |
| 4119 | }; |
| 4120 | |
| 4121 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4122 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4123 | .channels_min = 2, |
| 4124 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4125 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4126 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4127 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4128 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4129 | }, |
| 4130 | }; |
| 4131 | |
| 4132 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4133 | .substreams = 1, |
| 4134 | .channels_min = 2, |
| 4135 | .channels_max = 2, |
| 4136 | /* NID is set in alc_build_pcms */ |
| 4137 | .ops = { |
| 4138 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4139 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4140 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4141 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4142 | }, |
| 4143 | }; |
| 4144 | |
| 4145 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4146 | .substreams = 1, |
| 4147 | .channels_min = 2, |
| 4148 | .channels_max = 2, |
| 4149 | /* NID is set in alc_build_pcms */ |
| 4150 | }; |
| 4151 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4152 | /* 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] | 4153 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4154 | .substreams = 0, |
| 4155 | .channels_min = 0, |
| 4156 | .channels_max = 0, |
| 4157 | }; |
| 4158 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4159 | static int alc_build_pcms(struct hda_codec *codec) |
| 4160 | { |
| 4161 | struct alc_spec *spec = codec->spec; |
| 4162 | struct hda_pcm *info = spec->pcm_rec; |
| 4163 | int i; |
| 4164 | |
| 4165 | codec->num_pcms = 1; |
| 4166 | codec->pcm_info = info; |
| 4167 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4168 | if (spec->no_analog) |
| 4169 | goto skip_analog; |
| 4170 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4171 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4172 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4173 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4174 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4175 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4176 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4177 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4178 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4179 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4180 | } |
| 4181 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4182 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4183 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4184 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4185 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4186 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4187 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4188 | if (spec->channel_mode) { |
| 4189 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4190 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4191 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4192 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4193 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4194 | } |
| 4195 | } |
| 4196 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4197 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4198 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4199 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4200 | snprintf(spec->stream_name_digital, |
| 4201 | sizeof(spec->stream_name_digital), |
| 4202 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4203 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4204 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4205 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4206 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4207 | if (spec->dig_out_type) |
| 4208 | info->pcm_type = spec->dig_out_type; |
| 4209 | else |
| 4210 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4211 | if (spec->multiout.dig_out_nid && |
| 4212 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4213 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4214 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4215 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4216 | if (spec->dig_in_nid && |
| 4217 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4218 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4219 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4220 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4221 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4222 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4223 | } |
| 4224 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4225 | if (spec->no_analog) |
| 4226 | return 0; |
| 4227 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4228 | /* If the use of more than one ADC is requested for the current |
| 4229 | * model, configure a second analog capture-only PCM. |
| 4230 | */ |
| 4231 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4232 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4233 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4234 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4235 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4236 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4237 | if (spec->alt_dac_nid) { |
| 4238 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4239 | *spec->stream_analog_alt_playback; |
| 4240 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4241 | spec->alt_dac_nid; |
| 4242 | } else { |
| 4243 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4244 | alc_pcm_null_stream; |
| 4245 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4246 | } |
| 4247 | if (spec->num_adc_nids > 1) { |
| 4248 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4249 | *spec->stream_analog_alt_capture; |
| 4250 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4251 | spec->adc_nids[1]; |
| 4252 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4253 | spec->num_adc_nids - 1; |
| 4254 | } else { |
| 4255 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4256 | alc_pcm_null_stream; |
| 4257 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4258 | } |
| 4259 | } |
| 4260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4261 | return 0; |
| 4262 | } |
| 4263 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4264 | static inline void alc_shutup(struct hda_codec *codec) |
| 4265 | { |
| 4266 | snd_hda_shutup_pins(codec); |
| 4267 | } |
| 4268 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4269 | static void alc_free_kctls(struct hda_codec *codec) |
| 4270 | { |
| 4271 | struct alc_spec *spec = codec->spec; |
| 4272 | |
| 4273 | if (spec->kctls.list) { |
| 4274 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4275 | int i; |
| 4276 | for (i = 0; i < spec->kctls.used; i++) |
| 4277 | kfree(kctl[i].name); |
| 4278 | } |
| 4279 | snd_array_free(&spec->kctls); |
| 4280 | } |
| 4281 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4282 | static void alc_free(struct hda_codec *codec) |
| 4283 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4284 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4285 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4286 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4287 | return; |
| 4288 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4289 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4290 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4291 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4292 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4293 | } |
| 4294 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4295 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4296 | static void alc_power_eapd(struct hda_codec *codec) |
| 4297 | { |
| 4298 | /* We currently only handle front, HP */ |
| 4299 | switch (codec->vendor_id) { |
| 4300 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4301 | set_eapd(codec, 0x0f, 0); |
| 4302 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4303 | break; |
| 4304 | case 0x10ec0262: |
| 4305 | case 0x10ec0267: |
| 4306 | case 0x10ec0268: |
| 4307 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4308 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4309 | case 0x10ec0272: |
| 4310 | case 0x10ec0660: |
| 4311 | case 0x10ec0662: |
| 4312 | case 0x10ec0663: |
| 4313 | case 0x10ec0862: |
| 4314 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4315 | set_eapd(codec, 0x14, 0); |
| 4316 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4317 | break; |
| 4318 | } |
| 4319 | } |
| 4320 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4321 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4322 | { |
| 4323 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4324 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4325 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4326 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4327 | return 0; |
| 4328 | } |
| 4329 | #endif |
| 4330 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4331 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4332 | static int alc_resume(struct hda_codec *codec) |
| 4333 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4334 | codec->patch_ops.init(codec); |
| 4335 | snd_hda_codec_resume_amp(codec); |
| 4336 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4337 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4338 | return 0; |
| 4339 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4340 | #endif |
| 4341 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4342 | /* |
| 4343 | */ |
| 4344 | static struct hda_codec_ops alc_patch_ops = { |
| 4345 | .build_controls = alc_build_controls, |
| 4346 | .build_pcms = alc_build_pcms, |
| 4347 | .init = alc_init, |
| 4348 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4349 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4350 | #ifdef SND_HDA_NEEDS_RESUME |
| 4351 | .resume = alc_resume, |
| 4352 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4353 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4354 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4355 | .check_power_status = alc_check_power_status, |
| 4356 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4357 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4358 | }; |
| 4359 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4360 | /* replace the codec chip_name with the given string */ |
| 4361 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4362 | { |
| 4363 | kfree(codec->chip_name); |
| 4364 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4365 | if (!codec->chip_name) { |
| 4366 | alc_free(codec); |
| 4367 | return -ENOMEM; |
| 4368 | } |
| 4369 | return 0; |
| 4370 | } |
| 4371 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4372 | /* |
| 4373 | * Test configuration for debugging |
| 4374 | * |
| 4375 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4376 | * enum controls. |
| 4377 | */ |
| 4378 | #ifdef CONFIG_SND_DEBUG |
| 4379 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4380 | 0x02, 0x03, 0x04, 0x05 |
| 4381 | }; |
| 4382 | |
| 4383 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4384 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4385 | .items = { |
| 4386 | { "In-1", 0x0 }, |
| 4387 | { "In-2", 0x1 }, |
| 4388 | { "In-3", 0x2 }, |
| 4389 | { "In-4", 0x3 }, |
| 4390 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4391 | { "Front", 0x5 }, |
| 4392 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4393 | }, |
| 4394 | }; |
| 4395 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4396 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4397 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4398 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4399 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4400 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4401 | }; |
| 4402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4403 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4404 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4405 | { |
| 4406 | static char *texts[] = { |
| 4407 | "N/A", "Line Out", "HP Out", |
| 4408 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4409 | }; |
| 4410 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4411 | uinfo->count = 1; |
| 4412 | uinfo->value.enumerated.items = 8; |
| 4413 | if (uinfo->value.enumerated.item >= 8) |
| 4414 | uinfo->value.enumerated.item = 7; |
| 4415 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4416 | return 0; |
| 4417 | } |
| 4418 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4419 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4420 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4421 | { |
| 4422 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4423 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4424 | unsigned int pin_ctl, item = 0; |
| 4425 | |
| 4426 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4427 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4428 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4429 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4430 | item = 2; |
| 4431 | else |
| 4432 | item = 1; |
| 4433 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4434 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4435 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4436 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4437 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4438 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4439 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4440 | } |
| 4441 | } |
| 4442 | ucontrol->value.enumerated.item[0] = item; |
| 4443 | return 0; |
| 4444 | } |
| 4445 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4446 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4447 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4448 | { |
| 4449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4450 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4451 | static unsigned int ctls[] = { |
| 4452 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4453 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4454 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4455 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4456 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4457 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4458 | }; |
| 4459 | unsigned int old_ctl, new_ctl; |
| 4460 | |
| 4461 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4462 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4463 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4464 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4465 | int val; |
| 4466 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4467 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4468 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4469 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4470 | HDA_AMP_MUTE : 0; |
| 4471 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4472 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4473 | return 1; |
| 4474 | } |
| 4475 | return 0; |
| 4476 | } |
| 4477 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4478 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4479 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4480 | { |
| 4481 | static char *texts[] = { |
| 4482 | "Front", "Surround", "CLFE", "Side" |
| 4483 | }; |
| 4484 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4485 | uinfo->count = 1; |
| 4486 | uinfo->value.enumerated.items = 4; |
| 4487 | if (uinfo->value.enumerated.item >= 4) |
| 4488 | uinfo->value.enumerated.item = 3; |
| 4489 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4490 | return 0; |
| 4491 | } |
| 4492 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4493 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4494 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4495 | { |
| 4496 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4497 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4498 | unsigned int sel; |
| 4499 | |
| 4500 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4501 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4502 | return 0; |
| 4503 | } |
| 4504 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4505 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4506 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4507 | { |
| 4508 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4509 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4510 | unsigned int sel; |
| 4511 | |
| 4512 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4513 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4514 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4515 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4516 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4517 | return 1; |
| 4518 | } |
| 4519 | return 0; |
| 4520 | } |
| 4521 | |
| 4522 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4523 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4524 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4525 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4526 | .info = alc_test_pin_ctl_info, \ |
| 4527 | .get = alc_test_pin_ctl_get, \ |
| 4528 | .put = alc_test_pin_ctl_put, \ |
| 4529 | .private_value = nid \ |
| 4530 | } |
| 4531 | |
| 4532 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4533 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4534 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4535 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4536 | .info = alc_test_pin_src_info, \ |
| 4537 | .get = alc_test_pin_src_get, \ |
| 4538 | .put = alc_test_pin_src_put, \ |
| 4539 | .private_value = nid \ |
| 4540 | } |
| 4541 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4542 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4543 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4544 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4545 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4546 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4547 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4548 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4549 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4550 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4551 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4552 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4553 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4554 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4555 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4556 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4557 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4558 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4559 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4560 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4561 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4562 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4563 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4564 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4565 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4566 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4567 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4568 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4569 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4570 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4571 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4572 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4573 | { |
| 4574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4575 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4576 | .info = alc_ch_mode_info, |
| 4577 | .get = alc_ch_mode_get, |
| 4578 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4579 | }, |
| 4580 | { } /* end */ |
| 4581 | }; |
| 4582 | |
| 4583 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4584 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4591 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4592 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4593 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4596 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4597 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4598 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4600 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4601 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4602 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4603 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4604 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4605 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4606 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4607 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4608 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4609 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4610 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4611 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4612 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4613 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4614 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4615 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4616 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4617 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4618 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4619 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4620 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4621 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4622 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4623 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4624 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4625 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4626 | /* Analog input/passthru */ |
| 4627 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4628 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4631 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4632 | { } |
| 4633 | }; |
| 4634 | #endif |
| 4635 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4636 | /* |
| 4637 | */ |
| 4638 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4639 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4640 | [ALC880_3ST] = "3stack", |
| 4641 | [ALC880_TCL_S700] = "tcl", |
| 4642 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4643 | [ALC880_CLEVO] = "clevo", |
| 4644 | [ALC880_5ST] = "5stack", |
| 4645 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4646 | [ALC880_W810] = "w810", |
| 4647 | [ALC880_Z71V] = "z71v", |
| 4648 | [ALC880_6ST] = "6stack", |
| 4649 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4650 | [ALC880_ASUS] = "asus", |
| 4651 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4652 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4653 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4654 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4655 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4656 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4657 | [ALC880_F1734] = "F1734", |
| 4658 | [ALC880_LG] = "lg", |
| 4659 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4660 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4661 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4662 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4663 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4664 | [ALC880_AUTO] = "auto", |
| 4665 | }; |
| 4666 | |
| 4667 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4668 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4669 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4670 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4671 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4672 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4673 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4674 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4675 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4676 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4677 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4678 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4679 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4680 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4681 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4682 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4683 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4684 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4685 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4686 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4687 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4688 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4689 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4690 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4691 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4692 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4693 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4694 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4695 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4696 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4697 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4698 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4699 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4700 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4701 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4702 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4703 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4704 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4705 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4706 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4707 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4708 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4709 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4710 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4711 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4712 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4713 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4714 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4715 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4716 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4717 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4718 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4719 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4720 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4721 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4722 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4723 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4724 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4725 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4726 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4727 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4728 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4729 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4730 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4731 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4732 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4733 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4734 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4735 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4736 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4737 | /* default Intel */ |
| 4738 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4739 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4740 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4741 | {} |
| 4742 | }; |
| 4743 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4744 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4745 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4746 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4747 | static struct alc_config_preset alc880_presets[] = { |
| 4748 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4749 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4750 | .init_verbs = { alc880_volume_init_verbs, |
| 4751 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4752 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4753 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4754 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4755 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4756 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4757 | .input_mux = &alc880_capture_source, |
| 4758 | }, |
| 4759 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4760 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4761 | .init_verbs = { alc880_volume_init_verbs, |
| 4762 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4763 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4764 | .dac_nids = alc880_dac_nids, |
| 4765 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4766 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4767 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4768 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4769 | .input_mux = &alc880_capture_source, |
| 4770 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4771 | [ALC880_TCL_S700] = { |
| 4772 | .mixers = { alc880_tcl_s700_mixer }, |
| 4773 | .init_verbs = { alc880_volume_init_verbs, |
| 4774 | alc880_pin_tcl_S700_init_verbs, |
| 4775 | alc880_gpio2_init_verbs }, |
| 4776 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4777 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4778 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4779 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4780 | .hp_nid = 0x03, |
| 4781 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4782 | .channel_mode = alc880_2_jack_modes, |
| 4783 | .input_mux = &alc880_capture_source, |
| 4784 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4785 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4786 | .mixers = { alc880_three_stack_mixer, |
| 4787 | alc880_five_stack_mixer}, |
| 4788 | .init_verbs = { alc880_volume_init_verbs, |
| 4789 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4790 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4791 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4792 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4793 | .channel_mode = alc880_fivestack_modes, |
| 4794 | .input_mux = &alc880_capture_source, |
| 4795 | }, |
| 4796 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4797 | .mixers = { alc880_three_stack_mixer, |
| 4798 | alc880_five_stack_mixer }, |
| 4799 | .init_verbs = { alc880_volume_init_verbs, |
| 4800 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4801 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4802 | .dac_nids = alc880_dac_nids, |
| 4803 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4804 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4805 | .channel_mode = alc880_fivestack_modes, |
| 4806 | .input_mux = &alc880_capture_source, |
| 4807 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4808 | [ALC880_6ST] = { |
| 4809 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4810 | .init_verbs = { alc880_volume_init_verbs, |
| 4811 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4812 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4813 | .dac_nids = alc880_6st_dac_nids, |
| 4814 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4815 | .channel_mode = alc880_sixstack_modes, |
| 4816 | .input_mux = &alc880_6stack_capture_source, |
| 4817 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4818 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4819 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4820 | .init_verbs = { alc880_volume_init_verbs, |
| 4821 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4822 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4823 | .dac_nids = alc880_6st_dac_nids, |
| 4824 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4825 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4826 | .channel_mode = alc880_sixstack_modes, |
| 4827 | .input_mux = &alc880_6stack_capture_source, |
| 4828 | }, |
| 4829 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4830 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4831 | .init_verbs = { alc880_volume_init_verbs, |
| 4832 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4833 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4834 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4835 | .dac_nids = alc880_w810_dac_nids, |
| 4836 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4837 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4838 | .channel_mode = alc880_w810_modes, |
| 4839 | .input_mux = &alc880_capture_source, |
| 4840 | }, |
| 4841 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4842 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4843 | .init_verbs = { alc880_volume_init_verbs, |
| 4844 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4845 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4846 | .dac_nids = alc880_z71v_dac_nids, |
| 4847 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4848 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4849 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4850 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4851 | .input_mux = &alc880_capture_source, |
| 4852 | }, |
| 4853 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4854 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4855 | .init_verbs = { alc880_volume_init_verbs, |
| 4856 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4857 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4858 | .dac_nids = alc880_f1734_dac_nids, |
| 4859 | .hp_nid = 0x02, |
| 4860 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4861 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4862 | .input_mux = &alc880_f1734_capture_source, |
| 4863 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4864 | .setup = alc880_uniwill_p53_setup, |
| 4865 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4866 | }, |
| 4867 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4868 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4869 | .init_verbs = { alc880_volume_init_verbs, |
| 4870 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4871 | alc880_gpio1_init_verbs }, |
| 4872 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4873 | .dac_nids = alc880_asus_dac_nids, |
| 4874 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4875 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4876 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4877 | .input_mux = &alc880_capture_source, |
| 4878 | }, |
| 4879 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4880 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4881 | .init_verbs = { alc880_volume_init_verbs, |
| 4882 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4883 | alc880_gpio1_init_verbs }, |
| 4884 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4885 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4886 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4887 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4888 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4889 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4890 | .input_mux = &alc880_capture_source, |
| 4891 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4892 | [ALC880_ASUS_DIG2] = { |
| 4893 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4894 | .init_verbs = { alc880_volume_init_verbs, |
| 4895 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4896 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4897 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4898 | .dac_nids = alc880_asus_dac_nids, |
| 4899 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4900 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4901 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4902 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4903 | .input_mux = &alc880_capture_source, |
| 4904 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4905 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4906 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4907 | .init_verbs = { alc880_volume_init_verbs, |
| 4908 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4909 | alc880_gpio1_init_verbs }, |
| 4910 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4911 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4912 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4913 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4914 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4915 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4916 | .input_mux = &alc880_capture_source, |
| 4917 | }, |
| 4918 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4919 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4920 | .init_verbs = { alc880_volume_init_verbs, |
| 4921 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4922 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4923 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4924 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4925 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4926 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4927 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4928 | .input_mux = &alc880_capture_source, |
| 4929 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4930 | [ALC880_UNIWILL] = { |
| 4931 | .mixers = { alc880_uniwill_mixer }, |
| 4932 | .init_verbs = { alc880_volume_init_verbs, |
| 4933 | alc880_uniwill_init_verbs }, |
| 4934 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4935 | .dac_nids = alc880_asus_dac_nids, |
| 4936 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4937 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4938 | .channel_mode = alc880_threestack_modes, |
| 4939 | .need_dac_fix = 1, |
| 4940 | .input_mux = &alc880_capture_source, |
| 4941 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4942 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4943 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4944 | }, |
| 4945 | [ALC880_UNIWILL_P53] = { |
| 4946 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4947 | .init_verbs = { alc880_volume_init_verbs, |
| 4948 | alc880_uniwill_p53_init_verbs }, |
| 4949 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4950 | .dac_nids = alc880_asus_dac_nids, |
| 4951 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4952 | .channel_mode = alc880_threestack_modes, |
| 4953 | .input_mux = &alc880_capture_source, |
| 4954 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4955 | .setup = alc880_uniwill_p53_setup, |
| 4956 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4957 | }, |
| 4958 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4959 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4960 | .init_verbs = { alc880_volume_init_verbs, |
| 4961 | alc880_uniwill_p53_init_verbs, |
| 4962 | alc880_beep_init_verbs }, |
| 4963 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4964 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4965 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4966 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4967 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4968 | .input_mux = &alc880_capture_source, |
| 4969 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4970 | .setup = alc880_uniwill_p53_setup, |
| 4971 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4972 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4973 | [ALC880_CLEVO] = { |
| 4974 | .mixers = { alc880_three_stack_mixer }, |
| 4975 | .init_verbs = { alc880_volume_init_verbs, |
| 4976 | alc880_pin_clevo_init_verbs }, |
| 4977 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4978 | .dac_nids = alc880_dac_nids, |
| 4979 | .hp_nid = 0x03, |
| 4980 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4981 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4982 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4983 | .input_mux = &alc880_capture_source, |
| 4984 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4985 | [ALC880_LG] = { |
| 4986 | .mixers = { alc880_lg_mixer }, |
| 4987 | .init_verbs = { alc880_volume_init_verbs, |
| 4988 | alc880_lg_init_verbs }, |
| 4989 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4990 | .dac_nids = alc880_lg_dac_nids, |
| 4991 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4992 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4993 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4994 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4995 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4996 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4997 | .setup = alc880_lg_setup, |
| 4998 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4999 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5000 | .loopbacks = alc880_lg_loopbacks, |
| 5001 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5002 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5003 | [ALC880_LG_LW] = { |
| 5004 | .mixers = { alc880_lg_lw_mixer }, |
| 5005 | .init_verbs = { alc880_volume_init_verbs, |
| 5006 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5007 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5008 | .dac_nids = alc880_dac_nids, |
| 5009 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5010 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5011 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5012 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 5013 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5014 | .setup = alc880_lg_lw_setup, |
| 5015 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5016 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5017 | [ALC880_MEDION_RIM] = { |
| 5018 | .mixers = { alc880_medion_rim_mixer }, |
| 5019 | .init_verbs = { alc880_volume_init_verbs, |
| 5020 | alc880_medion_rim_init_verbs, |
| 5021 | alc_gpio2_init_verbs }, |
| 5022 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5023 | .dac_nids = alc880_dac_nids, |
| 5024 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5025 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5026 | .channel_mode = alc880_2_jack_modes, |
| 5027 | .input_mux = &alc880_medion_rim_capture_source, |
| 5028 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5029 | .setup = alc880_medion_rim_setup, |
| 5030 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5031 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5032 | #ifdef CONFIG_SND_DEBUG |
| 5033 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5034 | .mixers = { alc880_test_mixer }, |
| 5035 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5036 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5037 | .dac_nids = alc880_test_dac_nids, |
| 5038 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5039 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5040 | .channel_mode = alc880_test_modes, |
| 5041 | .input_mux = &alc880_test_capture_source, |
| 5042 | }, |
| 5043 | #endif |
| 5044 | }; |
| 5045 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5046 | /* |
| 5047 | * Automatic parse of I/O pins from the BIOS configuration |
| 5048 | */ |
| 5049 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5050 | enum { |
| 5051 | ALC_CTL_WIDGET_VOL, |
| 5052 | ALC_CTL_WIDGET_MUTE, |
| 5053 | ALC_CTL_BIND_MUTE, |
| 5054 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5055 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5056 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5057 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5058 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5059 | }; |
| 5060 | |
| 5061 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5062 | 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] | 5063 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5064 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5065 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5066 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5067 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 5068 | knew = snd_array_new(&spec->kctls); |
| 5069 | if (!knew) |
| 5070 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5071 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5072 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5073 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5074 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5075 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5076 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5077 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5078 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5079 | return 0; |
| 5080 | } |
| 5081 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5082 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5083 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5084 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5085 | { |
| 5086 | char name[32]; |
| 5087 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5088 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5089 | } |
| 5090 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5091 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5092 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5093 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5094 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5095 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5096 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5097 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5098 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5099 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5100 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5101 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5102 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5103 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5104 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5105 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5106 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5107 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5108 | #define ALC880_PIN_CD_NID 0x1c |
| 5109 | |
| 5110 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5111 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5112 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5113 | { |
| 5114 | hda_nid_t nid; |
| 5115 | int assigned[4]; |
| 5116 | int i, j; |
| 5117 | |
| 5118 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5119 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5120 | |
| 5121 | /* check the pins hardwired to audio widget */ |
| 5122 | for (i = 0; i < cfg->line_outs; i++) { |
| 5123 | nid = cfg->line_out_pins[i]; |
| 5124 | if (alc880_is_fixed_pin(nid)) { |
| 5125 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5126 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5127 | assigned[idx] = 1; |
| 5128 | } |
| 5129 | } |
| 5130 | /* left pins can be connect to any audio widget */ |
| 5131 | for (i = 0; i < cfg->line_outs; i++) { |
| 5132 | nid = cfg->line_out_pins[i]; |
| 5133 | if (alc880_is_fixed_pin(nid)) |
| 5134 | continue; |
| 5135 | /* search for an empty channel */ |
| 5136 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5137 | if (!assigned[j]) { |
| 5138 | spec->multiout.dac_nids[i] = |
| 5139 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5140 | assigned[j] = 1; |
| 5141 | break; |
| 5142 | } |
| 5143 | } |
| 5144 | } |
| 5145 | spec->multiout.num_dacs = cfg->line_outs; |
| 5146 | return 0; |
| 5147 | } |
| 5148 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5149 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, |
| 5150 | bool can_be_master) |
| 5151 | { |
| 5152 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
| 5153 | return "Master"; |
| 5154 | |
| 5155 | switch (cfg->line_out_type) { |
| 5156 | case AUTO_PIN_SPEAKER_OUT: |
| 5157 | return "Speaker"; |
| 5158 | case AUTO_PIN_HP_OUT: |
| 5159 | return "Headphone"; |
| 5160 | default: |
| 5161 | if (cfg->line_outs == 1) |
| 5162 | return "PCM"; |
| 5163 | break; |
| 5164 | } |
| 5165 | return NULL; |
| 5166 | } |
| 5167 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5168 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5169 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5170 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5171 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5172 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5173 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5174 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5175 | const char *pfx = alc_get_line_out_pfx(cfg, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5176 | hda_nid_t nid; |
| 5177 | int i, err; |
| 5178 | |
| 5179 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5180 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5181 | continue; |
| 5182 | 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] | 5183 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5184 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5185 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5186 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5187 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5188 | HDA_OUTPUT)); |
| 5189 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5190 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5191 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5192 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5193 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5194 | HDA_OUTPUT)); |
| 5195 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5196 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5197 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5198 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5199 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5200 | HDA_INPUT)); |
| 5201 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5202 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5203 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5204 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5205 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5206 | HDA_INPUT)); |
| 5207 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5208 | return err; |
| 5209 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5210 | const char *name = pfx; |
| 5211 | if (!name) |
| 5212 | name = chname[i]; |
| 5213 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5214 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5215 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5216 | HDA_OUTPUT)); |
| 5217 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5218 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5219 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5220 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5221 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5222 | HDA_INPUT)); |
| 5223 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5224 | return err; |
| 5225 | } |
| 5226 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5227 | return 0; |
| 5228 | } |
| 5229 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5230 | /* add playback controls for speaker and HP outputs */ |
| 5231 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5232 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5233 | { |
| 5234 | hda_nid_t nid; |
| 5235 | int err; |
| 5236 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5237 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5238 | return 0; |
| 5239 | |
| 5240 | if (alc880_is_fixed_pin(pin)) { |
| 5241 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5242 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5243 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5244 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5245 | else |
| 5246 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5247 | /* control HP volume/switch on the output mixer amp */ |
| 5248 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5249 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5250 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5251 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5252 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5253 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5254 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5255 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5256 | return err; |
| 5257 | } else if (alc880_is_multi_pin(pin)) { |
| 5258 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5259 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5260 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5261 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5262 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5263 | return err; |
| 5264 | } |
| 5265 | return 0; |
| 5266 | } |
| 5267 | |
| 5268 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5269 | 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] | 5270 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5271 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5272 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5273 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5274 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5275 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5276 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5277 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5278 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5279 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5280 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5281 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5282 | return err; |
| 5283 | return 0; |
| 5284 | } |
| 5285 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5286 | 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] | 5287 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5288 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5289 | return (pincap & AC_PINCAP_IN) != 0; |
| 5290 | } |
| 5291 | |
| 5292 | /* create playback/capture controls for input pins */ |
| 5293 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5294 | const struct auto_pin_cfg *cfg, |
| 5295 | hda_nid_t mixer, |
| 5296 | hda_nid_t cap1, hda_nid_t cap2) |
| 5297 | { |
| 5298 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5299 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5300 | int i, err, idx, type_idx = 0; |
| 5301 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5302 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5303 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5304 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5305 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5306 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5307 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5308 | if (!alc_is_input_pin(codec, pin)) |
| 5309 | continue; |
| 5310 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5311 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5312 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5313 | type_idx++; |
| 5314 | else |
| 5315 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5316 | prev_label = label; |
| 5317 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5318 | if (mixer) { |
| 5319 | idx = get_connection_index(codec, mixer, pin); |
| 5320 | if (idx >= 0) { |
| 5321 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5322 | label, type_idx, |
| 5323 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5324 | if (err < 0) |
| 5325 | return err; |
| 5326 | } |
| 5327 | } |
| 5328 | |
| 5329 | if (!cap1) |
| 5330 | continue; |
| 5331 | idx = get_connection_index(codec, cap1, pin); |
| 5332 | if (idx < 0 && cap2) |
| 5333 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5334 | if (idx >= 0) |
| 5335 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5336 | } |
| 5337 | return 0; |
| 5338 | } |
| 5339 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5340 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5341 | const struct auto_pin_cfg *cfg) |
| 5342 | { |
| 5343 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5344 | } |
| 5345 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5346 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5347 | unsigned int pin_type) |
| 5348 | { |
| 5349 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5350 | pin_type); |
| 5351 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5352 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5353 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5354 | } |
| 5355 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5356 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5357 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5358 | int dac_idx) |
| 5359 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5360 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5361 | /* need the manual connection? */ |
| 5362 | if (alc880_is_multi_pin(nid)) { |
| 5363 | struct alc_spec *spec = codec->spec; |
| 5364 | int idx = alc880_multi_pin_idx(nid); |
| 5365 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5366 | AC_VERB_SET_CONNECT_SEL, |
| 5367 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5368 | } |
| 5369 | } |
| 5370 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5371 | static int get_pin_type(int line_out_type) |
| 5372 | { |
| 5373 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5374 | return PIN_HP; |
| 5375 | else |
| 5376 | return PIN_OUT; |
| 5377 | } |
| 5378 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5379 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5380 | { |
| 5381 | struct alc_spec *spec = codec->spec; |
| 5382 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5383 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5384 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5385 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5386 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5387 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5388 | } |
| 5389 | } |
| 5390 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5391 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5392 | { |
| 5393 | struct alc_spec *spec = codec->spec; |
| 5394 | hda_nid_t pin; |
| 5395 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5396 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5397 | if (pin) /* connect to front */ |
| 5398 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5399 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5400 | if (pin) /* connect to front */ |
| 5401 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5402 | } |
| 5403 | |
| 5404 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5405 | { |
| 5406 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5407 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5408 | int i; |
| 5409 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5410 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5411 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5412 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5413 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5414 | if (nid != ALC880_PIN_CD_NID && |
| 5415 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5416 | snd_hda_codec_write(codec, nid, 0, |
| 5417 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5418 | AMP_OUT_MUTE); |
| 5419 | } |
| 5420 | } |
| 5421 | } |
| 5422 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5423 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5424 | { |
| 5425 | struct alc_spec *spec = codec->spec; |
| 5426 | int c; |
| 5427 | |
| 5428 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5429 | unsigned int mux_idx; |
| 5430 | const struct hda_input_mux *imux; |
| 5431 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5432 | imux = &spec->input_mux[mux_idx]; |
| 5433 | if (!imux->num_items && mux_idx > 0) |
| 5434 | imux = &spec->input_mux[0]; |
| 5435 | if (imux) |
| 5436 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5437 | AC_VERB_SET_CONNECT_SEL, |
| 5438 | imux->items[0].index); |
| 5439 | } |
| 5440 | } |
| 5441 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5442 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5443 | /* return 1 if successful, 0 if the proper config is not found, |
| 5444 | * or a negative error code |
| 5445 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5446 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5447 | { |
| 5448 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5449 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5450 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5451 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5452 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5453 | alc880_ignore); |
| 5454 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5455 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5456 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5457 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5458 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5459 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5460 | if (err < 0) |
| 5461 | return err; |
| 5462 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5463 | if (err < 0) |
| 5464 | return err; |
| 5465 | err = alc880_auto_create_extra_out(spec, |
| 5466 | spec->autocfg.speaker_pins[0], |
| 5467 | "Speaker"); |
| 5468 | if (err < 0) |
| 5469 | return err; |
| 5470 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5471 | "Headphone"); |
| 5472 | if (err < 0) |
| 5473 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5474 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5475 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5476 | return err; |
| 5477 | |
| 5478 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5479 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5480 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5481 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5482 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5483 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5484 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5485 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5486 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5487 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5488 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5489 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5490 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5491 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5492 | return 1; |
| 5493 | } |
| 5494 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5495 | /* additional initialization for auto-configuration model */ |
| 5496 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5497 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5498 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5499 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5500 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5501 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5502 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5503 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5504 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5505 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5506 | } |
| 5507 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5508 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5509 | * one of two digital mic pins, e.g. on ALC272 |
| 5510 | */ |
| 5511 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5512 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5513 | struct alc_spec *spec = codec->spec; |
| 5514 | int i; |
| 5515 | |
| 5516 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5517 | hda_nid_t cap = spec->capsrc_nids ? |
| 5518 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5519 | int iidx, eidx; |
| 5520 | |
| 5521 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5522 | if (iidx < 0) |
| 5523 | continue; |
| 5524 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5525 | if (eidx < 0) |
| 5526 | continue; |
| 5527 | spec->int_mic.mux_idx = iidx; |
| 5528 | spec->ext_mic.mux_idx = eidx; |
| 5529 | if (spec->capsrc_nids) |
| 5530 | spec->capsrc_nids += i; |
| 5531 | spec->adc_nids += i; |
| 5532 | spec->num_adc_nids = 1; |
| 5533 | return; |
| 5534 | } |
| 5535 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5536 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5537 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5538 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5539 | } |
| 5540 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5541 | /* select or unmute the given capsrc route */ |
| 5542 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5543 | int idx) |
| 5544 | { |
| 5545 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5546 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5547 | HDA_AMP_MUTE, 0); |
| 5548 | } else { |
| 5549 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5550 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5551 | } |
| 5552 | } |
| 5553 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5554 | /* set the default connection to that pin */ |
| 5555 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5556 | { |
| 5557 | struct alc_spec *spec = codec->spec; |
| 5558 | int i; |
| 5559 | |
| 5560 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5561 | hda_nid_t cap = spec->capsrc_nids ? |
| 5562 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5563 | int idx; |
| 5564 | |
| 5565 | idx = get_connection_index(codec, cap, pin); |
| 5566 | if (idx < 0) |
| 5567 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5568 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5569 | return i; /* return the found index */ |
| 5570 | } |
| 5571 | return -1; /* not found */ |
| 5572 | } |
| 5573 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5574 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5575 | static void fixup_single_adc(struct hda_codec *codec) |
| 5576 | { |
| 5577 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5578 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5579 | int i; |
| 5580 | |
| 5581 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5582 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5583 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5584 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5585 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5586 | /* use only this ADC */ |
| 5587 | if (spec->capsrc_nids) |
| 5588 | spec->capsrc_nids += i; |
| 5589 | spec->adc_nids += i; |
| 5590 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5591 | } |
| 5592 | } |
| 5593 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5594 | /* initialize dual adcs */ |
| 5595 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5596 | { |
| 5597 | struct alc_spec *spec = codec->spec; |
| 5598 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5599 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5600 | } |
| 5601 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5602 | static void set_capture_mixer(struct hda_codec *codec) |
| 5603 | { |
| 5604 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5605 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5606 | { alc_capture_mixer_nosrc1, |
| 5607 | alc_capture_mixer_nosrc2, |
| 5608 | alc_capture_mixer_nosrc3 }, |
| 5609 | { alc_capture_mixer1, |
| 5610 | alc_capture_mixer2, |
| 5611 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5612 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5613 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5614 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5615 | int num_adcs = spec->num_adc_nids; |
| 5616 | if (spec->dual_adc_switch) |
| 5617 | fixup_dual_adc_switch(codec); |
| 5618 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5619 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5620 | else if (spec->input_mux) { |
| 5621 | if (spec->input_mux->num_items > 1) |
| 5622 | mux = 1; |
| 5623 | else if (spec->input_mux->num_items == 1) |
| 5624 | fixup_single_adc(codec); |
| 5625 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5626 | if (spec->dual_adc_switch) |
| 5627 | num_adcs = 1; |
| 5628 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5629 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5630 | } |
| 5631 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5632 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5633 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5634 | int num_nids) |
| 5635 | { |
| 5636 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5637 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5638 | int n; |
| 5639 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5640 | |
| 5641 | for (n = 0; n < num_nids; n++) { |
| 5642 | hda_nid_t adc, cap; |
| 5643 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5644 | int nconns, i, j; |
| 5645 | |
| 5646 | adc = nids[n]; |
| 5647 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5648 | continue; |
| 5649 | cap = adc; |
| 5650 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5651 | ARRAY_SIZE(conn)); |
| 5652 | if (nconns == 1) { |
| 5653 | cap = conn[0]; |
| 5654 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5655 | ARRAY_SIZE(conn)); |
| 5656 | } |
| 5657 | if (nconns <= 0) |
| 5658 | continue; |
| 5659 | if (!fallback_adc) { |
| 5660 | fallback_adc = adc; |
| 5661 | fallback_cap = cap; |
| 5662 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5663 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5664 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5665 | for (j = 0; j < nconns; j++) { |
| 5666 | if (conn[j] == nid) |
| 5667 | break; |
| 5668 | } |
| 5669 | if (j >= nconns) |
| 5670 | break; |
| 5671 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5672 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5673 | int num_adcs = spec->num_adc_nids; |
| 5674 | spec->private_adc_nids[num_adcs] = adc; |
| 5675 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5676 | spec->num_adc_nids++; |
| 5677 | spec->adc_nids = spec->private_adc_nids; |
| 5678 | if (adc != cap) |
| 5679 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5680 | } |
| 5681 | } |
| 5682 | if (!spec->num_adc_nids) { |
| 5683 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5684 | " using fallback 0x%x\n", |
| 5685 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5686 | spec->private_adc_nids[0] = fallback_adc; |
| 5687 | spec->adc_nids = spec->private_adc_nids; |
| 5688 | if (fallback_adc != fallback_cap) { |
| 5689 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5690 | spec->capsrc_nids = spec->private_adc_nids; |
| 5691 | } |
| 5692 | } |
| 5693 | } |
| 5694 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5695 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5696 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5697 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5698 | |
| 5699 | static struct snd_pci_quirk beep_white_list[] = { |
| 5700 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5701 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5702 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5703 | {} |
| 5704 | }; |
| 5705 | |
| 5706 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5707 | { |
| 5708 | struct alc_spec *spec = codec->spec; |
| 5709 | const struct snd_pci_quirk *q; |
| 5710 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5711 | if (q) |
| 5712 | return q->value; |
| 5713 | return spec->cdefine.enable_pcbeep; |
| 5714 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5715 | #else |
| 5716 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5717 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5718 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5719 | |
| 5720 | /* |
| 5721 | * OK, here we have finally the patch for ALC880 |
| 5722 | */ |
| 5723 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5724 | static int patch_alc880(struct hda_codec *codec) |
| 5725 | { |
| 5726 | struct alc_spec *spec; |
| 5727 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5728 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5729 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5730 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5731 | if (spec == NULL) |
| 5732 | return -ENOMEM; |
| 5733 | |
| 5734 | codec->spec = spec; |
| 5735 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5736 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5737 | alc880_models, |
| 5738 | alc880_cfg_tbl); |
| 5739 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5740 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5741 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5742 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5743 | } |
| 5744 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5745 | if (board_config == ALC880_AUTO) { |
| 5746 | /* automatic parse from the BIOS config */ |
| 5747 | err = alc880_parse_auto_config(codec); |
| 5748 | if (err < 0) { |
| 5749 | alc_free(codec); |
| 5750 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5751 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5752 | printk(KERN_INFO |
| 5753 | "hda_codec: Cannot set up configuration " |
| 5754 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5755 | board_config = ALC880_3ST; |
| 5756 | } |
| 5757 | } |
| 5758 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5759 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5760 | if (err < 0) { |
| 5761 | alc_free(codec); |
| 5762 | return err; |
| 5763 | } |
| 5764 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5765 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5766 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5767 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5768 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5769 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5770 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5771 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5772 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5773 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5774 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5775 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5776 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5777 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5778 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5779 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5780 | if (wcap != AC_WID_AUD_IN) { |
| 5781 | spec->adc_nids = alc880_adc_nids_alt; |
| 5782 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5783 | } else { |
| 5784 | spec->adc_nids = alc880_adc_nids; |
| 5785 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5786 | } |
| 5787 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5788 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5789 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5790 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5791 | spec->vmaster_nid = 0x0c; |
| 5792 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5793 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5794 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5795 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5796 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5797 | if (!spec->loopback.amplist) |
| 5798 | spec->loopback.amplist = alc880_loopbacks; |
| 5799 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5800 | |
| 5801 | return 0; |
| 5802 | } |
| 5803 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5804 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5805 | /* |
| 5806 | * ALC260 support |
| 5807 | */ |
| 5808 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5809 | static hda_nid_t alc260_dac_nids[1] = { |
| 5810 | /* front */ |
| 5811 | 0x02, |
| 5812 | }; |
| 5813 | |
| 5814 | static hda_nid_t alc260_adc_nids[1] = { |
| 5815 | /* ADC0 */ |
| 5816 | 0x04, |
| 5817 | }; |
| 5818 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5819 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5820 | /* ADC1 */ |
| 5821 | 0x05, |
| 5822 | }; |
| 5823 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5824 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5825 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5826 | */ |
| 5827 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5828 | /* ADC0, ADC1 */ |
| 5829 | 0x04, 0x05 |
| 5830 | }; |
| 5831 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5832 | #define ALC260_DIGOUT_NID 0x03 |
| 5833 | #define ALC260_DIGIN_NID 0x06 |
| 5834 | |
| 5835 | static struct hda_input_mux alc260_capture_source = { |
| 5836 | .num_items = 4, |
| 5837 | .items = { |
| 5838 | { "Mic", 0x0 }, |
| 5839 | { "Front Mic", 0x1 }, |
| 5840 | { "Line", 0x2 }, |
| 5841 | { "CD", 0x4 }, |
| 5842 | }, |
| 5843 | }; |
| 5844 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5845 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5846 | * headphone jack and the internal CD lines since these are the only pins at |
| 5847 | * which audio can appear. For flexibility, also allow the option of |
| 5848 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5849 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5850 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5851 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5852 | { |
| 5853 | .num_items = 3, |
| 5854 | .items = { |
| 5855 | { "Mic/Line", 0x0 }, |
| 5856 | { "CD", 0x4 }, |
| 5857 | { "Headphone", 0x2 }, |
| 5858 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5859 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5860 | { |
| 5861 | .num_items = 4, |
| 5862 | .items = { |
| 5863 | { "Mic/Line", 0x0 }, |
| 5864 | { "CD", 0x4 }, |
| 5865 | { "Headphone", 0x2 }, |
| 5866 | { "Mixer", 0x5 }, |
| 5867 | }, |
| 5868 | }, |
| 5869 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5870 | }; |
| 5871 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5872 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5873 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5874 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5875 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5876 | { |
| 5877 | .num_items = 4, |
| 5878 | .items = { |
| 5879 | { "Mic", 0x0 }, |
| 5880 | { "Line", 0x2 }, |
| 5881 | { "CD", 0x4 }, |
| 5882 | { "Headphone", 0x5 }, |
| 5883 | }, |
| 5884 | }, |
| 5885 | { |
| 5886 | .num_items = 5, |
| 5887 | .items = { |
| 5888 | { "Mic", 0x0 }, |
| 5889 | { "Line", 0x2 }, |
| 5890 | { "CD", 0x4 }, |
| 5891 | { "Headphone", 0x6 }, |
| 5892 | { "Mixer", 0x5 }, |
| 5893 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5894 | }, |
| 5895 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5896 | |
| 5897 | /* Maxdata Favorit 100XS */ |
| 5898 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5899 | { |
| 5900 | .num_items = 2, |
| 5901 | .items = { |
| 5902 | { "Line/Mic", 0x0 }, |
| 5903 | { "CD", 0x4 }, |
| 5904 | }, |
| 5905 | }, |
| 5906 | { |
| 5907 | .num_items = 3, |
| 5908 | .items = { |
| 5909 | { "Line/Mic", 0x0 }, |
| 5910 | { "CD", 0x4 }, |
| 5911 | { "Mixer", 0x5 }, |
| 5912 | }, |
| 5913 | }, |
| 5914 | }; |
| 5915 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5916 | /* |
| 5917 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5918 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5919 | * element which allows changing the channel mode, so the verb list is |
| 5920 | * never used. |
| 5921 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5922 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5923 | { 2, NULL }, |
| 5924 | }; |
| 5925 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5926 | |
| 5927 | /* Mixer combinations |
| 5928 | * |
| 5929 | * basic: base_output + input + pc_beep + capture |
| 5930 | * HP: base_output + input + capture_alt |
| 5931 | * HP_3013: hp_3013 + input + capture |
| 5932 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5933 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5934 | */ |
| 5935 | |
| 5936 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5937 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5938 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5939 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5940 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5941 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5942 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5943 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5944 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5945 | |
| 5946 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5948 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5950 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5953 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5954 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5955 | { } /* end */ |
| 5956 | }; |
| 5957 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5958 | /* update HP, line and mono out pins according to the master switch */ |
| 5959 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5960 | hda_nid_t hp, hda_nid_t line, |
| 5961 | hda_nid_t mono) |
| 5962 | { |
| 5963 | struct alc_spec *spec = codec->spec; |
| 5964 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5965 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5966 | 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] | 5967 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5968 | 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] | 5969 | val); |
| 5970 | /* mono (speaker) depending on the HP jack sense */ |
| 5971 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5972 | 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] | 5973 | val); |
| 5974 | } |
| 5975 | |
| 5976 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5977 | struct snd_ctl_elem_value *ucontrol) |
| 5978 | { |
| 5979 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5980 | struct alc_spec *spec = codec->spec; |
| 5981 | *ucontrol->value.integer.value = spec->master_sw; |
| 5982 | return 0; |
| 5983 | } |
| 5984 | |
| 5985 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5986 | struct snd_ctl_elem_value *ucontrol) |
| 5987 | { |
| 5988 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5989 | struct alc_spec *spec = codec->spec; |
| 5990 | int val = !!*ucontrol->value.integer.value; |
| 5991 | hda_nid_t hp, line, mono; |
| 5992 | |
| 5993 | if (val == spec->master_sw) |
| 5994 | return 0; |
| 5995 | spec->master_sw = val; |
| 5996 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5997 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5998 | mono = kcontrol->private_value & 0xff; |
| 5999 | alc260_hp_master_update(codec, hp, line, mono); |
| 6000 | return 1; |
| 6001 | } |
| 6002 | |
| 6003 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 6004 | { |
| 6005 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6006 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6007 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6008 | .info = snd_ctl_boolean_mono_info, |
| 6009 | .get = alc260_hp_master_sw_get, |
| 6010 | .put = alc260_hp_master_sw_put, |
| 6011 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 6012 | }, |
| 6013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6014 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6015 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6016 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6017 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6018 | HDA_OUTPUT), |
| 6019 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6020 | { } /* end */ |
| 6021 | }; |
| 6022 | |
| 6023 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 6024 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6025 | {}, |
| 6026 | }; |
| 6027 | |
| 6028 | static void alc260_hp_automute(struct hda_codec *codec) |
| 6029 | { |
| 6030 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6031 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6032 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6033 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 6034 | } |
| 6035 | |
| 6036 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6037 | { |
| 6038 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6039 | alc260_hp_automute(codec); |
| 6040 | } |
| 6041 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6042 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6043 | { |
| 6044 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6045 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6046 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6047 | .info = snd_ctl_boolean_mono_info, |
| 6048 | .get = alc260_hp_master_sw_get, |
| 6049 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6050 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6051 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6052 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6053 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6054 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6055 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6058 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6059 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6060 | { } /* end */ |
| 6061 | }; |
| 6062 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6063 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6064 | .ops = &snd_hda_bind_vol, |
| 6065 | .values = { |
| 6066 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6067 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6068 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6069 | 0 |
| 6070 | }, |
| 6071 | }; |
| 6072 | |
| 6073 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6074 | .ops = &snd_hda_bind_sw, |
| 6075 | .values = { |
| 6076 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6077 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6078 | 0 |
| 6079 | }, |
| 6080 | }; |
| 6081 | |
| 6082 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6083 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6084 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6085 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6086 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6087 | { } /* end */ |
| 6088 | }; |
| 6089 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6090 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6091 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6092 | {}, |
| 6093 | }; |
| 6094 | |
| 6095 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 6096 | { |
| 6097 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6098 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6099 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6100 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6101 | } |
| 6102 | |
| 6103 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6104 | unsigned int res) |
| 6105 | { |
| 6106 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6107 | alc260_hp_3013_automute(codec); |
| 6108 | } |
| 6109 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6110 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6111 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6112 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6113 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6114 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6115 | bits); |
| 6116 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6117 | bits); |
| 6118 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6119 | bits); |
| 6120 | } |
| 6121 | |
| 6122 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6123 | unsigned int res) |
| 6124 | { |
| 6125 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6126 | alc260_hp_3012_automute(codec); |
| 6127 | } |
| 6128 | |
| 6129 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6130 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6131 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6132 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6133 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6134 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6135 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6136 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6137 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6138 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6139 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6140 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6141 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6142 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6143 | { } /* end */ |
| 6144 | }; |
| 6145 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6146 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6147 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6148 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6149 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6150 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6151 | * revisions available in early 2006. Therefore for now allow the |
| 6152 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6153 | * that the lack of mic bias for this NID is intentional we could change the |
| 6154 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6155 | * |
| 6156 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6157 | * don't appear to make the mic bias available from the "line" jack, even |
| 6158 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6159 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6160 | * and the output jack. If this turns out to be the case for all such |
| 6161 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6162 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6163 | * |
| 6164 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6165 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6166 | * controls for such models. On models without a "mono speaker" the control |
| 6167 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6168 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6169 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6170 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6171 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6172 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6173 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6174 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6175 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6176 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6177 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6178 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6181 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6182 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6183 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6184 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6185 | { } /* end */ |
| 6186 | }; |
| 6187 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6188 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6189 | */ |
| 6190 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6191 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6192 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6193 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6194 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6195 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6196 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6197 | { } /* end */ |
| 6198 | }; |
| 6199 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6200 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6201 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6202 | */ |
| 6203 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6204 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6205 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6208 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6209 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6210 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6211 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6213 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6214 | { } /* end */ |
| 6215 | }; |
| 6216 | |
| 6217 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6218 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6219 | */ |
| 6220 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6221 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6222 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6225 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6226 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6227 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6228 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6229 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6230 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6231 | { } /* end */ |
| 6232 | }; |
| 6233 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6234 | /* |
| 6235 | * initialization verbs |
| 6236 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6237 | static struct hda_verb alc260_init_verbs[] = { |
| 6238 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6240 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6241 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6242 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6243 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6244 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6245 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6246 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6248 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6249 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6250 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6251 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6252 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6253 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6254 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6255 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6256 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6257 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6258 | /* set connection select to line in (default select for this ADC) */ |
| 6259 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6260 | /* mute capture amp left and right */ |
| 6261 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6262 | /* set connection select to line in (default select for this ADC) */ |
| 6263 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6264 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6266 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6267 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6268 | /* set vol=0 HP mixer amp left and right */ |
| 6269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6270 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6271 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6272 | /* set vol=0 Mono mixer amp left and right */ |
| 6273 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6274 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6275 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6276 | /* unmute LINE-2 out pin */ |
| 6277 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6278 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6279 | * Line In 2 = 0x03 |
| 6280 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6281 | /* mute analog inputs */ |
| 6282 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6284 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6285 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6287 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6288 | /* mute Front out path */ |
| 6289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6291 | /* mute Headphone out path */ |
| 6292 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6294 | /* mute Mono out path */ |
| 6295 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6296 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6297 | { } |
| 6298 | }; |
| 6299 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6300 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6301 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6302 | /* Headphone and output */ |
| 6303 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6304 | /* mono output */ |
| 6305 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6306 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6307 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6308 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6309 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6310 | /* Line In pin widget for input */ |
| 6311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6312 | /* Line-2 pin widget for output */ |
| 6313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6314 | /* CD pin widget for input */ |
| 6315 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6316 | /* unmute amp left and right */ |
| 6317 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6318 | /* set connection select to line in (default select for this ADC) */ |
| 6319 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6320 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6321 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6322 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6323 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6324 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6325 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6326 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6327 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6328 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6329 | * Line In 2 = 0x03 |
| 6330 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6331 | /* mute analog inputs */ |
| 6332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6337 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6338 | /* Unmute Front out path */ |
| 6339 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6340 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6341 | /* Unmute Headphone out path */ |
| 6342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6344 | /* Unmute Mono out path */ |
| 6345 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6346 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6347 | { } |
| 6348 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6349 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6350 | |
| 6351 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6352 | /* Line out and output */ |
| 6353 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6354 | /* mono output */ |
| 6355 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6356 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6357 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6358 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6359 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6360 | /* Line In pin widget for input */ |
| 6361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6362 | /* Headphone pin widget for output */ |
| 6363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6364 | /* CD pin widget for input */ |
| 6365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6366 | /* unmute amp left and right */ |
| 6367 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6368 | /* set connection select to line in (default select for this ADC) */ |
| 6369 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6370 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6371 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6372 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6373 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6374 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6376 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6377 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6378 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6379 | * Line In 2 = 0x03 |
| 6380 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6381 | /* mute analog inputs */ |
| 6382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6387 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6388 | /* Unmute Front out path */ |
| 6389 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6391 | /* Unmute Headphone out path */ |
| 6392 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6393 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6394 | /* Unmute Mono out path */ |
| 6395 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6396 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6397 | { } |
| 6398 | }; |
| 6399 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6400 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6401 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6402 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6403 | */ |
| 6404 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6405 | /* Disable all GPIOs */ |
| 6406 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6407 | /* Internal speaker is connected to headphone pin */ |
| 6408 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6409 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6411 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6412 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6413 | /* Ensure all other unused pins are disabled and muted. */ |
| 6414 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6415 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6416 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6417 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6418 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6419 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6420 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6421 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6422 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6423 | /* Disable digital (SPDIF) pins */ |
| 6424 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6425 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6426 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6427 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6428 | * when acting as an output. |
| 6429 | */ |
| 6430 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6431 | |
| 6432 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6435 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6436 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6438 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6439 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6440 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6441 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6442 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6443 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6444 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6445 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6446 | * If the pin mode is changed by the user the pin mode control will |
| 6447 | * take care of enabling the pin's input/output buffers as needed. |
| 6448 | * Therefore there's no need to enable the input buffer at this |
| 6449 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6450 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6451 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6452 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6453 | * mixer ctrl) |
| 6454 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6455 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6456 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6457 | /* Mute capture amp left and right */ |
| 6458 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6459 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6460 | * in (on mic1 pin) |
| 6461 | */ |
| 6462 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6463 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6464 | /* Do the same for the second ADC: mute capture input amp and |
| 6465 | * set ADC connection to line in (on mic1 pin) |
| 6466 | */ |
| 6467 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6468 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6469 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6470 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6471 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6472 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6473 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6474 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6475 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6476 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6477 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6478 | {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] | 6479 | |
| 6480 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6481 | }; |
| 6482 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6483 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6484 | * similar laptops (adapted from Fujitsu init verbs). |
| 6485 | */ |
| 6486 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6487 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6488 | * the headphone jack. Turn this on and rely on the standard mute |
| 6489 | * methods whenever the user wants to turn these outputs off. |
| 6490 | */ |
| 6491 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6492 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6493 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6494 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6495 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6496 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6497 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6498 | /* Line In jack is connected to Line1 pin */ |
| 6499 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6500 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6501 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6502 | /* Ensure all other unused pins are disabled and muted. */ |
| 6503 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6504 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6505 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6506 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6508 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6509 | /* Disable digital (SPDIF) pins */ |
| 6510 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6511 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6512 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6513 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6514 | * bus when acting as outputs. |
| 6515 | */ |
| 6516 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6517 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6518 | |
| 6519 | /* Start with output sum widgets muted and their output gains at min */ |
| 6520 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6521 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6522 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6523 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6524 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6525 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6526 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6527 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6528 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6529 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6530 | /* Unmute Line-out pin widget amp left and right |
| 6531 | * (no equiv mixer ctrl) |
| 6532 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6533 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6534 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6535 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6536 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6537 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6538 | * will take care of enabling the pin's input/output buffers as needed. |
| 6539 | * Therefore there's no need to enable the input buffer at this |
| 6540 | * stage. |
| 6541 | */ |
| 6542 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6543 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6544 | |
| 6545 | /* Mute capture amp left and right */ |
| 6546 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6547 | /* Set ADC connection select to match default mixer setting - mic |
| 6548 | * (on mic1 pin) |
| 6549 | */ |
| 6550 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6551 | |
| 6552 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6553 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6554 | */ |
| 6555 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6556 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6557 | |
| 6558 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6559 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6560 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6561 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6566 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6567 | |
| 6568 | { } |
| 6569 | }; |
| 6570 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6571 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6572 | * (adapted from Acer init verbs). |
| 6573 | */ |
| 6574 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6575 | /* GPIO 0 enables the output jack. |
| 6576 | * Turn this on and rely on the standard mute |
| 6577 | * methods whenever the user wants to turn these outputs off. |
| 6578 | */ |
| 6579 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6580 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6581 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6582 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6583 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6584 | /* Ensure all other unused pins are disabled and muted. */ |
| 6585 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6586 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6587 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6588 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6589 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6590 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6591 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6593 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6594 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6595 | /* Disable digital (SPDIF) pins */ |
| 6596 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6597 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6598 | |
| 6599 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6600 | * bus when acting as outputs. |
| 6601 | */ |
| 6602 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6603 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6604 | |
| 6605 | /* Start with output sum widgets muted and their output gains at min */ |
| 6606 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6607 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6608 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6609 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6610 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6611 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6612 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6613 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6614 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6615 | |
| 6616 | /* Unmute Line-out pin widget amp left and right |
| 6617 | * (no equiv mixer ctrl) |
| 6618 | */ |
| 6619 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6620 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6621 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6622 | * will take care of enabling the pin's input/output buffers as needed. |
| 6623 | * Therefore there's no need to enable the input buffer at this |
| 6624 | * stage. |
| 6625 | */ |
| 6626 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6627 | |
| 6628 | /* Mute capture amp left and right */ |
| 6629 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6630 | /* Set ADC connection select to match default mixer setting - mic |
| 6631 | * (on mic1 pin) |
| 6632 | */ |
| 6633 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6634 | |
| 6635 | /* Do similar with the second ADC: mute capture input amp and |
| 6636 | * set ADC connection to mic to match ALSA's default state. |
| 6637 | */ |
| 6638 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6639 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6640 | |
| 6641 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6650 | |
| 6651 | { } |
| 6652 | }; |
| 6653 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6654 | static struct hda_verb alc260_will_verbs[] = { |
| 6655 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6656 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6657 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6658 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6659 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6660 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6661 | {} |
| 6662 | }; |
| 6663 | |
| 6664 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6665 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6666 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6667 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6668 | |
| 6669 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6670 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6671 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6672 | |
| 6673 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6674 | {} |
| 6675 | }; |
| 6676 | |
| 6677 | /* toggle speaker-output according to the hp-jack state */ |
| 6678 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6679 | { |
| 6680 | unsigned int present; |
| 6681 | |
| 6682 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6683 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6684 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6685 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6686 | AC_VERB_SET_GPIO_DATA, 1); |
| 6687 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6688 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6689 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6690 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6691 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6692 | AC_VERB_SET_GPIO_DATA, 0); |
| 6693 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6694 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6695 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6696 | } |
| 6697 | } |
| 6698 | |
| 6699 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6700 | unsigned int res) |
| 6701 | { |
| 6702 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6703 | alc260_replacer_672v_automute(codec); |
| 6704 | } |
| 6705 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6706 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6707 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6708 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6709 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6710 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6711 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6712 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6713 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6714 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6715 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6716 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6717 | {} |
| 6718 | }; |
| 6719 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6720 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6721 | * configuration. |
| 6722 | */ |
| 6723 | #ifdef CONFIG_SND_DEBUG |
| 6724 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6725 | 0x02, |
| 6726 | }; |
| 6727 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6728 | 0x04, 0x05, |
| 6729 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6730 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6731 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6732 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6733 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6734 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6735 | { |
| 6736 | .num_items = 7, |
| 6737 | .items = { |
| 6738 | { "MIC1 pin", 0x0 }, |
| 6739 | { "MIC2 pin", 0x1 }, |
| 6740 | { "LINE1 pin", 0x2 }, |
| 6741 | { "LINE2 pin", 0x3 }, |
| 6742 | { "CD pin", 0x4 }, |
| 6743 | { "LINE-OUT pin", 0x5 }, |
| 6744 | { "HP-OUT pin", 0x6 }, |
| 6745 | }, |
| 6746 | }, |
| 6747 | { |
| 6748 | .num_items = 8, |
| 6749 | .items = { |
| 6750 | { "MIC1 pin", 0x0 }, |
| 6751 | { "MIC2 pin", 0x1 }, |
| 6752 | { "LINE1 pin", 0x2 }, |
| 6753 | { "LINE2 pin", 0x3 }, |
| 6754 | { "CD pin", 0x4 }, |
| 6755 | { "Mixer", 0x5 }, |
| 6756 | { "LINE-OUT pin", 0x6 }, |
| 6757 | { "HP-OUT pin", 0x7 }, |
| 6758 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6759 | }, |
| 6760 | }; |
| 6761 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6762 | /* Output driver widgets */ |
| 6763 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6764 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6765 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6766 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6767 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6768 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6769 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6770 | /* Modes for retasking pin widgets |
| 6771 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6772 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6773 | * mention this restriction. At this stage it's not clear whether |
| 6774 | * this behaviour is intentional or is a hardware bug in chip |
| 6775 | * revisions available at least up until early 2006. Therefore for |
| 6776 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6777 | * choices, but if it turns out that the lack of mic bias for these |
| 6778 | * NIDs is intentional we could change their modes from |
| 6779 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6780 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6781 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6782 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6783 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6784 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6785 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6786 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6787 | |
| 6788 | /* Loopback mixer controls */ |
| 6789 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6790 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6791 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6792 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6793 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6794 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6795 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6796 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6797 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6798 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6799 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6802 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6803 | |
| 6804 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6805 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6806 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6807 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6808 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6809 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6810 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6811 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6812 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6813 | */ |
| 6814 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6815 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6816 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6817 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6818 | * this output to turn on an external amplifier. |
| 6819 | */ |
| 6820 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6821 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6822 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6823 | { } /* end */ |
| 6824 | }; |
| 6825 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6826 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6827 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6828 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6829 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6830 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6831 | /* Enable retasking pins as output, initially without power amp */ |
| 6832 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6833 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6835 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6836 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6837 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6838 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6839 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6840 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6841 | * payload also sets the generation to 0, output to be in "consumer" |
| 6842 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6843 | * control. |
| 6844 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6845 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6846 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6847 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6848 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6849 | * OUT1 sum bus when acting as an output. |
| 6850 | */ |
| 6851 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6852 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6853 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6854 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6855 | |
| 6856 | /* Start with output sum widgets muted and their output gains at min */ |
| 6857 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6858 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6859 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6860 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6861 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6862 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6863 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6864 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6865 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6866 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6867 | /* Unmute retasking pin widget output buffers since the default |
| 6868 | * state appears to be output. As the pin mode is changed by the |
| 6869 | * user the pin mode control will take care of enabling the pin's |
| 6870 | * input/output buffers as needed. |
| 6871 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6872 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6873 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6875 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6876 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6877 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6878 | /* Also unmute the mono-out pin widget */ |
| 6879 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6880 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6881 | /* Mute capture amp left and right */ |
| 6882 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6883 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6884 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6885 | */ |
| 6886 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6887 | |
| 6888 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6889 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6890 | */ |
| 6891 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6892 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6893 | |
| 6894 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6895 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6903 | |
| 6904 | { } |
| 6905 | }; |
| 6906 | #endif |
| 6907 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6908 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6909 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6910 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6911 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6912 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6913 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6914 | /* |
| 6915 | * for BIOS auto-configuration |
| 6916 | */ |
| 6917 | |
| 6918 | 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] | 6919 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6920 | { |
| 6921 | hda_nid_t nid_vol; |
| 6922 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6923 | int err; |
| 6924 | |
| 6925 | if (nid >= 0x0f && nid < 0x11) { |
| 6926 | nid_vol = nid - 0x7; |
| 6927 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6928 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6929 | } else if (nid == 0x11) { |
| 6930 | nid_vol = nid - 0x7; |
| 6931 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6932 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6933 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6934 | nid_vol = 0x08; |
| 6935 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6936 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6937 | } else |
| 6938 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6939 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6940 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6941 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6942 | 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] | 6943 | if (err < 0) |
| 6944 | return err; |
| 6945 | *vol_bits |= (1 << nid_vol); |
| 6946 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6947 | 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] | 6948 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6949 | return err; |
| 6950 | return 1; |
| 6951 | } |
| 6952 | |
| 6953 | /* add playback controls from the parsed DAC table */ |
| 6954 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6955 | const struct auto_pin_cfg *cfg) |
| 6956 | { |
| 6957 | hda_nid_t nid; |
| 6958 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6959 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6960 | |
| 6961 | spec->multiout.num_dacs = 1; |
| 6962 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6963 | spec->multiout.dac_nids[0] = 0x02; |
| 6964 | |
| 6965 | nid = cfg->line_out_pins[0]; |
| 6966 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6967 | const char *pfx; |
| 6968 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6969 | pfx = "Master"; |
| 6970 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6971 | pfx = "Speaker"; |
| 6972 | else |
| 6973 | pfx = "Front"; |
| 6974 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6975 | if (err < 0) |
| 6976 | return err; |
| 6977 | } |
| 6978 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6979 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6980 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6981 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6982 | if (err < 0) |
| 6983 | return err; |
| 6984 | } |
| 6985 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6986 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6987 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6988 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6989 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6990 | if (err < 0) |
| 6991 | return err; |
| 6992 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6993 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6994 | } |
| 6995 | |
| 6996 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6997 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6998 | const struct auto_pin_cfg *cfg) |
| 6999 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7000 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7001 | } |
| 7002 | |
| 7003 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7004 | hda_nid_t nid, int pin_type, |
| 7005 | int sel_idx) |
| 7006 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7007 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7008 | /* need the manual connection? */ |
| 7009 | if (nid >= 0x12) { |
| 7010 | int idx = nid - 0x12; |
| 7011 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7012 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7013 | } |
| 7014 | } |
| 7015 | |
| 7016 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7017 | { |
| 7018 | struct alc_spec *spec = codec->spec; |
| 7019 | hda_nid_t nid; |
| 7020 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7021 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7022 | if (nid) { |
| 7023 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7024 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7025 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7026 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7027 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7028 | if (nid) |
| 7029 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7030 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7031 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7032 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7033 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7034 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7035 | |
| 7036 | #define ALC260_PIN_CD_NID 0x16 |
| 7037 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 7038 | { |
| 7039 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7040 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7041 | int i; |
| 7042 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7043 | for (i = 0; i < cfg->num_inputs; i++) { |
| 7044 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7045 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 7046 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 7047 | if (nid != ALC260_PIN_CD_NID && |
| 7048 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7049 | snd_hda_codec_write(codec, nid, 0, |
| 7050 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7051 | AMP_OUT_MUTE); |
| 7052 | } |
| 7053 | } |
| 7054 | } |
| 7055 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7056 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7057 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7058 | /* |
| 7059 | * generic initialization of ADC, input mixers and output mixers |
| 7060 | */ |
| 7061 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7062 | /* |
| 7063 | * Unmute ADC0-1 and set the default input to mic-in |
| 7064 | */ |
| 7065 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7066 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7067 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7068 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7069 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7070 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7071 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7072 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7073 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7074 | */ |
| 7075 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7076 | /* mute analog inputs */ |
| 7077 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7079 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7082 | |
| 7083 | /* |
| 7084 | * Set up output mixers (0x08 - 0x0a) |
| 7085 | */ |
| 7086 | /* set vol=0 to output mixers */ |
| 7087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7088 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7089 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7090 | /* set up input amps for analog loopback */ |
| 7091 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7092 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7093 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7095 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7097 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7098 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7099 | { } |
| 7100 | }; |
| 7101 | |
| 7102 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7103 | { |
| 7104 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7105 | int err; |
| 7106 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7107 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7108 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7109 | alc260_ignore); |
| 7110 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7111 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7112 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7113 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7114 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7115 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7116 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7117 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7118 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7119 | return err; |
| 7120 | |
| 7121 | spec->multiout.max_channels = 2; |
| 7122 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7123 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7124 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7125 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7126 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7127 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7128 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7129 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7130 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7131 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7132 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7133 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7134 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7135 | return 1; |
| 7136 | } |
| 7137 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7138 | /* additional initialization for auto-configuration model */ |
| 7139 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7140 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7141 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7142 | alc260_auto_init_multi_out(codec); |
| 7143 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7144 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7145 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7146 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7147 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7148 | } |
| 7149 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7150 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7151 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7152 | { 0x07, HDA_INPUT, 0 }, |
| 7153 | { 0x07, HDA_INPUT, 1 }, |
| 7154 | { 0x07, HDA_INPUT, 2 }, |
| 7155 | { 0x07, HDA_INPUT, 3 }, |
| 7156 | { 0x07, HDA_INPUT, 4 }, |
| 7157 | { } /* end */ |
| 7158 | }; |
| 7159 | #endif |
| 7160 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7161 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7162 | * Pin config fixes |
| 7163 | */ |
| 7164 | enum { |
| 7165 | PINFIX_HP_DC5750, |
| 7166 | }; |
| 7167 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7168 | static const struct alc_fixup alc260_fixups[] = { |
| 7169 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7170 | .type = ALC_FIXUP_PINS, |
| 7171 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7172 | { 0x11, 0x90130110 }, /* speaker */ |
| 7173 | { } |
| 7174 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7175 | }, |
| 7176 | }; |
| 7177 | |
| 7178 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7179 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7180 | {} |
| 7181 | }; |
| 7182 | |
| 7183 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7184 | * ALC260 configurations |
| 7185 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7186 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7187 | [ALC260_BASIC] = "basic", |
| 7188 | [ALC260_HP] = "hp", |
| 7189 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7190 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7191 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7192 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7193 | [ALC260_WILL] = "will", |
| 7194 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7195 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7196 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7197 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7198 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7199 | [ALC260_AUTO] = "auto", |
| 7200 | }; |
| 7201 | |
| 7202 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7203 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7204 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7205 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7206 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7207 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7208 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7209 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7210 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7211 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7212 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7213 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7214 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7215 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7216 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7217 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7218 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7219 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7220 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7221 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7222 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7223 | {} |
| 7224 | }; |
| 7225 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7226 | static struct alc_config_preset alc260_presets[] = { |
| 7227 | [ALC260_BASIC] = { |
| 7228 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7229 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7230 | .init_verbs = { alc260_init_verbs }, |
| 7231 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7232 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7233 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 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, |
| 7237 | .input_mux = &alc260_capture_source, |
| 7238 | }, |
| 7239 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7240 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7241 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7242 | .init_verbs = { alc260_init_verbs, |
| 7243 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7244 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7245 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7246 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7247 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7248 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7249 | .channel_mode = alc260_modes, |
| 7250 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7251 | .unsol_event = alc260_hp_unsol_event, |
| 7252 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7253 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7254 | [ALC260_HP_DC7600] = { |
| 7255 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7256 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7257 | .init_verbs = { alc260_init_verbs, |
| 7258 | alc260_hp_dc7600_verbs }, |
| 7259 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7260 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7261 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7262 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7263 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7264 | .channel_mode = alc260_modes, |
| 7265 | .input_mux = &alc260_capture_source, |
| 7266 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7267 | .init_hook = alc260_hp_3012_automute, |
| 7268 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7269 | [ALC260_HP_3013] = { |
| 7270 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7271 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7272 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7273 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7274 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7275 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7276 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7277 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7278 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7279 | .channel_mode = alc260_modes, |
| 7280 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7281 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7282 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7283 | }, |
| 7284 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7285 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7286 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7287 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7288 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7289 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7290 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7291 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7292 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7293 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7294 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7295 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7296 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7297 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7298 | .init_verbs = { alc260_acer_init_verbs }, |
| 7299 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7300 | .dac_nids = alc260_dac_nids, |
| 7301 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7302 | .adc_nids = alc260_dual_adc_nids, |
| 7303 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7304 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7305 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7306 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7307 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7308 | [ALC260_FAVORIT100] = { |
| 7309 | .mixers = { alc260_favorit100_mixer }, |
| 7310 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7311 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7312 | .dac_nids = alc260_dac_nids, |
| 7313 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7314 | .adc_nids = alc260_dual_adc_nids, |
| 7315 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7316 | .channel_mode = alc260_modes, |
| 7317 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7318 | .input_mux = alc260_favorit100_capture_sources, |
| 7319 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7320 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7321 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7322 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7323 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7324 | .dac_nids = alc260_dac_nids, |
| 7325 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7326 | .adc_nids = alc260_adc_nids, |
| 7327 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7328 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7329 | .channel_mode = alc260_modes, |
| 7330 | .input_mux = &alc260_capture_source, |
| 7331 | }, |
| 7332 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7333 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7334 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7335 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7336 | .dac_nids = alc260_dac_nids, |
| 7337 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7338 | .adc_nids = alc260_adc_nids, |
| 7339 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7340 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7341 | .channel_mode = alc260_modes, |
| 7342 | .input_mux = &alc260_capture_source, |
| 7343 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7344 | .init_hook = alc260_replacer_672v_automute, |
| 7345 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7346 | #ifdef CONFIG_SND_DEBUG |
| 7347 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7348 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7349 | .init_verbs = { alc260_test_init_verbs }, |
| 7350 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7351 | .dac_nids = alc260_test_dac_nids, |
| 7352 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7353 | .adc_nids = alc260_test_adc_nids, |
| 7354 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7355 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7356 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7357 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7358 | }, |
| 7359 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7360 | }; |
| 7361 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7362 | static int patch_alc260(struct hda_codec *codec) |
| 7363 | { |
| 7364 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7365 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7366 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7367 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7368 | if (spec == NULL) |
| 7369 | return -ENOMEM; |
| 7370 | |
| 7371 | codec->spec = spec; |
| 7372 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7373 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7374 | alc260_models, |
| 7375 | alc260_cfg_tbl); |
| 7376 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7377 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7378 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7379 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7380 | } |
| 7381 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7382 | if (board_config == ALC260_AUTO) { |
| 7383 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7384 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7385 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7386 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7387 | if (board_config == ALC260_AUTO) { |
| 7388 | /* automatic parse from the BIOS config */ |
| 7389 | err = alc260_parse_auto_config(codec); |
| 7390 | if (err < 0) { |
| 7391 | alc_free(codec); |
| 7392 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7393 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7394 | printk(KERN_INFO |
| 7395 | "hda_codec: Cannot set up configuration " |
| 7396 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7397 | board_config = ALC260_BASIC; |
| 7398 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7399 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7400 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7401 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7402 | if (err < 0) { |
| 7403 | alc_free(codec); |
| 7404 | return err; |
| 7405 | } |
| 7406 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7407 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7408 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7409 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7410 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7411 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7412 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7413 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7414 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7415 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7416 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7417 | if (!spec->adc_nids && spec->input_mux) { |
| 7418 | /* check whether NID 0x04 is valid */ |
| 7419 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7420 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7421 | /* get type */ |
| 7422 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7423 | spec->adc_nids = alc260_adc_nids_alt; |
| 7424 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7425 | } else { |
| 7426 | spec->adc_nids = alc260_adc_nids; |
| 7427 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7428 | } |
| 7429 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7430 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7431 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7432 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7433 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7434 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7435 | spec->vmaster_nid = 0x08; |
| 7436 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7437 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7438 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7439 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7440 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7441 | if (!spec->loopback.amplist) |
| 7442 | spec->loopback.amplist = alc260_loopbacks; |
| 7443 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7444 | |
| 7445 | return 0; |
| 7446 | } |
| 7447 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7448 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7449 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7450 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7451 | * |
| 7452 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7453 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7454 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7455 | * 6-channel independent captures. |
| 7456 | * |
| 7457 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7458 | * driver yet). |
| 7459 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7460 | #define ALC882_DIGOUT_NID 0x06 |
| 7461 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7462 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7463 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7464 | #define ALC1200_DIGOUT_NID 0x10 |
| 7465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7466 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7467 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7468 | { 8, NULL } |
| 7469 | }; |
| 7470 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7471 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7472 | static hda_nid_t alc882_dac_nids[4] = { |
| 7473 | /* front, rear, clfe, rear_surr */ |
| 7474 | 0x02, 0x03, 0x04, 0x05 |
| 7475 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7476 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7477 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7478 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7479 | #define alc882_adc_nids alc880_adc_nids |
| 7480 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7481 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7482 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7483 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7484 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7485 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7486 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7487 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7488 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7489 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7490 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7491 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7492 | /* input MUX */ |
| 7493 | /* FIXME: should be a matrix-type input source selection */ |
| 7494 | |
| 7495 | static struct hda_input_mux alc882_capture_source = { |
| 7496 | .num_items = 4, |
| 7497 | .items = { |
| 7498 | { "Mic", 0x0 }, |
| 7499 | { "Front Mic", 0x1 }, |
| 7500 | { "Line", 0x2 }, |
| 7501 | { "CD", 0x4 }, |
| 7502 | }, |
| 7503 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7504 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7505 | #define alc883_capture_source alc882_capture_source |
| 7506 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7507 | static struct hda_input_mux alc889_capture_source = { |
| 7508 | .num_items = 3, |
| 7509 | .items = { |
| 7510 | { "Front Mic", 0x0 }, |
| 7511 | { "Mic", 0x3 }, |
| 7512 | { "Line", 0x2 }, |
| 7513 | }, |
| 7514 | }; |
| 7515 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7516 | static struct hda_input_mux mb5_capture_source = { |
| 7517 | .num_items = 3, |
| 7518 | .items = { |
| 7519 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7520 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7521 | { "CD", 0x4 }, |
| 7522 | }, |
| 7523 | }; |
| 7524 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7525 | static struct hda_input_mux macmini3_capture_source = { |
| 7526 | .num_items = 2, |
| 7527 | .items = { |
| 7528 | { "Line", 0x2 }, |
| 7529 | { "CD", 0x4 }, |
| 7530 | }, |
| 7531 | }; |
| 7532 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7533 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7534 | .num_items = 4, |
| 7535 | .items = { |
| 7536 | { "Mic", 0x1 }, |
| 7537 | { "Front Mic", 0x0 }, |
| 7538 | { "Line", 0x2 }, |
| 7539 | { "CD", 0x4 }, |
| 7540 | }, |
| 7541 | }; |
| 7542 | |
| 7543 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7544 | .num_items = 2, |
| 7545 | .items = { |
| 7546 | { "Mic", 0x1 }, |
| 7547 | { "Line", 0x2 }, |
| 7548 | }, |
| 7549 | }; |
| 7550 | |
| 7551 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7552 | .num_items = 4, |
| 7553 | .items = { |
| 7554 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7555 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7556 | { "Line", 0x2 }, |
| 7557 | { "CD", 0x4 }, |
| 7558 | }, |
| 7559 | }; |
| 7560 | |
| 7561 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7562 | .num_items = 2, |
| 7563 | .items = { |
| 7564 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7565 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7566 | }, |
| 7567 | }; |
| 7568 | |
| 7569 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7570 | .num_items = 3, |
| 7571 | .items = { |
| 7572 | { "Mic", 0x0 }, |
| 7573 | { "Front Mic", 0x1 }, |
| 7574 | { "Line", 0x4 }, |
| 7575 | }, |
| 7576 | }; |
| 7577 | |
| 7578 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7579 | .num_items = 2, |
| 7580 | .items = { |
| 7581 | { "Mic", 0x0 }, |
| 7582 | { "Line", 0x2 }, |
| 7583 | }, |
| 7584 | }; |
| 7585 | |
| 7586 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7587 | .num_items = 2, |
| 7588 | .items = { |
| 7589 | { "Mic", 0x0 }, |
| 7590 | /* Front Mic (0x01) unused */ |
| 7591 | { "Line", 0x2 }, |
| 7592 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7593 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7594 | }, |
| 7595 | }; |
| 7596 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7597 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7598 | .num_items = 2, |
| 7599 | .items = { |
| 7600 | { "Mic", 0x01 }, |
| 7601 | { "Line", 0x2 }, /* Not sure! */ |
| 7602 | }, |
| 7603 | }; |
| 7604 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7605 | /* |
| 7606 | * 2ch mode |
| 7607 | */ |
| 7608 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7609 | { 2, NULL } |
| 7610 | }; |
| 7611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7612 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7613 | * 2ch mode |
| 7614 | */ |
| 7615 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7616 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7617 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7618 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7619 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7620 | { } /* end */ |
| 7621 | }; |
| 7622 | |
| 7623 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7624 | * 4ch mode |
| 7625 | */ |
| 7626 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7627 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7628 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7629 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7630 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7631 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7632 | { } /* end */ |
| 7633 | }; |
| 7634 | |
| 7635 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7636 | * 6ch mode |
| 7637 | */ |
| 7638 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7639 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7640 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7641 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7642 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7643 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7644 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7645 | { } /* end */ |
| 7646 | }; |
| 7647 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7648 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7649 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7650 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7651 | { 6, alc882_3ST_ch6_init }, |
| 7652 | }; |
| 7653 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7654 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7655 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7656 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7657 | * 2ch mode |
| 7658 | */ |
| 7659 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7660 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7661 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7662 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7665 | { } /* end */ |
| 7666 | }; |
| 7667 | |
| 7668 | /* |
| 7669 | * 4ch mode |
| 7670 | */ |
| 7671 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7672 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7673 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7674 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7675 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7676 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7677 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7678 | { } /* end */ |
| 7679 | }; |
| 7680 | |
| 7681 | /* |
| 7682 | * 6ch mode |
| 7683 | */ |
| 7684 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7685 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7686 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7687 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7688 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7689 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7690 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7691 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7692 | { } /* end */ |
| 7693 | }; |
| 7694 | |
| 7695 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7696 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7697 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7698 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7699 | }; |
| 7700 | |
| 7701 | |
| 7702 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7703 | * 6ch mode |
| 7704 | */ |
| 7705 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7706 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7707 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7708 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7709 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7710 | { } /* end */ |
| 7711 | }; |
| 7712 | |
| 7713 | /* |
| 7714 | * 8ch mode |
| 7715 | */ |
| 7716 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7717 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7718 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7719 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7720 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7721 | { } /* end */ |
| 7722 | }; |
| 7723 | |
| 7724 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7725 | { 6, alc882_sixstack_ch6_init }, |
| 7726 | { 8, alc882_sixstack_ch8_init }, |
| 7727 | }; |
| 7728 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7729 | |
| 7730 | /* Macbook Air 2,1 */ |
| 7731 | |
| 7732 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7733 | { 2, NULL }, |
| 7734 | }; |
| 7735 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7736 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7737 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7738 | */ |
| 7739 | |
| 7740 | /* |
| 7741 | * 2ch mode |
| 7742 | */ |
| 7743 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7744 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7745 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7746 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7747 | { } /* end */ |
| 7748 | }; |
| 7749 | |
| 7750 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7751 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7752 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7753 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7754 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7755 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7756 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7757 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7758 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7759 | { } /* end */ |
| 7760 | }; |
| 7761 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7762 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7763 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7764 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7765 | }; |
| 7766 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7767 | /* |
| 7768 | * 2ch |
| 7769 | * Speakers/Woofer/HP = Front |
| 7770 | * LineIn = Input |
| 7771 | */ |
| 7772 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7773 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7775 | { } /* end */ |
| 7776 | }; |
| 7777 | |
| 7778 | /* |
| 7779 | * 6ch mode |
| 7780 | * Speakers/HP = Front |
| 7781 | * Woofer = LFE |
| 7782 | * LineIn = Surround |
| 7783 | */ |
| 7784 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7785 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7786 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7787 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7788 | { } /* end */ |
| 7789 | }; |
| 7790 | |
| 7791 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7792 | { 2, alc885_mb5_ch2_init }, |
| 7793 | { 6, alc885_mb5_ch6_init }, |
| 7794 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7795 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7796 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7797 | |
| 7798 | /* |
| 7799 | * 2ch mode |
| 7800 | */ |
| 7801 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7802 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7803 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7804 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7805 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7806 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7807 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7808 | { } /* end */ |
| 7809 | }; |
| 7810 | |
| 7811 | /* |
| 7812 | * 4ch mode |
| 7813 | */ |
| 7814 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7815 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7816 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7817 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7818 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7819 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7820 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7821 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7822 | { } /* end */ |
| 7823 | }; |
| 7824 | |
| 7825 | /* |
| 7826 | * 6ch mode |
| 7827 | */ |
| 7828 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7829 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7830 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7831 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7832 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7833 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7834 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7835 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7836 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7837 | { } /* end */ |
| 7838 | }; |
| 7839 | |
| 7840 | /* |
| 7841 | * 8ch mode |
| 7842 | */ |
| 7843 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7844 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7845 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7846 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7847 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7848 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7849 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7850 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7851 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7852 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7853 | { } /* end */ |
| 7854 | }; |
| 7855 | |
| 7856 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7857 | { 2, alc883_4ST_ch2_init }, |
| 7858 | { 4, alc883_4ST_ch4_init }, |
| 7859 | { 6, alc883_4ST_ch6_init }, |
| 7860 | { 8, alc883_4ST_ch8_init }, |
| 7861 | }; |
| 7862 | |
| 7863 | |
| 7864 | /* |
| 7865 | * 2ch mode |
| 7866 | */ |
| 7867 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7868 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7869 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7870 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7871 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7872 | { } /* end */ |
| 7873 | }; |
| 7874 | |
| 7875 | /* |
| 7876 | * 4ch mode |
| 7877 | */ |
| 7878 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7879 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7880 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7881 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7882 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7883 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7884 | { } /* end */ |
| 7885 | }; |
| 7886 | |
| 7887 | /* |
| 7888 | * 6ch mode |
| 7889 | */ |
| 7890 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7891 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7892 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7893 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7894 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7895 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7896 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7897 | { } /* end */ |
| 7898 | }; |
| 7899 | |
| 7900 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7901 | { 2, alc883_3ST_ch2_intel_init }, |
| 7902 | { 4, alc883_3ST_ch4_intel_init }, |
| 7903 | { 6, alc883_3ST_ch6_intel_init }, |
| 7904 | }; |
| 7905 | |
| 7906 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7907 | * 2ch mode |
| 7908 | */ |
| 7909 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7910 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7911 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7912 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7913 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7914 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7915 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7916 | { } /* end */ |
| 7917 | }; |
| 7918 | |
| 7919 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7920 | * 6ch mode |
| 7921 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7922 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7923 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7924 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7925 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7926 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7927 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7928 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7929 | { } /* end */ |
| 7930 | }; |
| 7931 | |
| 7932 | /* |
| 7933 | * 8ch mode |
| 7934 | */ |
| 7935 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7936 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7937 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7938 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7939 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7940 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7941 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7942 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7943 | { } /* end */ |
| 7944 | }; |
| 7945 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7946 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7947 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7948 | { 6, alc889_ch6_intel_init }, |
| 7949 | { 8, alc889_ch8_intel_init }, |
| 7950 | }; |
| 7951 | |
| 7952 | /* |
| 7953 | * 6ch mode |
| 7954 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7955 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7956 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7957 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7958 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7959 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7960 | { } /* end */ |
| 7961 | }; |
| 7962 | |
| 7963 | /* |
| 7964 | * 8ch mode |
| 7965 | */ |
| 7966 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7967 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7968 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7969 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7970 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7971 | { } /* end */ |
| 7972 | }; |
| 7973 | |
| 7974 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7975 | { 6, alc883_sixstack_ch6_init }, |
| 7976 | { 8, alc883_sixstack_ch8_init }, |
| 7977 | }; |
| 7978 | |
| 7979 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7980 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7981 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7982 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7983 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7985 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7986 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7987 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7988 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7989 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7990 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7991 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7992 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7993 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7995 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7996 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7997 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7998 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7999 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8000 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8001 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8002 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8003 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8004 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8005 | { } /* end */ |
| 8006 | }; |
| 8007 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8008 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8009 | |
| 8010 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 8011 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8012 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8013 | { } |
| 8014 | }; |
| 8015 | |
| 8016 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8017 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8018 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8019 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8020 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8021 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8022 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8023 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8024 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8026 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8027 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8028 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8029 | { } /* end */ |
| 8030 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8031 | |
| 8032 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8034 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8035 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8036 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8037 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8038 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8039 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8040 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8041 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8042 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8044 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8045 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8046 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8047 | { } /* end */ |
| 8048 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8049 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8050 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 8051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8052 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8053 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8054 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8055 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8056 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8057 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8058 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8060 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8061 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8062 | { } /* end */ |
| 8063 | }; |
| 8064 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8065 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8066 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8067 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8068 | { } /* end */ |
| 8069 | }; |
| 8070 | |
| 8071 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8072 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8074 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8075 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8076 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8077 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8078 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8080 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8081 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8082 | { } /* end */ |
| 8083 | }; |
| 8084 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8085 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8087 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8088 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8090 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8092 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8095 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8096 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8097 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8098 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8099 | { } /* end */ |
| 8100 | }; |
| 8101 | |
| 8102 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8103 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8104 | */ |
| 8105 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8107 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8108 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8109 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8111 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8114 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8115 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8118 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8119 | { } /* end */ |
| 8120 | }; |
| 8121 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8122 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8124 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8125 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8128 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8129 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8131 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8132 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8133 | { } /* end */ |
| 8134 | }; |
| 8135 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8136 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8137 | { |
| 8138 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8139 | .name = "Channel Mode", |
| 8140 | .info = alc_ch_mode_info, |
| 8141 | .get = alc_ch_mode_get, |
| 8142 | .put = alc_ch_mode_put, |
| 8143 | }, |
| 8144 | { } /* end */ |
| 8145 | }; |
| 8146 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8147 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8148 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8151 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8153 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8154 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8155 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8156 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8157 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8158 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8159 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8160 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8161 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8162 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8163 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8164 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8165 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8166 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8167 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8168 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8169 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8170 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8171 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8172 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8173 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8174 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8175 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8176 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8177 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8178 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8179 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8180 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8181 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8182 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8183 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8184 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8185 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8186 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8187 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8188 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8189 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8190 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8191 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8192 | |
| 8193 | /* FIXME: use matrix-type input source selection */ |
| 8194 | /* 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] | 8195 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8196 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8197 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8199 | /* ADC2: mute amp left and right */ |
| 8200 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8201 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8202 | /* ADC3: mute amp left and right */ |
| 8203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8204 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8205 | |
| 8206 | { } |
| 8207 | }; |
| 8208 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8209 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8210 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8211 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8212 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8213 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8214 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8215 | /* ADC1: mute amp left and right */ |
| 8216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8217 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8218 | { } |
| 8219 | }; |
| 8220 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8221 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8222 | /* change to EAPD mode */ |
| 8223 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8224 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8225 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8226 | }; |
| 8227 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8228 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8229 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8230 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8231 | { } |
| 8232 | }; |
| 8233 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8234 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8235 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8237 | {} |
| 8238 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8239 | |
| 8240 | static struct hda_verb alc885_init_verbs[] = { |
| 8241 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8243 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8244 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8245 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8246 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8247 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8250 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8251 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8252 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8253 | |
| 8254 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8258 | /* Front Pin: output 0 (0x0c) */ |
| 8259 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8260 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8261 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8262 | /* Rear Pin: output 1 (0x0d) */ |
| 8263 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8264 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8265 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8266 | /* CLFE Pin: output 2 (0x0e) */ |
| 8267 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8268 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8269 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8270 | /* Side Pin: output 3 (0x0f) */ |
| 8271 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8272 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8273 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8274 | /* Mic (rear) pin: input vref at 80% */ |
| 8275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8276 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8277 | /* Front Mic pin: input vref at 80% */ |
| 8278 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8279 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8280 | /* Line In pin: input */ |
| 8281 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8282 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8283 | |
| 8284 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8285 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8287 | /* Input mixer2 */ |
| 8288 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8289 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8291 | /* ADC2: mute amp left and right */ |
| 8292 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8293 | /* ADC3: mute amp left and right */ |
| 8294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8295 | |
| 8296 | { } |
| 8297 | }; |
| 8298 | |
| 8299 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8302 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8303 | { } |
| 8304 | }; |
| 8305 | |
| 8306 | |
| 8307 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8308 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8309 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8310 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8311 | { } |
| 8312 | }; |
| 8313 | |
| 8314 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8315 | #define alc883_init_verbs alc882_base_init_verbs |
| 8316 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8317 | /* Mac Pro test */ |
| 8318 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8320 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8321 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8322 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8323 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8324 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8325 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8326 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8327 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8328 | { } /* end */ |
| 8329 | }; |
| 8330 | |
| 8331 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8332 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8336 | /* Front Pin: output 0 (0x0c) */ |
| 8337 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8338 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8339 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8340 | /* Front Mic pin: input vref at 80% */ |
| 8341 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8342 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8343 | /* Speaker: output */ |
| 8344 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8345 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8346 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8347 | /* Headphone output (output 0 - 0x0c) */ |
| 8348 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8349 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8350 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8351 | |
| 8352 | /* FIXME: use matrix-type input source selection */ |
| 8353 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8354 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8356 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8357 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8358 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8359 | /* Input mixer2 */ |
| 8360 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8364 | /* Input mixer3 */ |
| 8365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8369 | /* ADC1: mute amp left and right */ |
| 8370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8371 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8372 | /* ADC2: mute amp left and right */ |
| 8373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8374 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8375 | /* ADC3: mute amp left and right */ |
| 8376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8377 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8378 | |
| 8379 | { } |
| 8380 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8381 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8382 | /* Macbook 5,1 */ |
| 8383 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8384 | /* DACs */ |
| 8385 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8386 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8387 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8388 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8389 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8390 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8391 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8393 | /* Surround mixer */ |
| 8394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8395 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8396 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8397 | /* LFE mixer */ |
| 8398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8399 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8400 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8401 | /* HP mixer */ |
| 8402 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8403 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8404 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8405 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8406 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8407 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8408 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8409 | /* LFE Pin (0x0e) */ |
| 8410 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8411 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8412 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8413 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8415 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8416 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8417 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8418 | /* Front Mic pin: input vref at 80% */ |
| 8419 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8420 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8421 | /* Line In pin */ |
| 8422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8424 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8425 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8426 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8427 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8428 | { } |
| 8429 | }; |
| 8430 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8431 | /* Macmini 3,1 */ |
| 8432 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8433 | /* DACs */ |
| 8434 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8435 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8436 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8437 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8438 | /* Front mixer */ |
| 8439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8441 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8442 | /* Surround mixer */ |
| 8443 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8444 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8445 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8446 | /* LFE mixer */ |
| 8447 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8450 | /* HP mixer */ |
| 8451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8452 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8453 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8454 | /* Front Pin (0x0c) */ |
| 8455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8456 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8457 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8458 | /* LFE Pin (0x0e) */ |
| 8459 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8460 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8461 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8462 | /* HP Pin (0x0f) */ |
| 8463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8465 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8466 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8467 | /* Line In pin */ |
| 8468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8470 | |
| 8471 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8472 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8473 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8474 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8475 | { } |
| 8476 | }; |
| 8477 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8478 | |
| 8479 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8480 | /*Internal and HP Speaker Mixer*/ |
| 8481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8482 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8483 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8484 | /*Internal Speaker Pin (0x0c)*/ |
| 8485 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8486 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8487 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8488 | /* HP Pin: output 0 (0x0e) */ |
| 8489 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8490 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8491 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8492 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8493 | /* Line in (is hp when jack connected)*/ |
| 8494 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8495 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8496 | |
| 8497 | { } |
| 8498 | }; |
| 8499 | |
| 8500 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8501 | /* Macbook Pro rev3 */ |
| 8502 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8503 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8506 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8507 | /* Rear mixer */ |
| 8508 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8509 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8510 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8511 | /* HP mixer */ |
| 8512 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8514 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8515 | /* Front Pin: output 0 (0x0c) */ |
| 8516 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8517 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8518 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8519 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8521 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8522 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8523 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8524 | /* Mic (rear) pin: input vref at 80% */ |
| 8525 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8526 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8527 | /* Front Mic pin: input vref at 80% */ |
| 8528 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8529 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8530 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8531 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8532 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8533 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8534 | |
| 8535 | /* FIXME: use matrix-type input source selection */ |
| 8536 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8537 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 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)}, |
| 8542 | /* Input mixer2 */ |
| 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)}, |
| 8547 | /* Input mixer3 */ |
| 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)}, |
| 8552 | /* ADC1: mute amp left and right */ |
| 8553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8554 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8555 | /* ADC2: mute amp left and right */ |
| 8556 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8557 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8558 | /* ADC3: mute amp left and right */ |
| 8559 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8560 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8561 | |
| 8562 | { } |
| 8563 | }; |
| 8564 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8565 | /* iMac 9,1 */ |
| 8566 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8567 | /* Internal Speaker Pin (0x0c) */ |
| 8568 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8570 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8571 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8572 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8573 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8574 | /* HP Pin: Rear */ |
| 8575 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8577 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8578 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8579 | /* Line in Rear */ |
| 8580 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8581 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8582 | /* Front Mic pin: input vref at 80% */ |
| 8583 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8584 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8585 | /* Rear mixer */ |
| 8586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8589 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8593 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8594 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8595 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8596 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8597 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8598 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8599 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8600 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8601 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8602 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8603 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8605 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8607 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8608 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8609 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8610 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8611 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8612 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8613 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8614 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8615 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8616 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8617 | { } |
| 8618 | }; |
| 8619 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8620 | /* iMac 24 mixer. */ |
| 8621 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8622 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8623 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8624 | { } /* end */ |
| 8625 | }; |
| 8626 | |
| 8627 | /* iMac 24 init verbs. */ |
| 8628 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8629 | /* Internal speakers: output 0 (0x0c) */ |
| 8630 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8631 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8632 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8633 | /* Internal speakers: output 0 (0x0c) */ |
| 8634 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8635 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8636 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8637 | /* Headphone: output 0 (0x0c) */ |
| 8638 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8639 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8640 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8641 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8642 | /* Front Mic: input vref at 80% */ |
| 8643 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8644 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8645 | { } |
| 8646 | }; |
| 8647 | |
| 8648 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8649 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8650 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8651 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8652 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8653 | spec->autocfg.hp_pins[0] = 0x14; |
| 8654 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8655 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8656 | } |
| 8657 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8658 | #define alc885_mb5_setup alc885_imac24_setup |
| 8659 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8660 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8661 | /* Macbook Air 2,1 */ |
| 8662 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8663 | { |
| 8664 | struct alc_spec *spec = codec->spec; |
| 8665 | |
| 8666 | spec->autocfg.hp_pins[0] = 0x14; |
| 8667 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8668 | } |
| 8669 | |
| 8670 | |
| 8671 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8672 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8673 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8674 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8675 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8676 | spec->autocfg.hp_pins[0] = 0x15; |
| 8677 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8678 | } |
| 8679 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8680 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8681 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8682 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8683 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8684 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8685 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8686 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8687 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8688 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8689 | static struct hda_verb alc882_targa_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 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8694 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8695 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8696 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8697 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8698 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8699 | |
| 8700 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8701 | { } /* end */ |
| 8702 | }; |
| 8703 | |
| 8704 | /* toggle speaker-output according to the hp-jack state */ |
| 8705 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8706 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8707 | struct alc_spec *spec = codec->spec; |
| 8708 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8709 | 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] | 8710 | spec->jack_present ? 1 : 3); |
| 8711 | } |
| 8712 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8713 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8714 | { |
| 8715 | struct alc_spec *spec = codec->spec; |
| 8716 | |
| 8717 | spec->autocfg.hp_pins[0] = 0x14; |
| 8718 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8719 | } |
| 8720 | |
| 8721 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8722 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8723 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8724 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8725 | } |
| 8726 | |
| 8727 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8728 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8729 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8730 | |
| 8731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8733 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8734 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8735 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8736 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8737 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8738 | |
| 8739 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8740 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8741 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8742 | { } /* end */ |
| 8743 | }; |
| 8744 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8745 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8748 | |
| 8749 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8751 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8752 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8753 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8754 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8755 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8756 | |
| 8757 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8758 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8759 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8760 | { } /* end */ |
| 8761 | }; |
| 8762 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8763 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8764 | { |
| 8765 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8766 | |
| 8767 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8768 | AC_VERB_GET_GPIO_DATA, 0); |
| 8769 | |
| 8770 | if (!muted) |
| 8771 | gpiostate |= (1 << pin); |
| 8772 | else |
| 8773 | gpiostate &= ~(1 << pin); |
| 8774 | |
| 8775 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8776 | AC_VERB_GET_GPIO_MASK, 0); |
| 8777 | gpiomask |= (1 << pin); |
| 8778 | |
| 8779 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8780 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8781 | gpiodir |= (1 << pin); |
| 8782 | |
| 8783 | |
| 8784 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8785 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8786 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8787 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8788 | |
| 8789 | msleep(1); |
| 8790 | |
| 8791 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8792 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8793 | } |
| 8794 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8795 | /* set up GPIO at initialization */ |
| 8796 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8797 | { |
| 8798 | alc882_gpio_mute(codec, 0, 0); |
| 8799 | alc882_gpio_mute(codec, 1, 0); |
| 8800 | } |
| 8801 | |
| 8802 | /* set up GPIO and update auto-muting at initialization */ |
| 8803 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8804 | { |
| 8805 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8806 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8807 | } |
| 8808 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8809 | /* |
| 8810 | * generic initialization of ADC, input mixers and output mixers |
| 8811 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8812 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8813 | /* |
| 8814 | * Unmute ADC0-2 and set the default input to mic-in |
| 8815 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8816 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8817 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8818 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8819 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8821 | /* |
| 8822 | * Set up output mixers (0x0c - 0x0f) |
| 8823 | */ |
| 8824 | /* set vol=0 to output mixers */ |
| 8825 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8826 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8827 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8828 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8829 | /* set up input amps for analog loopback */ |
| 8830 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8832 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8833 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8834 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8835 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8836 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8837 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8838 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8839 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8840 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8841 | |
| 8842 | /* FIXME: use matrix-type input source selection */ |
| 8843 | /* 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] | 8844 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8845 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8846 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8847 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8848 | { } |
| 8849 | }; |
| 8850 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8851 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8852 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8853 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8854 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8855 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8856 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8857 | { } /* end */ |
| 8858 | }; |
| 8859 | |
| 8860 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8861 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8862 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8863 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8864 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8865 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8866 | { } /* end */ |
| 8867 | }; |
| 8868 | |
| 8869 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8870 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8871 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8872 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8873 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8874 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8875 | { } /* end */ |
| 8876 | }; |
| 8877 | |
| 8878 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8879 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8880 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8881 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8882 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8883 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8884 | { } /* end */ |
| 8885 | }; |
| 8886 | |
| 8887 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8888 | { 2, alc889A_mb31_ch2_init }, |
| 8889 | { 4, alc889A_mb31_ch4_init }, |
| 8890 | { 5, alc889A_mb31_ch5_init }, |
| 8891 | { 6, alc889A_mb31_ch6_init }, |
| 8892 | }; |
| 8893 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8894 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8895 | /* eanable EAPD on medion laptop */ |
| 8896 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8897 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8898 | { } |
| 8899 | }; |
| 8900 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8901 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8902 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8903 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8904 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8905 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8906 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8907 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8908 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8909 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8910 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8912 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8914 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8915 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8916 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8917 | { } /* end */ |
| 8918 | }; |
| 8919 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8920 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8921 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8922 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8923 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8924 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8925 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8926 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8928 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8929 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8930 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8931 | { } /* end */ |
| 8932 | }; |
| 8933 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8934 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8935 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8936 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8937 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8938 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8939 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8940 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8941 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8942 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8943 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8944 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8945 | { } /* end */ |
| 8946 | }; |
| 8947 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8948 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8949 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8950 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8952 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8953 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8954 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8955 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8957 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8959 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8960 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8961 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8962 | { } /* end */ |
| 8963 | }; |
| 8964 | |
| 8965 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8966 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8967 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8968 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8969 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8970 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8971 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8972 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8973 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8976 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8977 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8978 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8980 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8981 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8982 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8983 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8984 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8985 | { } /* end */ |
| 8986 | }; |
| 8987 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8988 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8989 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8990 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8991 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8992 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8993 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8994 | HDA_OUTPUT), |
| 8995 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8996 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8997 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8999 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9000 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9002 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9004 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9005 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9006 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9007 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9008 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9009 | { } /* end */ |
| 9010 | }; |
| 9011 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9012 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 9013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9014 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9015 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9016 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9017 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9018 | HDA_OUTPUT), |
| 9019 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9020 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9021 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9022 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9023 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9024 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9025 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9026 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9028 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9029 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9030 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9031 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9032 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9033 | { } /* end */ |
| 9034 | }; |
| 9035 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9036 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9037 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9038 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9039 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9040 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9041 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9042 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9043 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9044 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9045 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9051 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9052 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9053 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9054 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9055 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9056 | { } /* end */ |
| 9057 | }; |
| 9058 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9059 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9061 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9062 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9063 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9064 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9065 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9066 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9067 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9068 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9069 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9070 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9071 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9072 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9073 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9075 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9076 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9077 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9078 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9079 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9080 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9081 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9082 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9083 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9084 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9085 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9086 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9087 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9088 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9089 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9090 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9091 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9092 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9093 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9094 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9095 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9096 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9097 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9098 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9099 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9100 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9101 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9102 | { } /* end */ |
| 9103 | }; |
| 9104 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9105 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9107 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9108 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9109 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9110 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9112 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9114 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9115 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9116 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9117 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9118 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9119 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9120 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9121 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9122 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9125 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9126 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9127 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9128 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9129 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9130 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9131 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9132 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9133 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9134 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9135 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9136 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9137 | { } /* end */ |
| 9138 | }; |
| 9139 | |
| 9140 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9141 | /* Unmute front mixer */ |
| 9142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9143 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9144 | |
| 9145 | /* Set speaker pin to front mixer */ |
| 9146 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9147 | |
| 9148 | /* Init headphone pin */ |
| 9149 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9150 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9151 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9152 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9153 | |
| 9154 | { } /* end */ |
| 9155 | }; |
| 9156 | |
| 9157 | /* toggle speaker-output according to the hp-jack state */ |
| 9158 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9159 | { |
| 9160 | struct alc_spec *spec = codec->spec; |
| 9161 | |
| 9162 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9163 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9164 | } |
| 9165 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9166 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9167 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9168 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9169 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9170 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9171 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9172 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9173 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9174 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9175 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9176 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9177 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9178 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9179 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9180 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9181 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9182 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9183 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9184 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9185 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9186 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9187 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9188 | { } /* end */ |
| 9189 | }; |
| 9190 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9191 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9194 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9195 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9196 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9197 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9198 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9199 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9200 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9201 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9202 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9203 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9204 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9205 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9206 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9208 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9209 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9210 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9211 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9212 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9213 | { } /* end */ |
| 9214 | }; |
| 9215 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9216 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9217 | /* Output mixers */ |
| 9218 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9219 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9220 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9221 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9222 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9223 | HDA_OUTPUT), |
| 9224 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9225 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9226 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9227 | /* Output switches */ |
| 9228 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9229 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9230 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9231 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9232 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9233 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9234 | /* Input mixers */ |
| 9235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9236 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9237 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9238 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9239 | { } /* end */ |
| 9240 | }; |
| 9241 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9242 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9243 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9244 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9245 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9247 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9249 | { } /* end */ |
| 9250 | }; |
| 9251 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9252 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9253 | .ops = &snd_hda_bind_vol, |
| 9254 | .values = { |
| 9255 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9256 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9257 | 0 |
| 9258 | }, |
| 9259 | }; |
| 9260 | |
| 9261 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9262 | .ops = &snd_hda_bind_sw, |
| 9263 | .values = { |
| 9264 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9265 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9266 | 0 |
| 9267 | }, |
| 9268 | }; |
| 9269 | |
| 9270 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9271 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9272 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9273 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9274 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9275 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9276 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9277 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9278 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9279 | { } /* end */ |
| 9280 | }; |
| 9281 | |
| 9282 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9283 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9284 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9285 | { |
| 9286 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9287 | /* .name = "Capture Source", */ |
| 9288 | .name = "Input Source", |
| 9289 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9290 | .info = alc_mux_enum_info, |
| 9291 | .get = alc_mux_enum_get, |
| 9292 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9293 | }, |
| 9294 | { } /* end */ |
| 9295 | }; |
| 9296 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9297 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9298 | { |
| 9299 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9300 | .name = "Channel Mode", |
| 9301 | .info = alc_ch_mode_info, |
| 9302 | .get = alc_ch_mode_get, |
| 9303 | .put = alc_ch_mode_put, |
| 9304 | }, |
| 9305 | { } /* end */ |
| 9306 | }; |
| 9307 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9308 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9309 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9310 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9311 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9312 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9313 | spec->autocfg.hp_pins[0] = 0x15; |
| 9314 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9315 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9316 | } |
| 9317 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9318 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9319 | /* HP */ |
| 9320 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9321 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9322 | /* Subwoofer */ |
| 9323 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9324 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9325 | |
| 9326 | /* enable unsolicited event */ |
| 9327 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9328 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9329 | |
| 9330 | { } /* end */ |
| 9331 | }; |
| 9332 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9333 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9334 | /* HP */ |
| 9335 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9337 | /* Int speaker */ |
| 9338 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9339 | |
| 9340 | /* enable unsolicited event */ |
| 9341 | /* |
| 9342 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9343 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9344 | */ |
| 9345 | |
| 9346 | { } /* end */ |
| 9347 | }; |
| 9348 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9349 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9350 | /* HP */ |
| 9351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9352 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9353 | /* Int speaker */ |
| 9354 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9356 | |
| 9357 | /* enable unsolicited event */ |
| 9358 | {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] | 9359 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9360 | |
| 9361 | { } /* end */ |
| 9362 | }; |
| 9363 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9364 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9365 | /* HP */ |
| 9366 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9367 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9368 | /* Subwoofer */ |
| 9369 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9371 | |
| 9372 | /* enable unsolicited event */ |
| 9373 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9374 | |
| 9375 | { } /* end */ |
| 9376 | }; |
| 9377 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9378 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9381 | |
| 9382 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9383 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9384 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9385 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9386 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9387 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9388 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9389 | /* Connect Mic jack to CLFE */ |
| 9390 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9391 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9392 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9393 | /* Connect Line-in jack to Surround */ |
| 9394 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9395 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9396 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9397 | /* Connect HP out jack to Front */ |
| 9398 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9399 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9400 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9401 | |
| 9402 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9403 | |
| 9404 | { } /* end */ |
| 9405 | }; |
| 9406 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9407 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9408 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9409 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9410 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9411 | { } /* end */ |
| 9412 | }; |
| 9413 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9414 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9415 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9416 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9417 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9419 | { } /* end */ |
| 9420 | }; |
| 9421 | |
| 9422 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9425 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9426 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9427 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9428 | { } /* end */ |
| 9429 | }; |
| 9430 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9431 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9434 | |
| 9435 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9436 | |
| 9437 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9438 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9439 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9440 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9441 | { } /* end */ |
| 9442 | }; |
| 9443 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9444 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9447 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9448 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9449 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9450 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9451 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9452 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9453 | { } /* end */ |
| 9454 | }; |
| 9455 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9456 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9457 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9458 | { } |
| 9459 | }; |
| 9460 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9461 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9462 | /* HP */ |
| 9463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9465 | |
| 9466 | /* enable unsolicited event */ |
| 9467 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9468 | |
| 9469 | { } /* end */ |
| 9470 | }; |
| 9471 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9472 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9473 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9474 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9475 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9476 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9477 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9478 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9479 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9480 | } |
| 9481 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9482 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9483 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9484 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9485 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9486 | {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] | 9487 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9488 | }; |
| 9489 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9490 | /* |
| 9491 | * 2ch mode |
| 9492 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9493 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9494 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9495 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9496 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9497 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9498 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9499 | }; |
| 9500 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9501 | /* |
| 9502 | * 4ch mode |
| 9503 | */ |
| 9504 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9505 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9506 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9507 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9508 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9509 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9510 | { } /* end */ |
| 9511 | }; |
| 9512 | |
| 9513 | /* |
| 9514 | * 6ch mode |
| 9515 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9516 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9517 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9518 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9519 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9520 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9521 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9522 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9523 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9524 | }; |
| 9525 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9526 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9527 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9528 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9529 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9530 | }; |
| 9531 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9532 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9533 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9534 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9535 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9536 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9537 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9538 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9539 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9540 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9541 | } |
| 9542 | |
| 9543 | /* toggle RCA according to the front-jack state */ |
| 9544 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9545 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9546 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9547 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9548 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9549 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9550 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9551 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9552 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9553 | unsigned int res) |
| 9554 | { |
| 9555 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9556 | alc888_lenovo_ms7195_front_automute(codec); |
| 9557 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9558 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9559 | } |
| 9560 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9561 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9562 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9563 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9564 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9565 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9566 | spec->autocfg.hp_pins[0] = 0x14; |
| 9567 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9568 | } |
| 9569 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9570 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9571 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9572 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9573 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9574 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9575 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9576 | struct alc_spec *spec = codec->spec; |
| 9577 | |
| 9578 | spec->autocfg.hp_pins[0] = 0x15; |
| 9579 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9580 | } |
| 9581 | |
| 9582 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9583 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9584 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9585 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9586 | } |
| 9587 | |
| 9588 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9589 | unsigned int res) |
| 9590 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9591 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9592 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9593 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9594 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9595 | default: |
| 9596 | alc_automute_amp_unsol_event(codec, res); |
| 9597 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9598 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9599 | } |
| 9600 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9601 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9602 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9603 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9604 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9605 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9606 | spec->autocfg.hp_pins[0] = 0x14; |
| 9607 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9608 | } |
| 9609 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9610 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9611 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9612 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9613 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9614 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9615 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9616 | } |
| 9617 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9618 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9619 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9620 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9621 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9622 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9623 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9624 | } |
| 9625 | |
| 9626 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9627 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9628 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9629 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9630 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9631 | HDA_AMP_MUTE, bits); |
| 9632 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9633 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9634 | } |
| 9635 | |
| 9636 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9637 | unsigned int res) |
| 9638 | { |
| 9639 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9640 | alc883_lenovo_101e_all_automute(codec); |
| 9641 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9642 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9643 | } |
| 9644 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9645 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9646 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9647 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9648 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9649 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9650 | spec->autocfg.hp_pins[0] = 0x14; |
| 9651 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9652 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9653 | } |
| 9654 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9655 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9656 | /* HP Pin: output 0 (0x0c) */ |
| 9657 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9658 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9659 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9660 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9662 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9663 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9664 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9665 | /* eanable EAPD on medion laptop */ |
| 9666 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9667 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9668 | /* enable unsolicited event */ |
| 9669 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9670 | { } |
| 9671 | }; |
| 9672 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9673 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9674 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9675 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9676 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9677 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9678 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9679 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9680 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9681 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9682 | } |
| 9683 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9684 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9685 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9686 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9687 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9688 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9689 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9690 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9691 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9692 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9693 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9694 | } |
| 9695 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9696 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9697 | { |
| 9698 | struct alc_spec *spec = codec->spec; |
| 9699 | |
| 9700 | spec->autocfg.hp_pins[0] = 0x15; |
| 9701 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9702 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9703 | } |
| 9704 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9705 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9706 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9709 | /* enable unsolicited event */ |
| 9710 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9711 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9712 | { } /* end */ |
| 9713 | }; |
| 9714 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9715 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9716 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9717 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9718 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9719 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9720 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9721 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9722 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9723 | spec->ext_mic.pin = 0x18; |
| 9724 | spec->int_mic.pin = 0x19; |
| 9725 | spec->ext_mic.mux_idx = 0; |
| 9726 | spec->int_mic.mux_idx = 1; |
| 9727 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9728 | } |
| 9729 | |
| 9730 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9733 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9734 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9735 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9736 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9737 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9738 | /* enable unsolicited event */ |
| 9739 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9740 | { } /* end */ |
| 9741 | }; |
| 9742 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9743 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9744 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9745 | struct alc_spec *spec = codec->spec; |
| 9746 | |
| 9747 | spec->autocfg.hp_pins[0] = 0x14; |
| 9748 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9749 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9750 | } |
| 9751 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9752 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9753 | /* Init rear pin (used as headphone output) */ |
| 9754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9756 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9757 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9758 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9759 | /* Init line 2 pin (used as headphone out by default) */ |
| 9760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9762 | { } /* end */ |
| 9763 | }; |
| 9764 | |
| 9765 | /* Mute speakers according to the headphone jack state */ |
| 9766 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9767 | { |
| 9768 | unsigned int present; |
| 9769 | |
| 9770 | /* Mute only in 2ch or 4ch mode */ |
| 9771 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9772 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9773 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9774 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9775 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9776 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9777 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9778 | } |
| 9779 | } |
| 9780 | |
| 9781 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9782 | { |
| 9783 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9784 | alc889A_mb31_automute(codec); |
| 9785 | } |
| 9786 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9787 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9788 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9789 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9790 | #endif |
| 9791 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9792 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9793 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9794 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9795 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9796 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9797 | |
| 9798 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9799 | ALC1200_DIGOUT_NID, 0, |
| 9800 | }; |
| 9801 | |
| 9802 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9803 | ALC883_DIGOUT_NID, 0, |
| 9804 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9805 | |
| 9806 | /* |
| 9807 | * configuration and preset |
| 9808 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9809 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9810 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9811 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9812 | [ALC882_ARIMA] = "arima", |
| 9813 | [ALC882_W2JC] = "w2jc", |
| 9814 | [ALC882_TARGA] = "targa", |
| 9815 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9816 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9817 | [ALC885_MACPRO] = "macpro", |
| 9818 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9819 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9820 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9821 | [ALC885_MBP3] = "mbp3", |
| 9822 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9823 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9824 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9825 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9826 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9827 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9828 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9829 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9830 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9831 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9832 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9833 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9834 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9835 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9836 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9837 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9838 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9839 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9840 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9841 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9842 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9843 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9844 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9845 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9846 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9847 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9848 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9849 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9850 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9851 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9852 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9853 | [ALC889A_INTEL] = "intel-alc889a", |
| 9854 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9855 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9856 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9857 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9858 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9859 | }; |
| 9860 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9861 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9862 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9863 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9864 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9865 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9867 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9868 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9869 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9870 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9871 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9872 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9873 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9874 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9875 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9876 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9877 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9878 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9879 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9880 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9881 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9882 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9883 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9884 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9885 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9886 | /* default Acer -- disabled as it causes more problems. |
| 9887 | * model=auto should work fine now |
| 9888 | */ |
| 9889 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9890 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9891 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9892 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9894 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9895 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9896 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9898 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9899 | |
| 9900 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9901 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9902 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9903 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9904 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9905 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9906 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9907 | 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] | 9908 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9909 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9910 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9911 | |
| 9912 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9913 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9914 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9915 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9916 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9917 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9918 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9919 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9920 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9921 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9922 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9923 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9924 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9926 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9927 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9928 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9929 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9930 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9931 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9932 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9933 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9934 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9935 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9936 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9937 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9938 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9939 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9940 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9941 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9942 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9943 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9944 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9945 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9946 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9947 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9948 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9950 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9951 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9952 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9953 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9954 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9955 | 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] | 9956 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9957 | 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] | 9958 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9959 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9960 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9961 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9962 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9963 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9964 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9965 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9966 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9967 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9968 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9969 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9970 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9971 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9972 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9973 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9974 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9975 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9976 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9977 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9979 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9980 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9981 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9982 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9983 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9984 | {} |
| 9985 | }; |
| 9986 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9987 | /* codec SSID table for Intel Mac */ |
| 9988 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9989 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9990 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9991 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9992 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9993 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9994 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9995 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9996 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9997 | 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] | 9998 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9999 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10000 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10001 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10002 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10003 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10004 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10005 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10006 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10007 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10008 | */ |
| 10009 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10010 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10011 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10012 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10013 | }; |
| 10014 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10015 | static struct alc_config_preset alc882_presets[] = { |
| 10016 | [ALC882_3ST_DIG] = { |
| 10017 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10018 | .init_verbs = { alc882_base_init_verbs, |
| 10019 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10020 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10021 | .dac_nids = alc882_dac_nids, |
| 10022 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10023 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10024 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10025 | .channel_mode = alc882_ch_modes, |
| 10026 | .need_dac_fix = 1, |
| 10027 | .input_mux = &alc882_capture_source, |
| 10028 | }, |
| 10029 | [ALC882_6ST_DIG] = { |
| 10030 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10031 | .init_verbs = { alc882_base_init_verbs, |
| 10032 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10033 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10034 | .dac_nids = alc882_dac_nids, |
| 10035 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10036 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10037 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10038 | .channel_mode = alc882_sixstack_modes, |
| 10039 | .input_mux = &alc882_capture_source, |
| 10040 | }, |
| 10041 | [ALC882_ARIMA] = { |
| 10042 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10043 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10044 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10045 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10046 | .dac_nids = alc882_dac_nids, |
| 10047 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10048 | .channel_mode = alc882_sixstack_modes, |
| 10049 | .input_mux = &alc882_capture_source, |
| 10050 | }, |
| 10051 | [ALC882_W2JC] = { |
| 10052 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10053 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10054 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10055 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10056 | .dac_nids = alc882_dac_nids, |
| 10057 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10058 | .channel_mode = alc880_threestack_modes, |
| 10059 | .need_dac_fix = 1, |
| 10060 | .input_mux = &alc882_capture_source, |
| 10061 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10062 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10063 | [ALC885_MBA21] = { |
| 10064 | .mixers = { alc885_mba21_mixer }, |
| 10065 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10066 | .num_dacs = 2, |
| 10067 | .dac_nids = alc882_dac_nids, |
| 10068 | .channel_mode = alc885_mba21_ch_modes, |
| 10069 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10070 | .input_mux = &alc882_capture_source, |
| 10071 | .unsol_event = alc_automute_amp_unsol_event, |
| 10072 | .setup = alc885_mba21_setup, |
| 10073 | .init_hook = alc_automute_amp, |
| 10074 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10075 | [ALC885_MBP3] = { |
| 10076 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10077 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10078 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10079 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10080 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10081 | .hp_nid = 0x04, |
| 10082 | .channel_mode = alc885_mbp_4ch_modes, |
| 10083 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10084 | .input_mux = &alc882_capture_source, |
| 10085 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10086 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10087 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10088 | .setup = alc885_mbp3_setup, |
| 10089 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10090 | }, |
| 10091 | [ALC885_MB5] = { |
| 10092 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10093 | .init_verbs = { alc885_mb5_init_verbs, |
| 10094 | alc880_gpio1_init_verbs }, |
| 10095 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10096 | .dac_nids = alc882_dac_nids, |
| 10097 | .channel_mode = alc885_mb5_6ch_modes, |
| 10098 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10099 | .input_mux = &mb5_capture_source, |
| 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_mb5_setup, |
| 10104 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10105 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10106 | [ALC885_MACMINI3] = { |
| 10107 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10108 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10109 | alc880_gpio1_init_verbs }, |
| 10110 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10111 | .dac_nids = alc882_dac_nids, |
| 10112 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10113 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10114 | .input_mux = &macmini3_capture_source, |
| 10115 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10116 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10117 | .unsol_event = alc_automute_amp_unsol_event, |
| 10118 | .setup = alc885_macmini3_setup, |
| 10119 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10120 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10121 | [ALC885_MACPRO] = { |
| 10122 | .mixers = { alc882_macpro_mixer }, |
| 10123 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10124 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10125 | .dac_nids = alc882_dac_nids, |
| 10126 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10127 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10128 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10129 | .channel_mode = alc882_ch_modes, |
| 10130 | .input_mux = &alc882_capture_source, |
| 10131 | .init_hook = alc885_macpro_init_hook, |
| 10132 | }, |
| 10133 | [ALC885_IMAC24] = { |
| 10134 | .mixers = { alc885_imac24_mixer }, |
| 10135 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10136 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10137 | .dac_nids = alc882_dac_nids, |
| 10138 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10139 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10140 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10141 | .channel_mode = alc882_ch_modes, |
| 10142 | .input_mux = &alc882_capture_source, |
| 10143 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10144 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10145 | .init_hook = alc885_imac24_init_hook, |
| 10146 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10147 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10148 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10149 | .init_verbs = { alc885_imac91_init_verbs, |
| 10150 | alc880_gpio1_init_verbs }, |
| 10151 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10152 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10153 | .channel_mode = alc885_mba21_ch_modes, |
| 10154 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10155 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10156 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10157 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10158 | .unsol_event = alc_automute_amp_unsol_event, |
| 10159 | .setup = alc885_imac91_setup, |
| 10160 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10161 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10162 | [ALC882_TARGA] = { |
| 10163 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10164 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10165 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10166 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10167 | .dac_nids = alc882_dac_nids, |
| 10168 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10169 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10170 | .adc_nids = alc882_adc_nids, |
| 10171 | .capsrc_nids = alc882_capsrc_nids, |
| 10172 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10173 | .channel_mode = alc882_3ST_6ch_modes, |
| 10174 | .need_dac_fix = 1, |
| 10175 | .input_mux = &alc882_capture_source, |
| 10176 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10177 | .setup = alc882_targa_setup, |
| 10178 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10179 | }, |
| 10180 | [ALC882_ASUS_A7J] = { |
| 10181 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10182 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10183 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10184 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10185 | .dac_nids = alc882_dac_nids, |
| 10186 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10187 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10188 | .adc_nids = alc882_adc_nids, |
| 10189 | .capsrc_nids = alc882_capsrc_nids, |
| 10190 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10191 | .channel_mode = alc882_3ST_6ch_modes, |
| 10192 | .need_dac_fix = 1, |
| 10193 | .input_mux = &alc882_capture_source, |
| 10194 | }, |
| 10195 | [ALC882_ASUS_A7M] = { |
| 10196 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10197 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10198 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10199 | alc882_asus_a7m_verbs }, |
| 10200 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10201 | .dac_nids = alc882_dac_nids, |
| 10202 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10203 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10204 | .channel_mode = alc880_threestack_modes, |
| 10205 | .need_dac_fix = 1, |
| 10206 | .input_mux = &alc882_capture_source, |
| 10207 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10208 | [ALC883_3ST_2ch_DIG] = { |
| 10209 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10210 | .init_verbs = { alc883_init_verbs }, |
| 10211 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10212 | .dac_nids = alc883_dac_nids, |
| 10213 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10214 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10215 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10216 | .channel_mode = alc883_3ST_2ch_modes, |
| 10217 | .input_mux = &alc883_capture_source, |
| 10218 | }, |
| 10219 | [ALC883_3ST_6ch_DIG] = { |
| 10220 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10221 | .init_verbs = { alc883_init_verbs }, |
| 10222 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10223 | .dac_nids = alc883_dac_nids, |
| 10224 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10225 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10226 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10227 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10228 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10229 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10230 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10231 | [ALC883_3ST_6ch] = { |
| 10232 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10233 | .init_verbs = { alc883_init_verbs }, |
| 10234 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10235 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10236 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10237 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10238 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10239 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10240 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10241 | [ALC883_3ST_6ch_INTEL] = { |
| 10242 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10243 | .init_verbs = { alc883_init_verbs }, |
| 10244 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10245 | .dac_nids = alc883_dac_nids, |
| 10246 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10247 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10248 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10249 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10250 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10251 | .need_dac_fix = 1, |
| 10252 | .input_mux = &alc883_3stack_6ch_intel, |
| 10253 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10254 | [ALC889A_INTEL] = { |
| 10255 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10256 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10257 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10258 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10259 | .dac_nids = alc883_dac_nids, |
| 10260 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10261 | .adc_nids = alc889_adc_nids, |
| 10262 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10263 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10264 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10265 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10266 | .channel_mode = alc889_8ch_intel_modes, |
| 10267 | .capsrc_nids = alc889_capsrc_nids, |
| 10268 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10269 | .setup = alc889_automute_setup, |
| 10270 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10271 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10272 | .need_dac_fix = 1, |
| 10273 | }, |
| 10274 | [ALC889_INTEL] = { |
| 10275 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10276 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10277 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10278 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10279 | .dac_nids = alc883_dac_nids, |
| 10280 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10281 | .adc_nids = alc889_adc_nids, |
| 10282 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10283 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10284 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10285 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10286 | .channel_mode = alc889_8ch_intel_modes, |
| 10287 | .capsrc_nids = alc889_capsrc_nids, |
| 10288 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10289 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10290 | .init_hook = alc889_intel_init_hook, |
| 10291 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10292 | .need_dac_fix = 1, |
| 10293 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10294 | [ALC883_6ST_DIG] = { |
| 10295 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10296 | .init_verbs = { alc883_init_verbs }, |
| 10297 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10298 | .dac_nids = alc883_dac_nids, |
| 10299 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10300 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10301 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10302 | .channel_mode = alc883_sixstack_modes, |
| 10303 | .input_mux = &alc883_capture_source, |
| 10304 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10305 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10306 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10307 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10308 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10309 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10310 | .dac_nids = alc883_dac_nids, |
| 10311 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10312 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10313 | .channel_mode = alc883_3ST_6ch_modes, |
| 10314 | .need_dac_fix = 1, |
| 10315 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10316 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10317 | .setup = alc882_targa_setup, |
| 10318 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10319 | }, |
| 10320 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10321 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10322 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10323 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10324 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10325 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10326 | .adc_nids = alc883_adc_nids_alt, |
| 10327 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10328 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10329 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10330 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10331 | .channel_mode = alc883_3ST_2ch_modes, |
| 10332 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10333 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10334 | .setup = alc882_targa_setup, |
| 10335 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10336 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10337 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10338 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10339 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10340 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10341 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10342 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10343 | .dac_nids = alc883_dac_nids, |
| 10344 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10345 | .adc_nids = alc883_adc_nids_rev, |
| 10346 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10347 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10348 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10349 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10350 | .channel_mode = alc883_4ST_8ch_modes, |
| 10351 | .need_dac_fix = 1, |
| 10352 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10353 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10354 | .setup = alc882_targa_setup, |
| 10355 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10356 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10357 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10358 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10359 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10360 | * and the headphone jack. Turn this on and rely on the |
| 10361 | * standard mute methods whenever the user wants to turn |
| 10362 | * these outputs off. |
| 10363 | */ |
| 10364 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10365 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10366 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10367 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10368 | .channel_mode = alc883_3ST_2ch_modes, |
| 10369 | .input_mux = &alc883_capture_source, |
| 10370 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10371 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10372 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10373 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10375 | .dac_nids = alc883_dac_nids, |
| 10376 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10377 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10378 | .channel_mode = alc883_3ST_2ch_modes, |
| 10379 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10380 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10381 | .setup = alc883_acer_aspire_setup, |
| 10382 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10383 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10384 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame^] | 10385 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10386 | alc883_chmode_mixer }, |
| 10387 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10388 | alc888_acer_aspire_4930g_verbs }, |
| 10389 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10390 | .dac_nids = alc883_dac_nids, |
| 10391 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10392 | .adc_nids = alc883_adc_nids_rev, |
| 10393 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10394 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10395 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10396 | .channel_mode = alc883_3ST_6ch_modes, |
| 10397 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10398 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10399 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10400 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10401 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10402 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10403 | .setup = alc888_acer_aspire_4930g_setup, |
| 10404 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10405 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10406 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10407 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10408 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10409 | alc888_acer_aspire_6530g_verbs }, |
| 10410 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10411 | .dac_nids = alc883_dac_nids, |
| 10412 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10413 | .adc_nids = alc883_adc_nids_rev, |
| 10414 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10415 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10416 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10417 | .channel_mode = alc883_3ST_2ch_modes, |
| 10418 | .num_mux_defs = |
| 10419 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10420 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10421 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10422 | .setup = alc888_acer_aspire_6530g_setup, |
| 10423 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10424 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10425 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10426 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10427 | alc883_chmode_mixer }, |
| 10428 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10429 | alc889_acer_aspire_8930g_verbs, |
| 10430 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10431 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10432 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10433 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10434 | .adc_nids = alc889_adc_nids, |
| 10435 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10436 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10438 | .channel_mode = alc883_3ST_6ch_modes, |
| 10439 | .need_dac_fix = 1, |
| 10440 | .const_channel_count = 6, |
| 10441 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10442 | ARRAY_SIZE(alc889_capture_sources), |
| 10443 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10444 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10445 | .setup = alc889_acer_aspire_8930g_setup, |
| 10446 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10447 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10448 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10449 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10450 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10451 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10452 | .mixers = { alc883_3ST_6ch_mixer, |
| 10453 | alc883_chmode_mixer }, |
| 10454 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10455 | alc888_acer_aspire_7730G_verbs }, |
| 10456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10457 | .dac_nids = alc883_dac_nids, |
| 10458 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10459 | .adc_nids = alc883_adc_nids_rev, |
| 10460 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10461 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10462 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10463 | .channel_mode = alc883_3ST_6ch_modes, |
| 10464 | .need_dac_fix = 1, |
| 10465 | .const_channel_count = 6, |
| 10466 | .input_mux = &alc883_capture_source, |
| 10467 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10468 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10469 | .init_hook = alc_automute_amp, |
| 10470 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10471 | [ALC883_MEDION] = { |
| 10472 | .mixers = { alc883_fivestack_mixer, |
| 10473 | alc883_chmode_mixer }, |
| 10474 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10475 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10476 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10477 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10478 | .adc_nids = alc883_adc_nids_alt, |
| 10479 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10480 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10481 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10482 | .channel_mode = alc883_sixstack_modes, |
| 10483 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10484 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10485 | [ALC883_MEDION_WIM2160] = { |
| 10486 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10487 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10488 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10489 | .dac_nids = alc883_dac_nids, |
| 10490 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10491 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10492 | .adc_nids = alc883_adc_nids, |
| 10493 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10494 | .channel_mode = alc883_3ST_2ch_modes, |
| 10495 | .input_mux = &alc883_capture_source, |
| 10496 | .unsol_event = alc_automute_amp_unsol_event, |
| 10497 | .setup = alc883_medion_wim2160_setup, |
| 10498 | .init_hook = alc_automute_amp, |
| 10499 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10500 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10501 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10502 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10503 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10504 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10505 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10506 | .channel_mode = alc883_3ST_2ch_modes, |
| 10507 | .input_mux = &alc883_capture_source, |
| 10508 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10509 | [ALC883_CLEVO_M540R] = { |
| 10510 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10511 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10512 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10513 | .dac_nids = alc883_dac_nids, |
| 10514 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10515 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10516 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10517 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10518 | .need_dac_fix = 1, |
| 10519 | .input_mux = &alc883_capture_source, |
| 10520 | /* This machine has the hardware HP auto-muting, thus |
| 10521 | * we need no software mute via unsol event |
| 10522 | */ |
| 10523 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10524 | [ALC883_CLEVO_M720] = { |
| 10525 | .mixers = { alc883_clevo_m720_mixer }, |
| 10526 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10527 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10528 | .dac_nids = alc883_dac_nids, |
| 10529 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10530 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10531 | .channel_mode = alc883_3ST_2ch_modes, |
| 10532 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10533 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10534 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10535 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10536 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10537 | [ALC883_LENOVO_101E_2ch] = { |
| 10538 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10539 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10540 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10541 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10542 | .adc_nids = alc883_adc_nids_alt, |
| 10543 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10544 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10545 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10546 | .channel_mode = alc883_3ST_2ch_modes, |
| 10547 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10548 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10549 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10550 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10551 | [ALC883_LENOVO_NB0763] = { |
| 10552 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10553 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10554 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10555 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10556 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10557 | .channel_mode = alc883_3ST_2ch_modes, |
| 10558 | .need_dac_fix = 1, |
| 10559 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10560 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10561 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10562 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10563 | }, |
| 10564 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10565 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10566 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10567 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10568 | .dac_nids = alc883_dac_nids, |
| 10569 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10570 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10571 | .channel_mode = alc883_3ST_6ch_modes, |
| 10572 | .need_dac_fix = 1, |
| 10573 | .input_mux = &alc883_capture_source, |
| 10574 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10575 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10576 | }, |
| 10577 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10578 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10579 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10580 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10581 | .dac_nids = alc883_dac_nids, |
| 10582 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10583 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10584 | .channel_mode = alc883_3ST_2ch_modes, |
| 10585 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10586 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10587 | .setup = alc883_haier_w66_setup, |
| 10588 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10589 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10590 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10591 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10592 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10593 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10594 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10595 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10596 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10597 | .need_dac_fix = 1, |
| 10598 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10599 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10600 | .setup = alc888_3st_hp_setup, |
| 10601 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10602 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10603 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10604 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10605 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10606 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10607 | .dac_nids = alc883_dac_nids, |
| 10608 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10609 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10610 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10611 | .channel_mode = alc883_sixstack_modes, |
| 10612 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10613 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10614 | .setup = alc888_6st_dell_setup, |
| 10615 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10616 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10617 | [ALC883_MITAC] = { |
| 10618 | .mixers = { alc883_mitac_mixer }, |
| 10619 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10620 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10621 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10622 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10623 | .channel_mode = alc883_3ST_2ch_modes, |
| 10624 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10625 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10626 | .setup = alc883_mitac_setup, |
| 10627 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10628 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10629 | [ALC883_FUJITSU_PI2515] = { |
| 10630 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10631 | .init_verbs = { alc883_init_verbs, |
| 10632 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10633 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10634 | .dac_nids = alc883_dac_nids, |
| 10635 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10636 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10637 | .channel_mode = alc883_3ST_2ch_modes, |
| 10638 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10639 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10640 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10641 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10642 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10643 | [ALC888_FUJITSU_XA3530] = { |
| 10644 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10645 | .init_verbs = { alc883_init_verbs, |
| 10646 | alc888_fujitsu_xa3530_verbs }, |
| 10647 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10648 | .dac_nids = alc883_dac_nids, |
| 10649 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10650 | .adc_nids = alc883_adc_nids_rev, |
| 10651 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10652 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10653 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10654 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10655 | .num_mux_defs = |
| 10656 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10657 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10658 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10659 | .setup = alc888_fujitsu_xa3530_setup, |
| 10660 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10661 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10662 | [ALC888_LENOVO_SKY] = { |
| 10663 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10664 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10665 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10666 | .dac_nids = alc883_dac_nids, |
| 10667 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10668 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10669 | .channel_mode = alc883_sixstack_modes, |
| 10670 | .need_dac_fix = 1, |
| 10671 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10672 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10673 | .setup = alc888_lenovo_sky_setup, |
| 10674 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10675 | }, |
| 10676 | [ALC888_ASUS_M90V] = { |
| 10677 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10678 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10679 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10680 | .dac_nids = alc883_dac_nids, |
| 10681 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10682 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10683 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10684 | .channel_mode = alc883_3ST_6ch_modes, |
| 10685 | .need_dac_fix = 1, |
| 10686 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10687 | .unsol_event = alc_sku_unsol_event, |
| 10688 | .setup = alc883_mode2_setup, |
| 10689 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10690 | }, |
| 10691 | [ALC888_ASUS_EEE1601] = { |
| 10692 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10693 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10694 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10695 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10696 | .dac_nids = alc883_dac_nids, |
| 10697 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10698 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10699 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10700 | .channel_mode = alc883_3ST_2ch_modes, |
| 10701 | .need_dac_fix = 1, |
| 10702 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10703 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10704 | .init_hook = alc883_eee1601_inithook, |
| 10705 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10706 | [ALC1200_ASUS_P5Q] = { |
| 10707 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10708 | .init_verbs = { alc883_init_verbs }, |
| 10709 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10710 | .dac_nids = alc883_dac_nids, |
| 10711 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10712 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10713 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10714 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10715 | .channel_mode = alc883_sixstack_modes, |
| 10716 | .input_mux = &alc883_capture_source, |
| 10717 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10718 | [ALC889A_MB31] = { |
| 10719 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10720 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10721 | alc880_gpio1_init_verbs }, |
| 10722 | .adc_nids = alc883_adc_nids, |
| 10723 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10724 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10725 | .dac_nids = alc883_dac_nids, |
| 10726 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10727 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10728 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10729 | .input_mux = &alc889A_mb31_capture_source, |
| 10730 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10731 | .unsol_event = alc889A_mb31_unsol_event, |
| 10732 | .init_hook = alc889A_mb31_automute, |
| 10733 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10734 | [ALC883_SONY_VAIO_TT] = { |
| 10735 | .mixers = { alc883_vaiott_mixer }, |
| 10736 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10737 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10738 | .dac_nids = alc883_dac_nids, |
| 10739 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10740 | .channel_mode = alc883_3ST_2ch_modes, |
| 10741 | .input_mux = &alc883_capture_source, |
| 10742 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10743 | .setup = alc883_vaiott_setup, |
| 10744 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10745 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10746 | }; |
| 10747 | |
| 10748 | |
| 10749 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10750 | * Pin config fixes |
| 10751 | */ |
| 10752 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10753 | PINFIX_ABIT_AW9D_MAX, |
| 10754 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10755 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10756 | }; |
| 10757 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10758 | static const struct alc_fixup alc882_fixups[] = { |
| 10759 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10760 | .type = ALC_FIXUP_PINS, |
| 10761 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10762 | { 0x15, 0x01080104 }, /* side */ |
| 10763 | { 0x16, 0x01011012 }, /* rear */ |
| 10764 | { 0x17, 0x01016011 }, /* clfe */ |
| 10765 | { } |
| 10766 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10767 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10768 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10769 | .type = ALC_FIXUP_VERBS, |
| 10770 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10771 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10772 | {} |
| 10773 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10774 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10775 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10776 | .type = ALC_FIXUP_SKU, |
| 10777 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10778 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10779 | }; |
| 10780 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10781 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10782 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10783 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10784 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10785 | {} |
| 10786 | }; |
| 10787 | |
| 10788 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10789 | * BIOS auto configuration |
| 10790 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10791 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10792 | const struct auto_pin_cfg *cfg) |
| 10793 | { |
| 10794 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10795 | } |
| 10796 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10797 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10798 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10799 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10800 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10801 | int idx; |
| 10802 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10803 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10804 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10805 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10806 | if (dac == 0x25) |
| 10807 | idx = 4; |
| 10808 | else if (dac >= 0x02 && dac <= 0x05) |
| 10809 | idx = dac - 2; |
| 10810 | else |
| 10811 | return; |
| 10812 | 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] | 10813 | } |
| 10814 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10815 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10816 | { |
| 10817 | struct alc_spec *spec = codec->spec; |
| 10818 | int i; |
| 10819 | |
| 10820 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10821 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10822 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10823 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10824 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10825 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10826 | } |
| 10827 | } |
| 10828 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10829 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10830 | { |
| 10831 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10832 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10833 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10834 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10835 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10836 | pin = spec->autocfg.hp_pins[i]; |
| 10837 | if (!pin) |
| 10838 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10839 | dac = spec->multiout.hp_nid; |
| 10840 | if (!dac) |
| 10841 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10842 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10843 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10844 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10845 | pin = spec->autocfg.speaker_pins[i]; |
| 10846 | if (!pin) |
| 10847 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10848 | dac = spec->multiout.extra_out_nid[0]; |
| 10849 | if (!dac) |
| 10850 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10851 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10852 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10853 | } |
| 10854 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10855 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10856 | { |
| 10857 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10858 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10859 | int i; |
| 10860 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10861 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10862 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10863 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10864 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10865 | snd_hda_codec_write(codec, nid, 0, |
| 10866 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10867 | AMP_OUT_MUTE); |
| 10868 | } |
| 10869 | } |
| 10870 | |
| 10871 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10872 | { |
| 10873 | struct alc_spec *spec = codec->spec; |
| 10874 | int c; |
| 10875 | |
| 10876 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10877 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10878 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10879 | unsigned int mux_idx; |
| 10880 | const struct hda_input_mux *imux; |
| 10881 | int conns, mute, idx, item; |
| 10882 | |
| 10883 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10884 | ARRAY_SIZE(conn_list)); |
| 10885 | if (conns < 0) |
| 10886 | continue; |
| 10887 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10888 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10889 | if (!imux->num_items && mux_idx > 0) |
| 10890 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10891 | for (idx = 0; idx < conns; idx++) { |
| 10892 | /* if the current connection is the selected one, |
| 10893 | * unmute it as default - otherwise mute it |
| 10894 | */ |
| 10895 | mute = AMP_IN_MUTE(idx); |
| 10896 | for (item = 0; item < imux->num_items; item++) { |
| 10897 | if (imux->items[item].index == idx) { |
| 10898 | if (spec->cur_mux[c] == item) |
| 10899 | mute = AMP_IN_UNMUTE(idx); |
| 10900 | break; |
| 10901 | } |
| 10902 | } |
| 10903 | /* check if we have a selector or mixer |
| 10904 | * we could check for the widget type instead, but |
| 10905 | * just check for Amp-In presence (in case of mixer |
| 10906 | * without amp-in there is something wrong, this |
| 10907 | * function shouldn't be used or capsrc nid is wrong) |
| 10908 | */ |
| 10909 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10910 | snd_hda_codec_write(codec, nid, 0, |
| 10911 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10912 | mute); |
| 10913 | else if (mute != AMP_IN_MUTE(idx)) |
| 10914 | snd_hda_codec_write(codec, nid, 0, |
| 10915 | AC_VERB_SET_CONNECT_SEL, |
| 10916 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10917 | } |
| 10918 | } |
| 10919 | } |
| 10920 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10921 | /* add mic boosts if needed */ |
| 10922 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10923 | { |
| 10924 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10925 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10926 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10927 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10928 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10929 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10930 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10931 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10932 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10933 | break; |
| 10934 | nid = cfg->inputs[i].pin; |
| 10935 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10936 | const char *label; |
| 10937 | char boost_label[32]; |
| 10938 | |
| 10939 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10940 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10941 | type_idx++; |
| 10942 | else |
| 10943 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10944 | prev_label = label; |
| 10945 | |
| 10946 | snprintf(boost_label, sizeof(boost_label), |
| 10947 | "%s Boost Volume", label); |
| 10948 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10949 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10950 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10951 | if (err < 0) |
| 10952 | return err; |
| 10953 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10954 | } |
| 10955 | return 0; |
| 10956 | } |
| 10957 | |
| 10958 | /* almost identical with ALC880 parser... */ |
| 10959 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10960 | { |
| 10961 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10962 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10963 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10964 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10965 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10966 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10967 | if (err < 0) |
| 10968 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10969 | if (!spec->autocfg.line_outs) |
| 10970 | return 0; /* can't find valid BIOS pin config */ |
| 10971 | |
| 10972 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10973 | if (err < 0) |
| 10974 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 10975 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10976 | if (err < 0) |
| 10977 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10978 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10979 | "Headphone"); |
| 10980 | if (err < 0) |
| 10981 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10982 | err = alc880_auto_create_extra_out(spec, |
| 10983 | spec->autocfg.speaker_pins[0], |
| 10984 | "Speaker"); |
| 10985 | if (err < 0) |
| 10986 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10987 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10988 | if (err < 0) |
| 10989 | return err; |
| 10990 | |
| 10991 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10992 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10993 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10994 | |
| 10995 | if (spec->kctls.list) |
| 10996 | add_mixer(spec, spec->kctls.list); |
| 10997 | |
| 10998 | add_verb(spec, alc883_auto_init_verbs); |
| 10999 | /* if ADC 0x07 is available, initialize it, too */ |
| 11000 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 11001 | add_verb(spec, alc882_adc1_init_verbs); |
| 11002 | |
| 11003 | spec->num_mux_defs = 1; |
| 11004 | spec->input_mux = &spec->private_imux[0]; |
| 11005 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11006 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11007 | |
| 11008 | err = alc_auto_add_mic_boost(codec); |
| 11009 | if (err < 0) |
| 11010 | return err; |
| 11011 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11012 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11013 | } |
| 11014 | |
| 11015 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11016 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11017 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11018 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11019 | alc882_auto_init_multi_out(codec); |
| 11020 | alc882_auto_init_hp_out(codec); |
| 11021 | alc882_auto_init_analog_input(codec); |
| 11022 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11023 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11024 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11025 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11026 | } |
| 11027 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11028 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11029 | { |
| 11030 | struct alc_spec *spec; |
| 11031 | int err, board_config; |
| 11032 | |
| 11033 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11034 | if (spec == NULL) |
| 11035 | return -ENOMEM; |
| 11036 | |
| 11037 | codec->spec = spec; |
| 11038 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11039 | switch (codec->vendor_id) { |
| 11040 | case 0x10ec0882: |
| 11041 | case 0x10ec0885: |
| 11042 | break; |
| 11043 | default: |
| 11044 | /* ALC883 and variants */ |
| 11045 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11046 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11047 | } |
| 11048 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11049 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11050 | alc882_models, |
| 11051 | alc882_cfg_tbl); |
| 11052 | |
| 11053 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11054 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11055 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11056 | |
| 11057 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11058 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11059 | codec->chip_name); |
| 11060 | board_config = ALC882_AUTO; |
| 11061 | } |
| 11062 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11063 | if (board_config == ALC882_AUTO) { |
| 11064 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11065 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11066 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11067 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11068 | alc_auto_parse_customize_define(codec); |
| 11069 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11070 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11071 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11072 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11073 | if (err < 0) { |
| 11074 | alc_free(codec); |
| 11075 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11076 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11077 | printk(KERN_INFO |
| 11078 | "hda_codec: Cannot set up configuration " |
| 11079 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11080 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11081 | } |
| 11082 | } |
| 11083 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11084 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11085 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11086 | if (err < 0) { |
| 11087 | alc_free(codec); |
| 11088 | return err; |
| 11089 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11090 | } |
| 11091 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11092 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11093 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11094 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11095 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11096 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11097 | /* FIXME: setup DAC5 */ |
| 11098 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11099 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11100 | |
| 11101 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11102 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11103 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11104 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11105 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11106 | spec->num_adc_nids = 0; |
| 11107 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11108 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11109 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11110 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11111 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11112 | unsigned int wcap = get_wcaps(codec, nid); |
| 11113 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11114 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11115 | if (wcap != AC_WID_AUD_IN) |
| 11116 | continue; |
| 11117 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11118 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11119 | if (err < 0) |
| 11120 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11121 | err = snd_hda_get_connections(codec, cap, items, |
| 11122 | ARRAY_SIZE(items)); |
| 11123 | if (err < 0) |
| 11124 | continue; |
| 11125 | for (j = 0; j < imux->num_items; j++) |
| 11126 | if (imux->items[j].index >= err) |
| 11127 | break; |
| 11128 | if (j < imux->num_items) |
| 11129 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11130 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11131 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11132 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11133 | spec->adc_nids = spec->private_adc_nids; |
| 11134 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11135 | } |
| 11136 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11137 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11138 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11139 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11140 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11141 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11142 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11143 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11144 | spec->vmaster_nid = 0x0c; |
| 11145 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11146 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11147 | if (board_config == ALC882_AUTO) |
| 11148 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11149 | |
| 11150 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11151 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11152 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11153 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11154 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11155 | |
| 11156 | return 0; |
| 11157 | } |
| 11158 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11159 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11160 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11161 | * ALC262 support |
| 11162 | */ |
| 11163 | |
| 11164 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11165 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11166 | |
| 11167 | #define alc262_dac_nids alc260_dac_nids |
| 11168 | #define alc262_adc_nids alc882_adc_nids |
| 11169 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11170 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11171 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11172 | |
| 11173 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11174 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11175 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11176 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11177 | /* ADC0 */ |
| 11178 | 0x09 |
| 11179 | }; |
| 11180 | |
| 11181 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11183 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11184 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11185 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11186 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11187 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11188 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11189 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11192 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11193 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11194 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11195 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11196 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11197 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11198 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11199 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11200 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11201 | }; |
| 11202 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11203 | /* update HP, line and mono-out pins according to the master switch */ |
| 11204 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11205 | { |
| 11206 | struct alc_spec *spec = codec->spec; |
| 11207 | int val = spec->master_sw; |
| 11208 | |
| 11209 | /* HP & line-out */ |
| 11210 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11211 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11212 | val ? PIN_HP : 0); |
| 11213 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11214 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11215 | val ? PIN_HP : 0); |
| 11216 | /* mono (speaker) depending on the HP jack sense */ |
| 11217 | val = val && !spec->jack_present; |
| 11218 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11219 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11220 | val ? PIN_OUT : 0); |
| 11221 | } |
| 11222 | |
| 11223 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11224 | { |
| 11225 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11226 | |
| 11227 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11228 | alc262_hp_master_update(codec); |
| 11229 | } |
| 11230 | |
| 11231 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11232 | { |
| 11233 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11234 | return; |
| 11235 | alc262_hp_bpc_automute(codec); |
| 11236 | } |
| 11237 | |
| 11238 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11239 | { |
| 11240 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11241 | |
| 11242 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11243 | alc262_hp_master_update(codec); |
| 11244 | } |
| 11245 | |
| 11246 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11247 | unsigned int res) |
| 11248 | { |
| 11249 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11250 | return; |
| 11251 | alc262_hp_wildwest_automute(codec); |
| 11252 | } |
| 11253 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11254 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11255 | |
| 11256 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11257 | struct snd_ctl_elem_value *ucontrol) |
| 11258 | { |
| 11259 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11260 | struct alc_spec *spec = codec->spec; |
| 11261 | int val = !!*ucontrol->value.integer.value; |
| 11262 | |
| 11263 | if (val == spec->master_sw) |
| 11264 | return 0; |
| 11265 | spec->master_sw = val; |
| 11266 | alc262_hp_master_update(codec); |
| 11267 | return 1; |
| 11268 | } |
| 11269 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11270 | #define ALC262_HP_MASTER_SWITCH \ |
| 11271 | { \ |
| 11272 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11273 | .name = "Master Playback Switch", \ |
| 11274 | .info = snd_ctl_boolean_mono_info, \ |
| 11275 | .get = alc262_hp_master_sw_get, \ |
| 11276 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11277 | }, \ |
| 11278 | { \ |
| 11279 | .iface = NID_MAPPING, \ |
| 11280 | .name = "Master Playback Switch", \ |
| 11281 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11282 | } |
| 11283 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11284 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11285 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11286 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11287 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11288 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11290 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11291 | HDA_OUTPUT), |
| 11292 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11293 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11294 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11295 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11296 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11297 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11298 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11299 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11300 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11301 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11303 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11304 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11305 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11306 | { } /* end */ |
| 11307 | }; |
| 11308 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11309 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11310 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11311 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11312 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11313 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11314 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11315 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11316 | HDA_OUTPUT), |
| 11317 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11318 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11319 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11320 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11321 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11322 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11323 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11324 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11325 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11326 | { } /* end */ |
| 11327 | }; |
| 11328 | |
| 11329 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11330 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11331 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11332 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11333 | { } /* end */ |
| 11334 | }; |
| 11335 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11336 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11337 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11338 | { |
| 11339 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11340 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11341 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11342 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11343 | } |
| 11344 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11345 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11346 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11347 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11348 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11352 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11353 | { } /* end */ |
| 11354 | }; |
| 11355 | |
| 11356 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11357 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11359 | |
| 11360 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11361 | { } |
| 11362 | }; |
| 11363 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11364 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11365 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11367 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11368 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11369 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11370 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11371 | { } /* end */ |
| 11372 | }; |
| 11373 | |
| 11374 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11375 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11376 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11377 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11378 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11379 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11380 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11381 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11383 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11385 | {} |
| 11386 | }; |
| 11387 | |
| 11388 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11389 | .num_items = 1, |
| 11390 | .items = { |
| 11391 | { "Line", 0x1 }, |
| 11392 | }, |
| 11393 | }; |
| 11394 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11395 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11396 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11397 | { |
| 11398 | struct alc_spec *spec = codec->spec; |
| 11399 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11400 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11401 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11402 | unsigned int mute; |
| 11403 | |
| 11404 | /* HP */ |
| 11405 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11406 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11407 | HDA_AMP_MUTE, mute); |
| 11408 | /* mute internal speaker per jack sense */ |
| 11409 | if (spec->jack_present) |
| 11410 | mute = HDA_AMP_MUTE; |
| 11411 | if (line_nid) |
| 11412 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11413 | HDA_AMP_MUTE, mute); |
| 11414 | if (speaker_nid && speaker_nid != line_nid) |
| 11415 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11416 | HDA_AMP_MUTE, mute); |
| 11417 | } |
| 11418 | |
| 11419 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11420 | |
| 11421 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11422 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11423 | { |
| 11424 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11425 | struct alc_spec *spec = codec->spec; |
| 11426 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11427 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11428 | if (val == spec->master_sw) |
| 11429 | return 0; |
| 11430 | spec->master_sw = val; |
| 11431 | alc262_hippo_master_update(codec); |
| 11432 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11433 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11434 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11435 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11436 | { \ |
| 11437 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11438 | .name = "Master Playback Switch", \ |
| 11439 | .info = snd_ctl_boolean_mono_info, \ |
| 11440 | .get = alc262_hippo_master_sw_get, \ |
| 11441 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11442 | }, \ |
| 11443 | { \ |
| 11444 | .iface = NID_MAPPING, \ |
| 11445 | .name = "Master Playback Switch", \ |
| 11446 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11447 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11448 | } |
| 11449 | |
| 11450 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11451 | ALC262_HIPPO_MASTER_SWITCH, |
| 11452 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11454 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11455 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11456 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11459 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11460 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11461 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11462 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11463 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11464 | { } /* end */ |
| 11465 | }; |
| 11466 | |
| 11467 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11468 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11469 | ALC262_HIPPO_MASTER_SWITCH, |
| 11470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11473 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11475 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11476 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11477 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11478 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11479 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11480 | { } /* end */ |
| 11481 | }; |
| 11482 | |
| 11483 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11484 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11485 | { |
| 11486 | struct alc_spec *spec = codec->spec; |
| 11487 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11488 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11489 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11490 | alc262_hippo_master_update(codec); |
| 11491 | } |
| 11492 | |
| 11493 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11494 | { |
| 11495 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11496 | return; |
| 11497 | alc262_hippo_automute(codec); |
| 11498 | } |
| 11499 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11500 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11501 | { |
| 11502 | struct alc_spec *spec = codec->spec; |
| 11503 | |
| 11504 | spec->autocfg.hp_pins[0] = 0x15; |
| 11505 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11506 | } |
| 11507 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11508 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11509 | { |
| 11510 | struct alc_spec *spec = codec->spec; |
| 11511 | |
| 11512 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11513 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11514 | } |
| 11515 | |
| 11516 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11517 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11518 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11519 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11520 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11521 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11522 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11523 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11524 | { } /* end */ |
| 11525 | }; |
| 11526 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11527 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11528 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11529 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11530 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11533 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11534 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11535 | { } /* end */ |
| 11536 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11537 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11538 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11539 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11540 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11541 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11542 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11543 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11544 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11547 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11548 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11549 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11550 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11551 | { } /* end */ |
| 11552 | }; |
| 11553 | |
| 11554 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11555 | /* Headphone automute */ |
| 11556 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11557 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11558 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11559 | |
| 11560 | /* P11 AUX_IN, white 4-pin connector */ |
| 11561 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11562 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11563 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11564 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11565 | |
| 11566 | {} |
| 11567 | }; |
| 11568 | |
| 11569 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11570 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11571 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11572 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11573 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11574 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11575 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11576 | } |
| 11577 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11578 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11579 | #define alc262_capture_mixer alc882_capture_mixer |
| 11580 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11581 | |
| 11582 | /* |
| 11583 | * generic initialization of ADC, input mixers and output mixers |
| 11584 | */ |
| 11585 | static struct hda_verb alc262_init_verbs[] = { |
| 11586 | /* |
| 11587 | * Unmute ADC0-2 and set the default input to mic-in |
| 11588 | */ |
| 11589 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11591 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11592 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11593 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11594 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11595 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11596 | /* 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] | 11597 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11598 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11599 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11600 | */ |
| 11601 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11603 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11604 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11605 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11606 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11607 | |
| 11608 | /* |
| 11609 | * Set up output mixers (0x0c - 0x0e) |
| 11610 | */ |
| 11611 | /* set vol=0 to output mixers */ |
| 11612 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11613 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11614 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11615 | /* set up input amps for analog loopback */ |
| 11616 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11623 | |
| 11624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11625 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11626 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11627 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11629 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11630 | |
| 11631 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11632 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11633 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11634 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11635 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11636 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11637 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11638 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11640 | /* FIXME: use matrix-type input source selection */ |
| 11641 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11642 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11646 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11647 | /* Input mixer2 */ |
| 11648 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11651 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11652 | /* Input mixer3 */ |
| 11653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11655 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11656 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11657 | |
| 11658 | { } |
| 11659 | }; |
| 11660 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11661 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11662 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11663 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11664 | { } |
| 11665 | }; |
| 11666 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11667 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11668 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11669 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11670 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11671 | |
| 11672 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11673 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11674 | {} |
| 11675 | }; |
| 11676 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11677 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11678 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11679 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11680 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11681 | |
| 11682 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11684 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11685 | }; |
| 11686 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11687 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11688 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11689 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11690 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11693 | { } /* end */ |
| 11694 | }; |
| 11695 | |
| 11696 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11697 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11699 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11700 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11701 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11702 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11703 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11704 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11705 | {} |
| 11706 | }; |
| 11707 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11708 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11709 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11710 | struct alc_spec *spec = codec->spec; |
| 11711 | |
| 11712 | spec->autocfg.hp_pins[0] = 0x15; |
| 11713 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11714 | spec->ext_mic.pin = 0x18; |
| 11715 | spec->ext_mic.mux_idx = 0; |
| 11716 | spec->int_mic.pin = 0x12; |
| 11717 | spec->int_mic.mux_idx = 9; |
| 11718 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11719 | } |
| 11720 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11721 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11722 | * nec model |
| 11723 | * 0x15 = headphone |
| 11724 | * 0x16 = internal speaker |
| 11725 | * 0x18 = external mic |
| 11726 | */ |
| 11727 | |
| 11728 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11729 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11730 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11731 | |
| 11732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11734 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11735 | |
| 11736 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11737 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11738 | { } /* end */ |
| 11739 | }; |
| 11740 | |
| 11741 | static struct hda_verb alc262_nec_verbs[] = { |
| 11742 | /* Unmute Speaker */ |
| 11743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11744 | |
| 11745 | /* Headphone */ |
| 11746 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11747 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11748 | |
| 11749 | /* External mic to headphone */ |
| 11750 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11751 | /* External mic to speaker */ |
| 11752 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11753 | {} |
| 11754 | }; |
| 11755 | |
| 11756 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11757 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11758 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11759 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11760 | */ |
| 11761 | |
| 11762 | #define ALC_HP_EVENT 0x37 |
| 11763 | |
| 11764 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11765 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11767 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11769 | {} |
| 11770 | }; |
| 11771 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11772 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11773 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11774 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11775 | {} |
| 11776 | }; |
| 11777 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11778 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11779 | /* Front Mic pin: input vref at 50% */ |
| 11780 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11781 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11782 | {} |
| 11783 | }; |
| 11784 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11785 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11786 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11787 | .items = { |
| 11788 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11789 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11790 | { "CD", 0x4 }, |
| 11791 | }, |
| 11792 | }; |
| 11793 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11794 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11795 | .num_items = 5, |
| 11796 | .items = { |
| 11797 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11798 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11799 | { "Line", 0x2 }, |
| 11800 | { "CD", 0x4 }, |
| 11801 | { "AUX IN", 0x6 }, |
| 11802 | }, |
| 11803 | }; |
| 11804 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11805 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11806 | .num_items = 4, |
| 11807 | .items = { |
| 11808 | { "Mic", 0x0 }, |
| 11809 | { "Front Mic", 0x2 }, |
| 11810 | { "Line", 0x1 }, |
| 11811 | { "CD", 0x4 }, |
| 11812 | }, |
| 11813 | }; |
| 11814 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11815 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11816 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11817 | { |
| 11818 | struct alc_spec *spec = codec->spec; |
| 11819 | unsigned int mute; |
| 11820 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11821 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11822 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11823 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11824 | spec->sense_updated = 1; |
| 11825 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11826 | /* unmute internal speaker only if both HPs are unplugged and |
| 11827 | * master switch is on |
| 11828 | */ |
| 11829 | if (spec->jack_present) |
| 11830 | mute = HDA_AMP_MUTE; |
| 11831 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11832 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11833 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11834 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11835 | } |
| 11836 | |
| 11837 | /* unsolicited event for HP jack sensing */ |
| 11838 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11839 | unsigned int res) |
| 11840 | { |
| 11841 | if ((res >> 26) != ALC_HP_EVENT) |
| 11842 | return; |
| 11843 | alc262_fujitsu_automute(codec, 1); |
| 11844 | } |
| 11845 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11846 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11847 | { |
| 11848 | alc262_fujitsu_automute(codec, 1); |
| 11849 | } |
| 11850 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11851 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11852 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11853 | .ops = &snd_hda_bind_vol, |
| 11854 | .values = { |
| 11855 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11856 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11857 | 0 |
| 11858 | }, |
| 11859 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11860 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11861 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11862 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11863 | { |
| 11864 | struct alc_spec *spec = codec->spec; |
| 11865 | unsigned int mute; |
| 11866 | |
| 11867 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11868 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11869 | spec->sense_updated = 1; |
| 11870 | } |
| 11871 | if (spec->jack_present) { |
| 11872 | /* mute internal speaker */ |
| 11873 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11874 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11875 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11876 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11877 | } else { |
| 11878 | /* unmute internal speaker if necessary */ |
| 11879 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11880 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11881 | HDA_AMP_MUTE, mute); |
| 11882 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11883 | HDA_AMP_MUTE, mute); |
| 11884 | } |
| 11885 | } |
| 11886 | |
| 11887 | /* unsolicited event for HP jack sensing */ |
| 11888 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11889 | unsigned int res) |
| 11890 | { |
| 11891 | if ((res >> 26) != ALC_HP_EVENT) |
| 11892 | return; |
| 11893 | alc262_lenovo_3000_automute(codec, 1); |
| 11894 | } |
| 11895 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11896 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11897 | int dir, int idx, long *valp) |
| 11898 | { |
| 11899 | int i, change = 0; |
| 11900 | |
| 11901 | for (i = 0; i < 2; i++, valp++) |
| 11902 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11903 | HDA_AMP_MUTE, |
| 11904 | *valp ? 0 : HDA_AMP_MUTE); |
| 11905 | return change; |
| 11906 | } |
| 11907 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11908 | /* bind hp and internal speaker mute (with plug check) */ |
| 11909 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11910 | struct snd_ctl_elem_value *ucontrol) |
| 11911 | { |
| 11912 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11913 | long *valp = ucontrol->value.integer.value; |
| 11914 | int change; |
| 11915 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11916 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11917 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11918 | if (change) |
| 11919 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11920 | return change; |
| 11921 | } |
| 11922 | |
| 11923 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11924 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 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, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11929 | .info = snd_hda_mixer_amp_switch_info, |
| 11930 | .get = snd_hda_mixer_amp_switch_get, |
| 11931 | .put = alc262_fujitsu_master_sw_put, |
| 11932 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11933 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11934 | { |
| 11935 | .iface = NID_MAPPING, |
| 11936 | .name = "Master Playback Switch", |
| 11937 | .private_value = 0x1b, |
| 11938 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11939 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11940 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11941 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11944 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11945 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11946 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11947 | { } /* end */ |
| 11948 | }; |
| 11949 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11950 | /* bind hp and internal speaker mute (with plug check) */ |
| 11951 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11952 | struct snd_ctl_elem_value *ucontrol) |
| 11953 | { |
| 11954 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11955 | long *valp = ucontrol->value.integer.value; |
| 11956 | int change; |
| 11957 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11958 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11959 | if (change) |
| 11960 | alc262_lenovo_3000_automute(codec, 0); |
| 11961 | return change; |
| 11962 | } |
| 11963 | |
| 11964 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11965 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11966 | { |
| 11967 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11968 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11969 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11970 | .info = snd_hda_mixer_amp_switch_info, |
| 11971 | .get = snd_hda_mixer_amp_switch_get, |
| 11972 | .put = alc262_lenovo_3000_master_sw_put, |
| 11973 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11974 | }, |
| 11975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11976 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11977 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11979 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11980 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11981 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11982 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11983 | { } /* end */ |
| 11984 | }; |
| 11985 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11986 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11987 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11988 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11991 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11992 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11993 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11994 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11995 | { } /* end */ |
| 11996 | }; |
| 11997 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11998 | /* additional init verbs for Benq laptops */ |
| 11999 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 12000 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12001 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 12002 | {} |
| 12003 | }; |
| 12004 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12005 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 12006 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12008 | |
| 12009 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12010 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 12011 | {} |
| 12012 | }; |
| 12013 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12014 | /* Samsung Q1 Ultra Vista model setup */ |
| 12015 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12016 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 12017 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12019 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12020 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12021 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12022 | { } /* end */ |
| 12023 | }; |
| 12024 | |
| 12025 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12026 | /* output mixer */ |
| 12027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12030 | /* speaker */ |
| 12031 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12034 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12035 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12036 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12039 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12040 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12041 | /* internal mic */ |
| 12042 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12044 | /* ADC, choose mic */ |
| 12045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12054 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12055 | {} |
| 12056 | }; |
| 12057 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12058 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12059 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12060 | { |
| 12061 | struct alc_spec *spec = codec->spec; |
| 12062 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12063 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12064 | mute = 0; |
| 12065 | /* auto-mute only when HP is used as HP */ |
| 12066 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12067 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12068 | if (spec->jack_present) |
| 12069 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12070 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12071 | /* mute/unmute internal speaker */ |
| 12072 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12073 | HDA_AMP_MUTE, mute); |
| 12074 | /* mute/unmute HP */ |
| 12075 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12076 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12077 | } |
| 12078 | |
| 12079 | /* unsolicited event for HP jack sensing */ |
| 12080 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12081 | unsigned int res) |
| 12082 | { |
| 12083 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12084 | return; |
| 12085 | alc262_ultra_automute(codec); |
| 12086 | } |
| 12087 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12088 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12089 | .num_items = 2, |
| 12090 | .items = { |
| 12091 | { "Mic", 0x1 }, |
| 12092 | { "Headphone", 0x7 }, |
| 12093 | }, |
| 12094 | }; |
| 12095 | |
| 12096 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12097 | struct snd_ctl_elem_value *ucontrol) |
| 12098 | { |
| 12099 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12100 | struct alc_spec *spec = codec->spec; |
| 12101 | int ret; |
| 12102 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12103 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12104 | if (!ret) |
| 12105 | return 0; |
| 12106 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12107 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12108 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12109 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12110 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12111 | return ret; |
| 12112 | } |
| 12113 | |
| 12114 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12115 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12116 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12117 | { |
| 12118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12119 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12120 | .info = alc_mux_enum_info, |
| 12121 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12122 | .put = alc262_ultra_mux_enum_put, |
| 12123 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12124 | { |
| 12125 | .iface = NID_MAPPING, |
| 12126 | .name = "Capture Source", |
| 12127 | .private_value = 0x15, |
| 12128 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12129 | { } /* end */ |
| 12130 | }; |
| 12131 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12132 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12133 | * and thus it's bound with a different mixer. |
| 12134 | * This function returns which mixer amp should be used. |
| 12135 | */ |
| 12136 | static int alc262_check_volbit(hda_nid_t nid) |
| 12137 | { |
| 12138 | if (!nid) |
| 12139 | return 0; |
| 12140 | else if (nid == 0x16) |
| 12141 | return 2; |
| 12142 | else |
| 12143 | return 1; |
| 12144 | } |
| 12145 | |
| 12146 | 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] | 12147 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12148 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12149 | unsigned long val; |
| 12150 | int vbit; |
| 12151 | |
| 12152 | vbit = alc262_check_volbit(nid); |
| 12153 | if (!vbit) |
| 12154 | return 0; |
| 12155 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12156 | return 0; |
| 12157 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12158 | if (vbit == 2) |
| 12159 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12160 | else |
| 12161 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12162 | 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] | 12163 | } |
| 12164 | |
| 12165 | 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] | 12166 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12167 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12168 | unsigned long val; |
| 12169 | |
| 12170 | if (!nid) |
| 12171 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12172 | if (nid == 0x16) |
| 12173 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12174 | else |
| 12175 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12176 | 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] | 12177 | } |
| 12178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12179 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12180 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12181 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12182 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12183 | const char *pfx; |
| 12184 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12185 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12186 | |
| 12187 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12188 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12189 | spec->multiout.dac_nids[0] = 2; |
| 12190 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12191 | pfx = alc_get_line_out_pfx(cfg, true); |
| 12192 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12193 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12194 | for (i = 0; i < 2; i++) { |
| 12195 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12196 | if (err < 0) |
| 12197 | return err; |
| 12198 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12199 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12200 | "Speaker", i); |
| 12201 | if (err < 0) |
| 12202 | return err; |
| 12203 | } |
| 12204 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12205 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12206 | "Headphone", i); |
| 12207 | if (err < 0) |
| 12208 | return err; |
| 12209 | } |
| 12210 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12211 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12212 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12213 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12214 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12215 | if (vbits == 1 || vbits == 2) |
| 12216 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12217 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12218 | for (i = 0; i < 2; i++) { |
| 12219 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12220 | &vbits, i); |
| 12221 | if (err < 0) |
| 12222 | return err; |
| 12223 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12224 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12225 | "Speaker", &vbits, i); |
| 12226 | if (err < 0) |
| 12227 | return err; |
| 12228 | } |
| 12229 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12230 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12231 | "Headphone", &vbits, i); |
| 12232 | if (err < 0) |
| 12233 | return err; |
| 12234 | } |
| 12235 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12236 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12237 | } |
| 12238 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12239 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12240 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12241 | |
| 12242 | /* |
| 12243 | * generic initialization of ADC, input mixers and output mixers |
| 12244 | */ |
| 12245 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12246 | /* |
| 12247 | * Unmute ADC0-2 and set the default input to mic-in |
| 12248 | */ |
| 12249 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12251 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12252 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12253 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12254 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12255 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12256 | /* 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] | 12257 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12258 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12259 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12260 | */ |
| 12261 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12263 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12267 | |
| 12268 | /* |
| 12269 | * Set up output mixers (0x0c - 0x0f) |
| 12270 | */ |
| 12271 | /* set vol=0 to output mixers */ |
| 12272 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12273 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12274 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12276 | /* set up input amps for analog loopback */ |
| 12277 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12281 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12282 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12284 | |
| 12285 | /* FIXME: use matrix-type input source selection */ |
| 12286 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12287 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12290 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12292 | /* Input mixer2 */ |
| 12293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12295 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12297 | /* Input mixer3 */ |
| 12298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12299 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12301 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12302 | |
| 12303 | { } |
| 12304 | }; |
| 12305 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12306 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12307 | /* |
| 12308 | * Unmute ADC0-2 and set the default input to mic-in |
| 12309 | */ |
| 12310 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12312 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12313 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12314 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12315 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12316 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12317 | /* 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] | 12318 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12319 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12320 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12321 | */ |
| 12322 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12330 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12331 | /* |
| 12332 | * Set up output mixers (0x0c - 0x0e) |
| 12333 | */ |
| 12334 | /* set vol=0 to output mixers */ |
| 12335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12336 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12337 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12338 | |
| 12339 | /* set up input amps for analog loopback */ |
| 12340 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12342 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12344 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12347 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12348 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12349 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12350 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12351 | |
| 12352 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12354 | |
| 12355 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12356 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12357 | |
| 12358 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12359 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12360 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12361 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12362 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12363 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12364 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12365 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12366 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12367 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12368 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12369 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12370 | |
| 12371 | |
| 12372 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12373 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12374 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12377 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12379 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12380 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12381 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12383 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12384 | /* Input mixer2 */ |
| 12385 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12386 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12387 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12388 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12389 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12394 | /* Input mixer3 */ |
| 12395 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12402 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12403 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12404 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12405 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12406 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12407 | { } |
| 12408 | }; |
| 12409 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12410 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12411 | /* |
| 12412 | * Unmute ADC0-2 and set the default input to mic-in |
| 12413 | */ |
| 12414 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12416 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12418 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12420 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12421 | /* 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] | 12422 | * mixer widget |
| 12423 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12424 | * panel mic (mic 2) |
| 12425 | */ |
| 12426 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12427 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12428 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12429 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12430 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12432 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12434 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12435 | /* |
| 12436 | * Set up output mixers (0x0c - 0x0e) |
| 12437 | */ |
| 12438 | /* set vol=0 to output mixers */ |
| 12439 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12440 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12441 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12442 | |
| 12443 | /* set up input amps for analog loopback */ |
| 12444 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12447 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12448 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12449 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12450 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12451 | |
| 12452 | |
| 12453 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12454 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12455 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12457 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12458 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12459 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12460 | |
| 12461 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12462 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12463 | |
| 12464 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12465 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12466 | |
| 12467 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12468 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12469 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12470 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12471 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12472 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12473 | |
| 12474 | /* FIXME: use matrix-type input source selection */ |
| 12475 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12476 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12477 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12478 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12479 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12480 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12481 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12482 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12483 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12484 | /* Input mixer2 */ |
| 12485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12487 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12490 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12491 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12492 | /* Input mixer3 */ |
| 12493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12497 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12498 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12499 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12500 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12501 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12502 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12503 | { } |
| 12504 | }; |
| 12505 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12506 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12507 | |
| 12508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12510 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12511 | |
| 12512 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12513 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12514 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12515 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12516 | |
| 12517 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12518 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12519 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12520 | {} |
| 12521 | }; |
| 12522 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12523 | /* |
| 12524 | * Pin config fixes |
| 12525 | */ |
| 12526 | enum { |
| 12527 | PINFIX_FSC_H270, |
| 12528 | }; |
| 12529 | |
| 12530 | static const struct alc_fixup alc262_fixups[] = { |
| 12531 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12532 | .type = ALC_FIXUP_PINS, |
| 12533 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12534 | { 0x14, 0x99130110 }, /* speaker */ |
| 12535 | { 0x15, 0x0221142f }, /* front HP */ |
| 12536 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12537 | { } |
| 12538 | } |
| 12539 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12540 | }; |
| 12541 | |
| 12542 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12543 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12544 | {} |
| 12545 | }; |
| 12546 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12547 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12548 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12549 | #define alc262_loopbacks alc880_loopbacks |
| 12550 | #endif |
| 12551 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12552 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12553 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12554 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12555 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12556 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12557 | |
| 12558 | /* |
| 12559 | * BIOS auto configuration |
| 12560 | */ |
| 12561 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12562 | { |
| 12563 | struct alc_spec *spec = codec->spec; |
| 12564 | int err; |
| 12565 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12566 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12567 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12568 | alc262_ignore); |
| 12569 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12570 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12571 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12572 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12573 | spec->multiout.max_channels = 2; |
| 12574 | spec->no_analog = 1; |
| 12575 | goto dig_only; |
| 12576 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12577 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12578 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12579 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12580 | if (err < 0) |
| 12581 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12582 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12583 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12584 | return err; |
| 12585 | |
| 12586 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12587 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12588 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12589 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12590 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12591 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12592 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12593 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12594 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12595 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12596 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12597 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12598 | err = alc_auto_add_mic_boost(codec); |
| 12599 | if (err < 0) |
| 12600 | return err; |
| 12601 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12602 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12603 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12604 | return 1; |
| 12605 | } |
| 12606 | |
| 12607 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12608 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12609 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12610 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12611 | |
| 12612 | |
| 12613 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12614 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12615 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12616 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12617 | alc262_auto_init_multi_out(codec); |
| 12618 | alc262_auto_init_hp_out(codec); |
| 12619 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12620 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12621 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12622 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12623 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12624 | } |
| 12625 | |
| 12626 | /* |
| 12627 | * configuration and preset |
| 12628 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12629 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12630 | [ALC262_BASIC] = "basic", |
| 12631 | [ALC262_HIPPO] = "hippo", |
| 12632 | [ALC262_HIPPO_1] = "hippo_1", |
| 12633 | [ALC262_FUJITSU] = "fujitsu", |
| 12634 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12635 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12636 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12637 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12638 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12639 | [ALC262_BENQ_T31] = "benq-t31", |
| 12640 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12641 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12642 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12643 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12644 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12645 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12646 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12647 | [ALC262_AUTO] = "auto", |
| 12648 | }; |
| 12649 | |
| 12650 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12651 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12652 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12653 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12654 | ALC262_HP_BPC), |
| 12655 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12656 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12657 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12658 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12659 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12660 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12661 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12662 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12663 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12664 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12665 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12666 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12667 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12668 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12669 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12670 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12671 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12672 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12673 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12674 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12675 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12676 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12677 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12678 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12679 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12680 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12681 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12682 | #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] | 12683 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12684 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12685 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12686 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12687 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12688 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12689 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12690 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12691 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12692 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12693 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12694 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12695 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12696 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12697 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12698 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12699 | {} |
| 12700 | }; |
| 12701 | |
| 12702 | static struct alc_config_preset alc262_presets[] = { |
| 12703 | [ALC262_BASIC] = { |
| 12704 | .mixers = { alc262_base_mixer }, |
| 12705 | .init_verbs = { alc262_init_verbs }, |
| 12706 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12707 | .dac_nids = alc262_dac_nids, |
| 12708 | .hp_nid = 0x03, |
| 12709 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12710 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12711 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12712 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12713 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12714 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12715 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12716 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12717 | .dac_nids = alc262_dac_nids, |
| 12718 | .hp_nid = 0x03, |
| 12719 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12720 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12721 | .channel_mode = alc262_modes, |
| 12722 | .input_mux = &alc262_capture_source, |
| 12723 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12724 | .setup = alc262_hippo_setup, |
| 12725 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12726 | }, |
| 12727 | [ALC262_HIPPO_1] = { |
| 12728 | .mixers = { alc262_hippo1_mixer }, |
| 12729 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12730 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12731 | .dac_nids = alc262_dac_nids, |
| 12732 | .hp_nid = 0x02, |
| 12733 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12734 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12735 | .channel_mode = alc262_modes, |
| 12736 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12737 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12738 | .setup = alc262_hippo1_setup, |
| 12739 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12740 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12741 | [ALC262_FUJITSU] = { |
| 12742 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12743 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12744 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12745 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12746 | .dac_nids = alc262_dac_nids, |
| 12747 | .hp_nid = 0x03, |
| 12748 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12749 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12750 | .channel_mode = alc262_modes, |
| 12751 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12752 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12753 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12754 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12755 | [ALC262_HP_BPC] = { |
| 12756 | .mixers = { alc262_HP_BPC_mixer }, |
| 12757 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12758 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12759 | .dac_nids = alc262_dac_nids, |
| 12760 | .hp_nid = 0x03, |
| 12761 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12762 | .channel_mode = alc262_modes, |
| 12763 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12764 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12765 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12766 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12767 | [ALC262_HP_BPC_D7000_WF] = { |
| 12768 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12769 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12770 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12771 | .dac_nids = alc262_dac_nids, |
| 12772 | .hp_nid = 0x03, |
| 12773 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12774 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12775 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12776 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12777 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12778 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12779 | [ALC262_HP_BPC_D7000_WL] = { |
| 12780 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12781 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12782 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12783 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12784 | .dac_nids = alc262_dac_nids, |
| 12785 | .hp_nid = 0x03, |
| 12786 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12787 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12788 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12789 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12790 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12791 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12792 | [ALC262_HP_TC_T5735] = { |
| 12793 | .mixers = { alc262_hp_t5735_mixer }, |
| 12794 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12795 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12796 | .dac_nids = alc262_dac_nids, |
| 12797 | .hp_nid = 0x03, |
| 12798 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12799 | .channel_mode = alc262_modes, |
| 12800 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12801 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12802 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12803 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12804 | }, |
| 12805 | [ALC262_HP_RP5700] = { |
| 12806 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12807 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12808 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12809 | .dac_nids = alc262_dac_nids, |
| 12810 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12811 | .channel_mode = alc262_modes, |
| 12812 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12813 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12814 | [ALC262_BENQ_ED8] = { |
| 12815 | .mixers = { alc262_base_mixer }, |
| 12816 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12817 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12818 | .dac_nids = alc262_dac_nids, |
| 12819 | .hp_nid = 0x03, |
| 12820 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12821 | .channel_mode = alc262_modes, |
| 12822 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12823 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12824 | [ALC262_SONY_ASSAMD] = { |
| 12825 | .mixers = { alc262_sony_mixer }, |
| 12826 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12827 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12828 | .dac_nids = alc262_dac_nids, |
| 12829 | .hp_nid = 0x02, |
| 12830 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12831 | .channel_mode = alc262_modes, |
| 12832 | .input_mux = &alc262_capture_source, |
| 12833 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12834 | .setup = alc262_hippo_setup, |
| 12835 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12836 | }, |
| 12837 | [ALC262_BENQ_T31] = { |
| 12838 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12839 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12840 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12841 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12842 | .dac_nids = alc262_dac_nids, |
| 12843 | .hp_nid = 0x03, |
| 12844 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12845 | .channel_mode = alc262_modes, |
| 12846 | .input_mux = &alc262_capture_source, |
| 12847 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12848 | .setup = alc262_hippo_setup, |
| 12849 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12850 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12851 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12852 | .mixers = { alc262_ultra_mixer }, |
| 12853 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12854 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12855 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12856 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12857 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12858 | .channel_mode = alc262_modes, |
| 12859 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12860 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12861 | .capsrc_nids = alc262_capsrc_nids, |
| 12862 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12863 | .unsol_event = alc262_ultra_unsol_event, |
| 12864 | .init_hook = alc262_ultra_automute, |
| 12865 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12866 | [ALC262_LENOVO_3000] = { |
| 12867 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12868 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12869 | alc262_lenovo_3000_unsol_verbs, |
| 12870 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12871 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12872 | .dac_nids = alc262_dac_nids, |
| 12873 | .hp_nid = 0x03, |
| 12874 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12875 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12876 | .channel_mode = alc262_modes, |
| 12877 | .input_mux = &alc262_fujitsu_capture_source, |
| 12878 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12879 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12880 | [ALC262_NEC] = { |
| 12881 | .mixers = { alc262_nec_mixer }, |
| 12882 | .init_verbs = { alc262_nec_verbs }, |
| 12883 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12884 | .dac_nids = alc262_dac_nids, |
| 12885 | .hp_nid = 0x03, |
| 12886 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12887 | .channel_mode = alc262_modes, |
| 12888 | .input_mux = &alc262_capture_source, |
| 12889 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12890 | [ALC262_TOSHIBA_S06] = { |
| 12891 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12892 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12893 | alc262_eapd_verbs }, |
| 12894 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12895 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12896 | .dac_nids = alc262_dac_nids, |
| 12897 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12898 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12899 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12900 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12901 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12902 | .unsol_event = alc_sku_unsol_event, |
| 12903 | .setup = alc262_toshiba_s06_setup, |
| 12904 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12905 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12906 | [ALC262_TOSHIBA_RX1] = { |
| 12907 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12908 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12909 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12910 | .dac_nids = alc262_dac_nids, |
| 12911 | .hp_nid = 0x03, |
| 12912 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12913 | .channel_mode = alc262_modes, |
| 12914 | .input_mux = &alc262_capture_source, |
| 12915 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12916 | .setup = alc262_hippo_setup, |
| 12917 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12918 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12919 | [ALC262_TYAN] = { |
| 12920 | .mixers = { alc262_tyan_mixer }, |
| 12921 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12922 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12923 | .dac_nids = alc262_dac_nids, |
| 12924 | .hp_nid = 0x02, |
| 12925 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12926 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12927 | .channel_mode = alc262_modes, |
| 12928 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12929 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12930 | .setup = alc262_tyan_setup, |
| 12931 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12932 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12933 | }; |
| 12934 | |
| 12935 | static int patch_alc262(struct hda_codec *codec) |
| 12936 | { |
| 12937 | struct alc_spec *spec; |
| 12938 | int board_config; |
| 12939 | int err; |
| 12940 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12941 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12942 | if (spec == NULL) |
| 12943 | return -ENOMEM; |
| 12944 | |
| 12945 | codec->spec = spec; |
| 12946 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12947 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12948 | * under-run |
| 12949 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12950 | { |
| 12951 | int tmp; |
| 12952 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12953 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12954 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12955 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12956 | } |
| 12957 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12958 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12959 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12960 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12961 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12962 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12963 | alc262_models, |
| 12964 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12965 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12966 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12967 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12968 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12969 | board_config = ALC262_AUTO; |
| 12970 | } |
| 12971 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12972 | if (board_config == ALC262_AUTO) { |
| 12973 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12974 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12975 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12976 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12977 | if (board_config == ALC262_AUTO) { |
| 12978 | /* automatic parse from the BIOS config */ |
| 12979 | err = alc262_parse_auto_config(codec); |
| 12980 | if (err < 0) { |
| 12981 | alc_free(codec); |
| 12982 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12983 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12984 | printk(KERN_INFO |
| 12985 | "hda_codec: Cannot set up configuration " |
| 12986 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12987 | board_config = ALC262_BASIC; |
| 12988 | } |
| 12989 | } |
| 12990 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12991 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12992 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12993 | if (err < 0) { |
| 12994 | alc_free(codec); |
| 12995 | return err; |
| 12996 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12997 | } |
| 12998 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12999 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13000 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13001 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13002 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 13003 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13004 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13005 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 13006 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 13007 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13008 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13009 | int i; |
| 13010 | /* check whether the digital-mic has to be supported */ |
| 13011 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 13012 | if (spec->input_mux->items[i].index >= 9) |
| 13013 | break; |
| 13014 | } |
| 13015 | if (i < spec->input_mux->num_items) { |
| 13016 | /* use only ADC0 */ |
| 13017 | spec->adc_nids = alc262_dmic_adc_nids; |
| 13018 | spec->num_adc_nids = 1; |
| 13019 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13020 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13021 | /* all analog inputs */ |
| 13022 | /* check whether NID 0x07 is valid */ |
| 13023 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 13024 | |
| 13025 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13026 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13027 | if (wcap != AC_WID_AUD_IN) { |
| 13028 | spec->adc_nids = alc262_adc_nids_alt; |
| 13029 | spec->num_adc_nids = |
| 13030 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13031 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13032 | } else { |
| 13033 | spec->adc_nids = alc262_adc_nids; |
| 13034 | spec->num_adc_nids = |
| 13035 | ARRAY_SIZE(alc262_adc_nids); |
| 13036 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13037 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13038 | } |
| 13039 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13040 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13041 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13042 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13043 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13044 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13045 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13046 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13047 | spec->vmaster_nid = 0x0c; |
| 13048 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13049 | codec->patch_ops = alc_patch_ops; |
| 13050 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13051 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13052 | |
| 13053 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13054 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13055 | if (!spec->loopback.amplist) |
| 13056 | spec->loopback.amplist = alc262_loopbacks; |
| 13057 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13058 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13059 | return 0; |
| 13060 | } |
| 13061 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13062 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13063 | * ALC268 channel source setting (2 channel) |
| 13064 | */ |
| 13065 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13066 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13067 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13068 | static hda_nid_t alc268_dac_nids[2] = { |
| 13069 | /* front, hp */ |
| 13070 | 0x02, 0x03 |
| 13071 | }; |
| 13072 | |
| 13073 | static hda_nid_t alc268_adc_nids[2] = { |
| 13074 | /* ADC0-1 */ |
| 13075 | 0x08, 0x07 |
| 13076 | }; |
| 13077 | |
| 13078 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13079 | /* ADC0 */ |
| 13080 | 0x08 |
| 13081 | }; |
| 13082 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13083 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13084 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13085 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13086 | /* output mixer control */ |
| 13087 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13088 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13089 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13091 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13092 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13093 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13094 | { } |
| 13095 | }; |
| 13096 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13097 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13098 | /* output mixer control */ |
| 13099 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13100 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13101 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13102 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13103 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13104 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13105 | { } |
| 13106 | }; |
| 13107 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13108 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13109 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13110 | .ops = &snd_hda_bind_sw, |
| 13111 | .values = { |
| 13112 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13113 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13114 | 0 |
| 13115 | }, |
| 13116 | }; |
| 13117 | |
| 13118 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13119 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13120 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13121 | { } |
| 13122 | }; |
| 13123 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13124 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13125 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13126 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13127 | { } |
| 13128 | }; |
| 13129 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13130 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13131 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13132 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13133 | { } /* end */ |
| 13134 | }; |
| 13135 | |
| 13136 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13137 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13138 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13139 | .ops = &snd_hda_bind_vol, |
| 13140 | .values = { |
| 13141 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13142 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13143 | 0 |
| 13144 | }, |
| 13145 | }; |
| 13146 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13147 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13148 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13149 | { |
| 13150 | struct alc_spec *spec = codec->spec; |
| 13151 | unsigned int mute; |
| 13152 | |
| 13153 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13154 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13155 | spec->sense_updated = 1; |
| 13156 | } |
| 13157 | if (spec->jack_present) |
| 13158 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13159 | else /* unmute internal speaker if necessary */ |
| 13160 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13161 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13162 | HDA_AMP_MUTE, mute); |
| 13163 | } |
| 13164 | |
| 13165 | |
| 13166 | /* bind hp and internal speaker mute (with plug check) */ |
| 13167 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13168 | struct snd_ctl_elem_value *ucontrol) |
| 13169 | { |
| 13170 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13171 | long *valp = ucontrol->value.integer.value; |
| 13172 | int change; |
| 13173 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13174 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13175 | if (change) |
| 13176 | alc268_acer_automute(codec, 0); |
| 13177 | return change; |
| 13178 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13179 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13180 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13181 | /* output mixer control */ |
| 13182 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13183 | { |
| 13184 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13185 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13186 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13187 | .info = snd_hda_mixer_amp_switch_info, |
| 13188 | .get = snd_hda_mixer_amp_switch_get, |
| 13189 | .put = alc268_acer_master_sw_put, |
| 13190 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13191 | }, |
| 13192 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13193 | { } |
| 13194 | }; |
| 13195 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13196 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13197 | /* output mixer control */ |
| 13198 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13199 | { |
| 13200 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13201 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13202 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13203 | .info = snd_hda_mixer_amp_switch_info, |
| 13204 | .get = snd_hda_mixer_amp_switch_get, |
| 13205 | .put = alc268_acer_master_sw_put, |
| 13206 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13207 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13208 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13209 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13210 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13211 | { } |
| 13212 | }; |
| 13213 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13214 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13215 | /* output mixer control */ |
| 13216 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13217 | { |
| 13218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13219 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13220 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13221 | .info = snd_hda_mixer_amp_switch_info, |
| 13222 | .get = snd_hda_mixer_amp_switch_get, |
| 13223 | .put = alc268_acer_master_sw_put, |
| 13224 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13225 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13226 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13227 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13228 | { } |
| 13229 | }; |
| 13230 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13231 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13232 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13234 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13235 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13236 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13238 | { } |
| 13239 | }; |
| 13240 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13241 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13242 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13243 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13245 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13246 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13247 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13248 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13249 | { } |
| 13250 | }; |
| 13251 | |
| 13252 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13253 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13254 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13255 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13256 | |
| 13257 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13258 | unsigned int res) |
| 13259 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13260 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13261 | return; |
| 13262 | alc268_acer_automute(codec, 1); |
| 13263 | } |
| 13264 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13265 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13266 | { |
| 13267 | alc268_acer_automute(codec, 1); |
| 13268 | } |
| 13269 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13270 | /* toggle speaker-output according to the hp-jack state */ |
| 13271 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13272 | { |
| 13273 | unsigned int present; |
| 13274 | unsigned char bits; |
| 13275 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13276 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13277 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13278 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13279 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13280 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13281 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13282 | } |
| 13283 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13284 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13285 | unsigned int res) |
| 13286 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13287 | switch (res >> 26) { |
| 13288 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13289 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13290 | break; |
| 13291 | case ALC880_MIC_EVENT: |
| 13292 | alc_mic_automute(codec); |
| 13293 | break; |
| 13294 | } |
| 13295 | } |
| 13296 | |
| 13297 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13298 | { |
| 13299 | struct alc_spec *spec = codec->spec; |
| 13300 | spec->ext_mic.pin = 0x18; |
| 13301 | spec->ext_mic.mux_idx = 0; |
| 13302 | spec->int_mic.pin = 0x12; |
| 13303 | spec->int_mic.mux_idx = 6; |
| 13304 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13305 | } |
| 13306 | |
| 13307 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13308 | { |
| 13309 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13310 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13311 | } |
| 13312 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13313 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13314 | /* output mixer control */ |
| 13315 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13316 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13317 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13318 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13319 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13320 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13321 | { } |
| 13322 | }; |
| 13323 | |
| 13324 | static struct hda_verb alc268_dell_verbs[] = { |
| 13325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13327 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13328 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13329 | { } |
| 13330 | }; |
| 13331 | |
| 13332 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13333 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13334 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13335 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13336 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13337 | spec->autocfg.hp_pins[0] = 0x15; |
| 13338 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13339 | spec->ext_mic.pin = 0x18; |
| 13340 | spec->ext_mic.mux_idx = 0; |
| 13341 | spec->int_mic.pin = 0x19; |
| 13342 | spec->int_mic.mux_idx = 1; |
| 13343 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13344 | } |
| 13345 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13346 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13347 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13348 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13349 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13351 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13352 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13353 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13354 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13355 | { } |
| 13356 | }; |
| 13357 | |
| 13358 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13359 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13360 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13361 | { } |
| 13362 | }; |
| 13363 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13364 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13365 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13366 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13367 | spec->autocfg.hp_pins[0] = 0x15; |
| 13368 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13369 | spec->ext_mic.pin = 0x18; |
| 13370 | spec->ext_mic.mux_idx = 0; |
| 13371 | spec->int_mic.pin = 0x19; |
| 13372 | spec->int_mic.mux_idx = 1; |
| 13373 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13374 | } |
| 13375 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13376 | /* |
| 13377 | * generic initialization of ADC, input mixers and output mixers |
| 13378 | */ |
| 13379 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13380 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13381 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13382 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13383 | |
| 13384 | /* |
| 13385 | * Set up output mixers (0x0c - 0x0e) |
| 13386 | */ |
| 13387 | /* set vol=0 to output mixers */ |
| 13388 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13389 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13390 | |
| 13391 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13392 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13393 | |
| 13394 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13396 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13397 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13398 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13399 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13400 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13401 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13402 | |
| 13403 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13405 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13406 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13407 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13408 | |
| 13409 | /* set PCBEEP vol = 0, mute connections */ |
| 13410 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13411 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13412 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13413 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13414 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13415 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13416 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13417 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13418 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13419 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13420 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13421 | { } |
| 13422 | }; |
| 13423 | |
| 13424 | /* |
| 13425 | * generic initialization of ADC, input mixers and output mixers |
| 13426 | */ |
| 13427 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13428 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13429 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13430 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13431 | |
| 13432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13433 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13435 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13436 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13437 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13438 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13439 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13440 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13441 | |
| 13442 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13443 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13444 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13445 | /* set PCBEEP vol = 0, mute connections */ |
| 13446 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13447 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13448 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13449 | |
| 13450 | { } |
| 13451 | }; |
| 13452 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13453 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13454 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13455 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13456 | { } /* end */ |
| 13457 | }; |
| 13458 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13459 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13460 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13461 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13462 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13463 | { } /* end */ |
| 13464 | }; |
| 13465 | |
| 13466 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13467 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13468 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13469 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13470 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13471 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13472 | { } /* end */ |
| 13473 | }; |
| 13474 | |
| 13475 | static struct hda_input_mux alc268_capture_source = { |
| 13476 | .num_items = 4, |
| 13477 | .items = { |
| 13478 | { "Mic", 0x0 }, |
| 13479 | { "Front Mic", 0x1 }, |
| 13480 | { "Line", 0x2 }, |
| 13481 | { "CD", 0x3 }, |
| 13482 | }, |
| 13483 | }; |
| 13484 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13485 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13486 | .num_items = 3, |
| 13487 | .items = { |
| 13488 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13489 | { "Internal Mic", 0x1 }, |
| 13490 | { "Line", 0x2 }, |
| 13491 | }, |
| 13492 | }; |
| 13493 | |
| 13494 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13495 | .num_items = 3, |
| 13496 | .items = { |
| 13497 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13498 | { "Internal Mic", 0x6 }, |
| 13499 | { "Line", 0x2 }, |
| 13500 | }, |
| 13501 | }; |
| 13502 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13503 | #ifdef CONFIG_SND_DEBUG |
| 13504 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13505 | /* Volume widgets */ |
| 13506 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13507 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13508 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13509 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13510 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13511 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13512 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13513 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13514 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13515 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13516 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13517 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13518 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13519 | /* The below appears problematic on some hardwares */ |
| 13520 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13521 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13522 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13523 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13524 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13525 | |
| 13526 | /* Modes for retasking pin widgets */ |
| 13527 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13528 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13529 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13530 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13531 | |
| 13532 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13533 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13534 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13535 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13536 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13537 | |
| 13538 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13539 | * The ALC268 does not have an SPDIF input. |
| 13540 | */ |
| 13541 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13542 | |
| 13543 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13544 | * this output to turn on an external amplifier. |
| 13545 | */ |
| 13546 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13547 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13548 | |
| 13549 | { } /* end */ |
| 13550 | }; |
| 13551 | #endif |
| 13552 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13553 | /* create input playback/capture controls for the given pin */ |
| 13554 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13555 | const char *ctlname, int idx) |
| 13556 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13557 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13558 | int err; |
| 13559 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13560 | switch (nid) { |
| 13561 | case 0x14: |
| 13562 | case 0x16: |
| 13563 | dac = 0x02; |
| 13564 | break; |
| 13565 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13566 | case 0x1a: /* ALC259/269 only */ |
| 13567 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13568 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13569 | dac = 0x03; |
| 13570 | break; |
| 13571 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13572 | snd_printd(KERN_WARNING "hda_codec: " |
| 13573 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13574 | return 0; |
| 13575 | } |
| 13576 | if (spec->multiout.dac_nids[0] != dac && |
| 13577 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13578 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13579 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13580 | HDA_OUTPUT)); |
| 13581 | if (err < 0) |
| 13582 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13583 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13584 | } |
| 13585 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13586 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13587 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13588 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13589 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13590 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13591 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13592 | if (err < 0) |
| 13593 | return err; |
| 13594 | return 0; |
| 13595 | } |
| 13596 | |
| 13597 | /* add playback controls from the parsed DAC table */ |
| 13598 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13599 | const struct auto_pin_cfg *cfg) |
| 13600 | { |
| 13601 | hda_nid_t nid; |
| 13602 | int err; |
| 13603 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13604 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13605 | |
| 13606 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13607 | if (nid) { |
| 13608 | const char *name; |
| 13609 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13610 | name = "Speaker"; |
| 13611 | else |
| 13612 | name = "Front"; |
| 13613 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13614 | if (err < 0) |
| 13615 | return err; |
| 13616 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13617 | |
| 13618 | nid = cfg->speaker_pins[0]; |
| 13619 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13620 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13621 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13622 | if (err < 0) |
| 13623 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13624 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13625 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13626 | if (err < 0) |
| 13627 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13628 | } |
| 13629 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13630 | if (nid) { |
| 13631 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13632 | if (err < 0) |
| 13633 | return err; |
| 13634 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13635 | |
| 13636 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13637 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13638 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13639 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13640 | if (err < 0) |
| 13641 | return err; |
| 13642 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13643 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13644 | } |
| 13645 | |
| 13646 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13647 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13648 | const struct auto_pin_cfg *cfg) |
| 13649 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13650 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13651 | } |
| 13652 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13653 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13654 | hda_nid_t nid, int pin_type) |
| 13655 | { |
| 13656 | int idx; |
| 13657 | |
| 13658 | alc_set_pin_output(codec, nid, pin_type); |
| 13659 | if (nid == 0x14 || nid == 0x16) |
| 13660 | idx = 0; |
| 13661 | else |
| 13662 | idx = 1; |
| 13663 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13664 | } |
| 13665 | |
| 13666 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13667 | { |
| 13668 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13669 | int i; |
| 13670 | |
| 13671 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13672 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13673 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13674 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13675 | } |
| 13676 | } |
| 13677 | |
| 13678 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13679 | { |
| 13680 | struct alc_spec *spec = codec->spec; |
| 13681 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13682 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13683 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13684 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13685 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13686 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13687 | } |
| 13688 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13689 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13690 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13691 | } |
| 13692 | if (spec->autocfg.mono_out_pin) |
| 13693 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13694 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13695 | } |
| 13696 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13697 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13698 | { |
| 13699 | struct alc_spec *spec = codec->spec; |
| 13700 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13701 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13702 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13703 | unsigned int dac_vol1, dac_vol2; |
| 13704 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13705 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13706 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13707 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13708 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13709 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13710 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13711 | AMP_IN_UNMUTE(1)); |
| 13712 | snd_hda_codec_write(codec, 0x10, 0, |
| 13713 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13714 | AMP_IN_UNMUTE(1)); |
| 13715 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13716 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13717 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13718 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13719 | snd_hda_codec_write(codec, 0x10, 0, |
| 13720 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13721 | } |
| 13722 | |
| 13723 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13724 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13725 | dac_vol2 = AMP_OUT_ZERO; |
| 13726 | else if (line_nid == 0x15) |
| 13727 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13728 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13729 | dac_vol2 = AMP_OUT_ZERO; |
| 13730 | else if (hp_nid == 0x15) |
| 13731 | dac_vol1 = AMP_OUT_ZERO; |
| 13732 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13733 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13734 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13735 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13736 | |
| 13737 | snd_hda_codec_write(codec, 0x02, 0, |
| 13738 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13739 | snd_hda_codec_write(codec, 0x03, 0, |
| 13740 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13741 | } |
| 13742 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13743 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13744 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13745 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13746 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13747 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13748 | |
| 13749 | /* |
| 13750 | * BIOS auto configuration |
| 13751 | */ |
| 13752 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13753 | { |
| 13754 | struct alc_spec *spec = codec->spec; |
| 13755 | int err; |
| 13756 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13757 | |
| 13758 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13759 | alc268_ignore); |
| 13760 | if (err < 0) |
| 13761 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13762 | if (!spec->autocfg.line_outs) { |
| 13763 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13764 | spec->multiout.max_channels = 2; |
| 13765 | spec->no_analog = 1; |
| 13766 | goto dig_only; |
| 13767 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13768 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13769 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13770 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13771 | if (err < 0) |
| 13772 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13773 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13774 | if (err < 0) |
| 13775 | return err; |
| 13776 | |
| 13777 | spec->multiout.max_channels = 2; |
| 13778 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13779 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13780 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13781 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13782 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13783 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13784 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13785 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13786 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13787 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13788 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13789 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13790 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13791 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13792 | err = alc_auto_add_mic_boost(codec); |
| 13793 | if (err < 0) |
| 13794 | return err; |
| 13795 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13796 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13797 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13798 | return 1; |
| 13799 | } |
| 13800 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13801 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13802 | |
| 13803 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13804 | static void alc268_auto_init(struct hda_codec *codec) |
| 13805 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13806 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13807 | alc268_auto_init_multi_out(codec); |
| 13808 | alc268_auto_init_hp_out(codec); |
| 13809 | alc268_auto_init_mono_speaker_out(codec); |
| 13810 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13811 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13812 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13813 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13814 | } |
| 13815 | |
| 13816 | /* |
| 13817 | * configuration and preset |
| 13818 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13819 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13820 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13821 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13822 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13823 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13824 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13825 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13826 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13827 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13828 | #ifdef CONFIG_SND_DEBUG |
| 13829 | [ALC268_TEST] = "test", |
| 13830 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13831 | [ALC268_AUTO] = "auto", |
| 13832 | }; |
| 13833 | |
| 13834 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13835 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13836 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13837 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13838 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13839 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13840 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13841 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13842 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13843 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13844 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13845 | /* almost compatible with toshiba but with optional digital outs; |
| 13846 | * auto-probing seems working fine |
| 13847 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13848 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13849 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13850 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13851 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13852 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13853 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13854 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13855 | {} |
| 13856 | }; |
| 13857 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13858 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13859 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13860 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13861 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13862 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13863 | ALC268_TOSHIBA), |
| 13864 | {} |
| 13865 | }; |
| 13866 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13867 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13868 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13869 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13870 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13871 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13872 | alc267_quanta_il1_verbs }, |
| 13873 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13874 | .dac_nids = alc268_dac_nids, |
| 13875 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13876 | .adc_nids = alc268_adc_nids_alt, |
| 13877 | .hp_nid = 0x03, |
| 13878 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13879 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13880 | .unsol_event = alc_sku_unsol_event, |
| 13881 | .setup = alc267_quanta_il1_setup, |
| 13882 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13883 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13884 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13885 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13886 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13887 | .init_verbs = { alc268_base_init_verbs }, |
| 13888 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13889 | .dac_nids = alc268_dac_nids, |
| 13890 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13891 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13892 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13893 | .hp_nid = 0x03, |
| 13894 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13895 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13896 | .channel_mode = alc268_modes, |
| 13897 | .input_mux = &alc268_capture_source, |
| 13898 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13899 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13900 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13901 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13902 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13903 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13904 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13905 | .dac_nids = alc268_dac_nids, |
| 13906 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13907 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13908 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13909 | .hp_nid = 0x03, |
| 13910 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13911 | .channel_mode = alc268_modes, |
| 13912 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13913 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13914 | .setup = alc268_toshiba_setup, |
| 13915 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13916 | }, |
| 13917 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13918 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13919 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13920 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13921 | alc268_acer_verbs }, |
| 13922 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13923 | .dac_nids = alc268_dac_nids, |
| 13924 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13925 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13926 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13927 | .hp_nid = 0x02, |
| 13928 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13929 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13930 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13931 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13932 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13933 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13934 | [ALC268_ACER_DMIC] = { |
| 13935 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13936 | alc268_beep_mixer }, |
| 13937 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13938 | alc268_acer_verbs }, |
| 13939 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13940 | .dac_nids = alc268_dac_nids, |
| 13941 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13942 | .adc_nids = alc268_adc_nids_alt, |
| 13943 | .capsrc_nids = alc268_capsrc_nids, |
| 13944 | .hp_nid = 0x02, |
| 13945 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13946 | .channel_mode = alc268_modes, |
| 13947 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13948 | .unsol_event = alc268_acer_unsol_event, |
| 13949 | .init_hook = alc268_acer_init_hook, |
| 13950 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13951 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13952 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13953 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13954 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13955 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13956 | alc268_acer_aspire_one_verbs }, |
| 13957 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13958 | .dac_nids = alc268_dac_nids, |
| 13959 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13960 | .adc_nids = alc268_adc_nids_alt, |
| 13961 | .capsrc_nids = alc268_capsrc_nids, |
| 13962 | .hp_nid = 0x03, |
| 13963 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13964 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13965 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13966 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13967 | .init_hook = alc268_acer_lc_init_hook, |
| 13968 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13969 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13970 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13971 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13972 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13973 | alc268_dell_verbs }, |
| 13974 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13975 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13976 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13977 | .adc_nids = alc268_adc_nids_alt, |
| 13978 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13979 | .hp_nid = 0x02, |
| 13980 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13981 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13982 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13983 | .setup = alc268_dell_setup, |
| 13984 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13985 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13986 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13987 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13988 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13989 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13990 | alc268_toshiba_verbs }, |
| 13991 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13992 | .dac_nids = alc268_dac_nids, |
| 13993 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13994 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13995 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13996 | .hp_nid = 0x03, |
| 13997 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13998 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13999 | .channel_mode = alc268_modes, |
| 14000 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14001 | .setup = alc268_toshiba_setup, |
| 14002 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 14003 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 14004 | #ifdef CONFIG_SND_DEBUG |
| 14005 | [ALC268_TEST] = { |
| 14006 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 14007 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 14008 | alc268_volume_init_verbs }, |
| 14009 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 14010 | .dac_nids = alc268_dac_nids, |
| 14011 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 14012 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14013 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 14014 | .hp_nid = 0x03, |
| 14015 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 14016 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 14017 | .channel_mode = alc268_modes, |
| 14018 | .input_mux = &alc268_capture_source, |
| 14019 | }, |
| 14020 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14021 | }; |
| 14022 | |
| 14023 | static int patch_alc268(struct hda_codec *codec) |
| 14024 | { |
| 14025 | struct alc_spec *spec; |
| 14026 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14027 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14028 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 14029 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14030 | if (spec == NULL) |
| 14031 | return -ENOMEM; |
| 14032 | |
| 14033 | codec->spec = spec; |
| 14034 | |
| 14035 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 14036 | alc268_models, |
| 14037 | alc268_cfg_tbl); |
| 14038 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14039 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14040 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14041 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14042 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14043 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14044 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14045 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14046 | board_config = ALC268_AUTO; |
| 14047 | } |
| 14048 | |
| 14049 | if (board_config == ALC268_AUTO) { |
| 14050 | /* automatic parse from the BIOS config */ |
| 14051 | err = alc268_parse_auto_config(codec); |
| 14052 | if (err < 0) { |
| 14053 | alc_free(codec); |
| 14054 | return err; |
| 14055 | } else if (!err) { |
| 14056 | printk(KERN_INFO |
| 14057 | "hda_codec: Cannot set up configuration " |
| 14058 | "from BIOS. Using base mode...\n"); |
| 14059 | board_config = ALC268_3ST; |
| 14060 | } |
| 14061 | } |
| 14062 | |
| 14063 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14064 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14065 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14066 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14067 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14068 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14069 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14070 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14071 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14072 | has_beep = 0; |
| 14073 | for (i = 0; i < spec->num_mixers; i++) { |
| 14074 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14075 | has_beep = 1; |
| 14076 | break; |
| 14077 | } |
| 14078 | } |
| 14079 | |
| 14080 | if (has_beep) { |
| 14081 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14082 | if (err < 0) { |
| 14083 | alc_free(codec); |
| 14084 | return err; |
| 14085 | } |
| 14086 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14087 | /* override the amp caps for beep generator */ |
| 14088 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14089 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14090 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14091 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14092 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14093 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14094 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14095 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14096 | /* check whether NID 0x07 is valid */ |
| 14097 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14098 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14099 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14100 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14101 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14102 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14103 | if (spec->auto_mic || |
| 14104 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14105 | spec->adc_nids = alc268_adc_nids_alt; |
| 14106 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14107 | if (spec->auto_mic) |
| 14108 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14109 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14110 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14111 | else |
| 14112 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14113 | } else { |
| 14114 | spec->adc_nids = alc268_adc_nids; |
| 14115 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14116 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14117 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14118 | /* set default input source */ |
| 14119 | for (i = 0; i < spec->num_adc_nids; i++) |
| 14120 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 14121 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 14122 | i < spec->num_mux_defs ? |
| 14123 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14124 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14125 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14126 | |
| 14127 | spec->vmaster_nid = 0x02; |
| 14128 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14129 | codec->patch_ops = alc_patch_ops; |
| 14130 | if (board_config == ALC268_AUTO) |
| 14131 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14132 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14133 | alc_init_jacks(codec); |
| 14134 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14135 | return 0; |
| 14136 | } |
| 14137 | |
| 14138 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14139 | * ALC269 channel source setting (2 channel) |
| 14140 | */ |
| 14141 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14142 | |
| 14143 | #define alc269_dac_nids alc260_dac_nids |
| 14144 | |
| 14145 | static hda_nid_t alc269_adc_nids[1] = { |
| 14146 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14147 | 0x08, |
| 14148 | }; |
| 14149 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14150 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14151 | 0x23, |
| 14152 | }; |
| 14153 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14154 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14155 | /* ADC1 */ |
| 14156 | 0x09, |
| 14157 | }; |
| 14158 | |
| 14159 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14160 | 0x22, |
| 14161 | }; |
| 14162 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14163 | static hda_nid_t alc269_adc_candidates[] = { |
| 14164 | 0x08, 0x09, 0x07, |
| 14165 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14166 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14167 | #define alc269_modes alc260_modes |
| 14168 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14169 | |
| 14170 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14171 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14172 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14175 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14176 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14177 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14178 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14179 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14180 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14181 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14182 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14183 | { } /* end */ |
| 14184 | }; |
| 14185 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14186 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14187 | /* output mixer control */ |
| 14188 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14189 | { |
| 14190 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14191 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14192 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14193 | .info = snd_hda_mixer_amp_switch_info, |
| 14194 | .get = snd_hda_mixer_amp_switch_get, |
| 14195 | .put = alc268_acer_master_sw_put, |
| 14196 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14197 | }, |
| 14198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14200 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14201 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14202 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14203 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14204 | { } |
| 14205 | }; |
| 14206 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14207 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14208 | /* output mixer control */ |
| 14209 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14210 | { |
| 14211 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14212 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14213 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14214 | .info = snd_hda_mixer_amp_switch_info, |
| 14215 | .get = snd_hda_mixer_amp_switch_get, |
| 14216 | .put = alc268_acer_master_sw_put, |
| 14217 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14218 | }, |
| 14219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14221 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14222 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14223 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14224 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14225 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14226 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14227 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14228 | { } |
| 14229 | }; |
| 14230 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14231 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14232 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14233 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14234 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14235 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14236 | { } /* end */ |
| 14237 | }; |
| 14238 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14239 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14240 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14241 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14242 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14243 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14244 | { } /* end */ |
| 14245 | }; |
| 14246 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14247 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14248 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14249 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14250 | { } /* end */ |
| 14251 | }; |
| 14252 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14253 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14254 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14255 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14256 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14257 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14258 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14259 | { } /* end */ |
| 14260 | }; |
| 14261 | |
| 14262 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14263 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14264 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14265 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14266 | { } /* end */ |
| 14267 | }; |
| 14268 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14269 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14270 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14271 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14272 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14273 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14274 | { } /* end */ |
| 14275 | }; |
| 14276 | |
| 14277 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14278 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14279 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14280 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14281 | { } /* end */ |
| 14282 | }; |
| 14283 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14284 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14285 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14286 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14287 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14289 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14290 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14291 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14292 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14293 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14294 | { } |
| 14295 | }; |
| 14296 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14297 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14299 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14300 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14302 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14303 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14305 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14306 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14307 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14308 | { } |
| 14309 | }; |
| 14310 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14311 | /* toggle speaker-output according to the hp-jack state */ |
| 14312 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14313 | { |
| 14314 | unsigned int present; |
| 14315 | unsigned char bits; |
| 14316 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14317 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14318 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14319 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14320 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14321 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14322 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14323 | |
| 14324 | snd_hda_codec_write(codec, 0x20, 0, |
| 14325 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14326 | snd_hda_codec_write(codec, 0x20, 0, |
| 14327 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14328 | |
| 14329 | snd_hda_codec_write(codec, 0x20, 0, |
| 14330 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14331 | snd_hda_codec_write(codec, 0x20, 0, |
| 14332 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14333 | } |
| 14334 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14335 | /* toggle speaker-output according to the hp-jacks state */ |
| 14336 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14337 | { |
| 14338 | unsigned int present; |
| 14339 | unsigned char bits; |
| 14340 | |
| 14341 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14342 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14343 | |
| 14344 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14345 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14346 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14347 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14348 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14349 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14350 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14351 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14352 | |
| 14353 | snd_hda_codec_write(codec, 0x20, 0, |
| 14354 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14355 | snd_hda_codec_write(codec, 0x20, 0, |
| 14356 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14357 | |
| 14358 | snd_hda_codec_write(codec, 0x20, 0, |
| 14359 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14360 | snd_hda_codec_write(codec, 0x20, 0, |
| 14361 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14362 | } |
| 14363 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14364 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14365 | { |
| 14366 | unsigned int present_laptop; |
| 14367 | unsigned int present_dock; |
| 14368 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14369 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14370 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14371 | |
| 14372 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14373 | if (present_dock) |
| 14374 | snd_hda_codec_write(codec, 0x23, 0, |
| 14375 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14376 | if (present_laptop) |
| 14377 | snd_hda_codec_write(codec, 0x23, 0, |
| 14378 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14379 | if (!present_dock && !present_laptop) |
| 14380 | snd_hda_codec_write(codec, 0x23, 0, |
| 14381 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14382 | } |
| 14383 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14384 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14385 | unsigned int res) |
| 14386 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14387 | switch (res >> 26) { |
| 14388 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14389 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14390 | break; |
| 14391 | case ALC880_MIC_EVENT: |
| 14392 | alc_mic_automute(codec); |
| 14393 | break; |
| 14394 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14395 | } |
| 14396 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14397 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14398 | unsigned int res) |
| 14399 | { |
| 14400 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14401 | alc269_lifebook_speaker_automute(codec); |
| 14402 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14403 | alc269_lifebook_mic_autoswitch(codec); |
| 14404 | } |
| 14405 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14406 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14407 | { |
| 14408 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14409 | spec->autocfg.hp_pins[0] = 0x15; |
| 14410 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14411 | spec->ext_mic.pin = 0x18; |
| 14412 | spec->ext_mic.mux_idx = 0; |
| 14413 | spec->int_mic.pin = 0x19; |
| 14414 | spec->int_mic.mux_idx = 1; |
| 14415 | spec->auto_mic = 1; |
| 14416 | } |
| 14417 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14418 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14419 | { |
| 14420 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14421 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14422 | } |
| 14423 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14424 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14425 | { |
| 14426 | alc269_lifebook_speaker_automute(codec); |
| 14427 | alc269_lifebook_mic_autoswitch(codec); |
| 14428 | } |
| 14429 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14430 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14431 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14432 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14433 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14435 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14436 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14437 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14438 | {} |
| 14439 | }; |
| 14440 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14441 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14442 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14443 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14444 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14446 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14447 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14448 | {} |
| 14449 | }; |
| 14450 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14451 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14452 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14453 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14454 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14455 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14456 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14457 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14458 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14459 | {} |
| 14460 | }; |
| 14461 | |
| 14462 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14463 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14464 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14465 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14467 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14468 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14469 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14470 | {} |
| 14471 | }; |
| 14472 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14473 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14474 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14475 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14476 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14477 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14478 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14479 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14480 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14481 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14482 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14483 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14484 | { } |
| 14485 | }; |
| 14486 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14487 | /* toggle speaker-output according to the hp-jack state */ |
| 14488 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14489 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14490 | struct alc_spec *spec = codec->spec; |
| 14491 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14492 | unsigned int present; |
| 14493 | unsigned char bits; |
| 14494 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14495 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14496 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14497 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14498 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14499 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14500 | HDA_AMP_MUTE, bits); |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14501 | alc_report_jack(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14502 | } |
| 14503 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14504 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14505 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14506 | unsigned int res) |
| 14507 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14508 | switch (res >> 26) { |
| 14509 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14510 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14511 | break; |
| 14512 | case ALC880_MIC_EVENT: |
| 14513 | alc_mic_automute(codec); |
| 14514 | break; |
| 14515 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14516 | } |
| 14517 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14518 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14519 | { |
| 14520 | struct alc_spec *spec = codec->spec; |
| 14521 | spec->autocfg.hp_pins[0] = 0x15; |
| 14522 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14523 | spec->ext_mic.pin = 0x18; |
| 14524 | spec->ext_mic.mux_idx = 0; |
| 14525 | spec->int_mic.pin = 0x19; |
| 14526 | spec->int_mic.mux_idx = 1; |
| 14527 | spec->auto_mic = 1; |
| 14528 | } |
| 14529 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14530 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14531 | { |
| 14532 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14533 | spec->autocfg.hp_pins[0] = 0x15; |
| 14534 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14535 | spec->ext_mic.pin = 0x18; |
| 14536 | spec->ext_mic.mux_idx = 0; |
| 14537 | spec->int_mic.pin = 0x12; |
| 14538 | spec->int_mic.mux_idx = 5; |
| 14539 | spec->auto_mic = 1; |
| 14540 | } |
| 14541 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14542 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14543 | { |
| 14544 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14545 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14546 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14547 | spec->ext_mic.pin = 0x18; |
| 14548 | spec->ext_mic.mux_idx = 0; |
| 14549 | spec->int_mic.pin = 0x19; |
| 14550 | spec->int_mic.mux_idx = 1; |
| 14551 | spec->auto_mic = 1; |
| 14552 | } |
| 14553 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14554 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14555 | { |
| 14556 | struct alc_spec *spec = codec->spec; |
| 14557 | spec->autocfg.hp_pins[0] = 0x21; |
| 14558 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14559 | spec->ext_mic.pin = 0x18; |
| 14560 | spec->ext_mic.mux_idx = 0; |
| 14561 | spec->int_mic.pin = 0x12; |
| 14562 | spec->int_mic.mux_idx = 6; |
| 14563 | spec->auto_mic = 1; |
| 14564 | } |
| 14565 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14566 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14567 | { |
| 14568 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14569 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14570 | } |
| 14571 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14572 | /* |
| 14573 | * generic initialization of ADC, input mixers and output mixers |
| 14574 | */ |
| 14575 | static struct hda_verb alc269_init_verbs[] = { |
| 14576 | /* |
| 14577 | * Unmute ADC0 and set the default input to mic-in |
| 14578 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14579 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14580 | |
| 14581 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14582 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14583 | */ |
| 14584 | /* set vol=0 to output mixers */ |
| 14585 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14586 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14587 | |
| 14588 | /* set up input amps for analog loopback */ |
| 14589 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14593 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14596 | |
| 14597 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14598 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14599 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14600 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14601 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14602 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14603 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14604 | |
| 14605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14606 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14607 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14608 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14609 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14610 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14611 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14612 | |
| 14613 | /* set EAPD */ |
| 14614 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14615 | { } |
| 14616 | }; |
| 14617 | |
| 14618 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14619 | /* |
| 14620 | * Unmute ADC0 and set the default input to mic-in |
| 14621 | */ |
| 14622 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14623 | |
| 14624 | /* |
| 14625 | * Set up output mixers (0x02 - 0x03) |
| 14626 | */ |
| 14627 | /* set vol=0 to output mixers */ |
| 14628 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14629 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14630 | |
| 14631 | /* set up input amps for analog loopback */ |
| 14632 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14634 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14635 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14636 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14638 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14639 | |
| 14640 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14641 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14642 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14643 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14644 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14645 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14646 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14647 | |
| 14648 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14649 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14650 | |
| 14651 | /* FIXME: use Mux-type input source selection */ |
| 14652 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14653 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14654 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14655 | |
| 14656 | /* set EAPD */ |
| 14657 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14658 | { } |
| 14659 | }; |
| 14660 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14661 | #define alc269_auto_create_multi_out_ctls \ |
| 14662 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14663 | #define alc269_auto_create_input_ctls \ |
| 14664 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14665 | |
| 14666 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14667 | #define alc269_loopbacks alc880_loopbacks |
| 14668 | #endif |
| 14669 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14670 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14671 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14672 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14673 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14674 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14675 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14676 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14677 | .substreams = 1, |
| 14678 | .channels_min = 2, |
| 14679 | .channels_max = 8, |
| 14680 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14681 | /* NID is set in alc_build_pcms */ |
| 14682 | .ops = { |
| 14683 | .open = alc880_playback_pcm_open, |
| 14684 | .prepare = alc880_playback_pcm_prepare, |
| 14685 | .cleanup = alc880_playback_pcm_cleanup |
| 14686 | }, |
| 14687 | }; |
| 14688 | |
| 14689 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14690 | .substreams = 1, |
| 14691 | .channels_min = 2, |
| 14692 | .channels_max = 2, |
| 14693 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14694 | /* NID is set in alc_build_pcms */ |
| 14695 | }; |
| 14696 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14697 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14698 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14699 | { |
| 14700 | switch (codec->subsystem_id) { |
| 14701 | case 0x103c1586: |
| 14702 | return 1; |
| 14703 | } |
| 14704 | return 0; |
| 14705 | } |
| 14706 | |
| 14707 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14708 | { |
| 14709 | /* update mute-LED according to the speaker mute state */ |
| 14710 | if (nid == 0x01 || nid == 0x14) { |
| 14711 | int pinval; |
| 14712 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14713 | HDA_AMP_MUTE) |
| 14714 | pinval = 0x24; |
| 14715 | else |
| 14716 | pinval = 0x20; |
| 14717 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14718 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14719 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14720 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14721 | } |
| 14722 | return alc_check_power_status(codec, nid); |
| 14723 | } |
| 14724 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14725 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14726 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14727 | { |
| 14728 | struct alc_spec *spec = codec->spec; |
| 14729 | |
| 14730 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14731 | return 0; |
| 14732 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14733 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14734 | if (spec->ext_mic.pin <= 0x12) { |
| 14735 | spec->private_adc_nids[0] = 0x08; |
| 14736 | spec->private_adc_nids[1] = 0x11; |
| 14737 | spec->private_capsrc_nids[0] = 0x23; |
| 14738 | spec->private_capsrc_nids[1] = 0x22; |
| 14739 | } else { |
| 14740 | spec->private_adc_nids[0] = 0x11; |
| 14741 | spec->private_adc_nids[1] = 0x08; |
| 14742 | spec->private_capsrc_nids[0] = 0x22; |
| 14743 | spec->private_capsrc_nids[1] = 0x23; |
| 14744 | } |
| 14745 | spec->adc_nids = spec->private_adc_nids; |
| 14746 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14747 | spec->num_adc_nids = 2; |
| 14748 | spec->dual_adc_switch = 1; |
| 14749 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14750 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14751 | return 1; |
| 14752 | } |
| 14753 | return 0; |
| 14754 | } |
| 14755 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14756 | /* different alc269-variants */ |
| 14757 | enum { |
| 14758 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14759 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14760 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14761 | ALC269_TYPE_ALC269VB, |
| 14762 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14763 | ALC269_TYPE_ALC271X, |
| 14764 | }; |
| 14765 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14766 | /* |
| 14767 | * BIOS auto configuration |
| 14768 | */ |
| 14769 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14770 | { |
| 14771 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14772 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14773 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14774 | |
| 14775 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14776 | alc269_ignore); |
| 14777 | if (err < 0) |
| 14778 | return err; |
| 14779 | |
| 14780 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14781 | if (err < 0) |
| 14782 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14783 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14784 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14785 | else |
| 14786 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14787 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14788 | if (err < 0) |
| 14789 | return err; |
| 14790 | |
| 14791 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14792 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14793 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14794 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14795 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14796 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14797 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14798 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14799 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14800 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14801 | } else { |
| 14802 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14803 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14804 | } |
| 14805 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14806 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14807 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14808 | |
| 14809 | if (!alc275_setup_dual_adc(codec)) |
| 14810 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14811 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14812 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14813 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14814 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14815 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14816 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14817 | |
| 14818 | err = alc_auto_add_mic_boost(codec); |
| 14819 | if (err < 0) |
| 14820 | return err; |
| 14821 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14822 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14823 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14824 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14825 | return 1; |
| 14826 | } |
| 14827 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14828 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14829 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14830 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14831 | |
| 14832 | |
| 14833 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14834 | static void alc269_auto_init(struct hda_codec *codec) |
| 14835 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14836 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14837 | alc269_auto_init_multi_out(codec); |
| 14838 | alc269_auto_init_hp_out(codec); |
| 14839 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14840 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14841 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14842 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14843 | } |
| 14844 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14845 | #ifdef SND_HDA_NEEDS_RESUME |
| 14846 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14847 | { |
| 14848 | int val = alc_read_coef_idx(codec, 0x04); |
| 14849 | if (power_up) |
| 14850 | val |= 1 << 11; |
| 14851 | else |
| 14852 | val &= ~(1 << 11); |
| 14853 | alc_write_coef_idx(codec, 0x04, val); |
| 14854 | } |
| 14855 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14856 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14857 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14858 | { |
| 14859 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14860 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14861 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14862 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14863 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14864 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14865 | msleep(150); |
| 14866 | } |
| 14867 | |
| 14868 | alc_shutup(codec); |
| 14869 | if (spec && spec->power_hook) |
| 14870 | spec->power_hook(codec); |
| 14871 | return 0; |
| 14872 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14873 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14874 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14875 | static int alc269_resume(struct hda_codec *codec) |
| 14876 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14877 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14878 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14879 | msleep(150); |
| 14880 | } |
| 14881 | |
| 14882 | codec->patch_ops.init(codec); |
| 14883 | |
| 14884 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14885 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14886 | msleep(200); |
| 14887 | } |
| 14888 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14889 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14890 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14891 | |
| 14892 | snd_hda_codec_resume_amp(codec); |
| 14893 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14894 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14895 | return 0; |
| 14896 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14897 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14898 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14899 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14900 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14901 | { |
| 14902 | int coef; |
| 14903 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14904 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14905 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14906 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14907 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14908 | } |
| 14909 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14910 | enum { |
| 14911 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14912 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14913 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14914 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14915 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14916 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14917 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14918 | }; |
| 14919 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14920 | static const struct alc_fixup alc269_fixups[] = { |
| 14921 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14922 | .type = ALC_FIXUP_VERBS, |
| 14923 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14924 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14925 | {} |
| 14926 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14927 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14928 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14929 | .type = ALC_FIXUP_VERBS, |
| 14930 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14931 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14932 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14933 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14934 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14935 | }, |
| 14936 | .chained = true, |
| 14937 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14938 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14939 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14940 | .type = ALC_FIXUP_VERBS, |
| 14941 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14942 | /* Enables internal speaker */ |
| 14943 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14944 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14945 | {} |
| 14946 | } |
| 14947 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14948 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14949 | .type = ALC_FIXUP_SKU, |
| 14950 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14951 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14952 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14953 | .type = ALC_FIXUP_PINS, |
| 14954 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14955 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14956 | { } |
| 14957 | } |
| 14958 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14959 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14960 | .type = ALC_FIXUP_VERBS, |
| 14961 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14962 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14963 | {} |
| 14964 | } |
| 14965 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14966 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14967 | .type = ALC_FIXUP_FUNC, |
| 14968 | .v.func = alc269_fixup_hweq, |
| 14969 | .chained = true, |
| 14970 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14971 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14972 | }; |
| 14973 | |
| 14974 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14975 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14976 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14977 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14978 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14979 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14980 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14981 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14982 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14983 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14984 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14985 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14986 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14987 | {} |
| 14988 | }; |
| 14989 | |
| 14990 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14991 | /* |
| 14992 | * configuration and preset |
| 14993 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14994 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14995 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14996 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14997 | [ALC269_AMIC] = "laptop-amic", |
| 14998 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14999 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 15000 | [ALC269_LIFEBOOK] = "lifebook", |
| 15001 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15002 | }; |
| 15003 | |
| 15004 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15005 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15006 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15007 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15008 | ALC269_AMIC), |
| 15009 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 15010 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 15011 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 15012 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 15013 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 15014 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 15015 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 15016 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 15017 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 15018 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 15019 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 15020 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 15021 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 15022 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 15023 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 15024 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 15025 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 15026 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 15027 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 15028 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 15029 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 15030 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 15031 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 15032 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 15033 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 15034 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 15035 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 15036 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 15037 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 15038 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 15039 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 15040 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 15041 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 15042 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 15043 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 15044 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15045 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15046 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15047 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15048 | ALC269_DMIC), |
| 15049 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 15050 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15051 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15052 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 15053 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 15054 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 15055 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 15056 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 15057 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 15058 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15059 | {} |
| 15060 | }; |
| 15061 | |
| 15062 | static struct alc_config_preset alc269_presets[] = { |
| 15063 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15064 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15065 | .init_verbs = { alc269_init_verbs }, |
| 15066 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15067 | .dac_nids = alc269_dac_nids, |
| 15068 | .hp_nid = 0x03, |
| 15069 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15070 | .channel_mode = alc269_modes, |
| 15071 | .input_mux = &alc269_capture_source, |
| 15072 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15073 | [ALC269_QUANTA_FL1] = { |
| 15074 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15075 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15076 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15077 | .dac_nids = alc269_dac_nids, |
| 15078 | .hp_nid = 0x03, |
| 15079 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15080 | .channel_mode = alc269_modes, |
| 15081 | .input_mux = &alc269_capture_source, |
| 15082 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15083 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15084 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15085 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15086 | [ALC269_AMIC] = { |
| 15087 | .mixers = { alc269_laptop_mixer }, |
| 15088 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15089 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15090 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15091 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15092 | .dac_nids = alc269_dac_nids, |
| 15093 | .hp_nid = 0x03, |
| 15094 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15095 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15096 | .unsol_event = alc269_laptop_unsol_event, |
| 15097 | .setup = alc269_laptop_amic_setup, |
| 15098 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15099 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15100 | [ALC269_DMIC] = { |
| 15101 | .mixers = { alc269_laptop_mixer }, |
| 15102 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15103 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15104 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15105 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15106 | .dac_nids = alc269_dac_nids, |
| 15107 | .hp_nid = 0x03, |
| 15108 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15109 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15110 | .unsol_event = alc269_laptop_unsol_event, |
| 15111 | .setup = alc269_laptop_dmic_setup, |
| 15112 | .init_hook = alc269_laptop_inithook, |
| 15113 | }, |
| 15114 | [ALC269VB_AMIC] = { |
| 15115 | .mixers = { alc269vb_laptop_mixer }, |
| 15116 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15117 | .init_verbs = { alc269vb_init_verbs, |
| 15118 | alc269vb_laptop_amic_init_verbs }, |
| 15119 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15120 | .dac_nids = alc269_dac_nids, |
| 15121 | .hp_nid = 0x03, |
| 15122 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15123 | .channel_mode = alc269_modes, |
| 15124 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15125 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15126 | .init_hook = alc269_laptop_inithook, |
| 15127 | }, |
| 15128 | [ALC269VB_DMIC] = { |
| 15129 | .mixers = { alc269vb_laptop_mixer }, |
| 15130 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15131 | .init_verbs = { alc269vb_init_verbs, |
| 15132 | alc269vb_laptop_dmic_init_verbs }, |
| 15133 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15134 | .dac_nids = alc269_dac_nids, |
| 15135 | .hp_nid = 0x03, |
| 15136 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15137 | .channel_mode = alc269_modes, |
| 15138 | .unsol_event = alc269_laptop_unsol_event, |
| 15139 | .setup = alc269vb_laptop_dmic_setup, |
| 15140 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15141 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15142 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15143 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15144 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15145 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15146 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15147 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15148 | .dac_nids = alc269_dac_nids, |
| 15149 | .hp_nid = 0x03, |
| 15150 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15151 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15152 | .unsol_event = alc269_laptop_unsol_event, |
| 15153 | .setup = alc269_laptop_dmic_setup, |
| 15154 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15155 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15156 | [ALC269_LIFEBOOK] = { |
| 15157 | .mixers = { alc269_lifebook_mixer }, |
| 15158 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15159 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15160 | .dac_nids = alc269_dac_nids, |
| 15161 | .hp_nid = 0x03, |
| 15162 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15163 | .channel_mode = alc269_modes, |
| 15164 | .input_mux = &alc269_capture_source, |
| 15165 | .unsol_event = alc269_lifebook_unsol_event, |
| 15166 | .init_hook = alc269_lifebook_init_hook, |
| 15167 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15168 | [ALC271_ACER] = { |
| 15169 | .mixers = { alc269_asus_mixer }, |
| 15170 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15171 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15172 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15173 | .dac_nids = alc269_dac_nids, |
| 15174 | .adc_nids = alc262_dmic_adc_nids, |
| 15175 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15176 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15177 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15178 | .channel_mode = alc269_modes, |
| 15179 | .input_mux = &alc269_capture_source, |
| 15180 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15181 | .unsol_event = alc_sku_unsol_event, |
| 15182 | .setup = alc269vb_laptop_dmic_setup, |
| 15183 | .init_hook = alc_inithook, |
| 15184 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15185 | }; |
| 15186 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15187 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15188 | { |
| 15189 | int val; |
| 15190 | |
| 15191 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15192 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15193 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15194 | } |
| 15195 | |
| 15196 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15197 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15198 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15199 | } |
| 15200 | |
| 15201 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15202 | val = alc_read_coef_idx(codec, 0x04); |
| 15203 | /* Power up output pin */ |
| 15204 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15205 | } |
| 15206 | |
| 15207 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15208 | val = alc_read_coef_idx(codec, 0xd); |
| 15209 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15210 | /* Capless ramp up clock control */ |
| 15211 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15212 | } |
| 15213 | val = alc_read_coef_idx(codec, 0x17); |
| 15214 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15215 | /* Class D power on reset */ |
| 15216 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15217 | } |
| 15218 | } |
| 15219 | return 0; |
| 15220 | } |
| 15221 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15222 | static int patch_alc269(struct hda_codec *codec) |
| 15223 | { |
| 15224 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15225 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15226 | int err; |
| 15227 | |
| 15228 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15229 | if (spec == NULL) |
| 15230 | return -ENOMEM; |
| 15231 | |
| 15232 | codec->spec = spec; |
| 15233 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15234 | alc_auto_parse_customize_define(codec); |
| 15235 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15236 | if (codec->vendor_id == 0x10ec0269) { |
| 15237 | coef = alc_read_coef_idx(codec, 0); |
| 15238 | if ((coef & 0x00f0) == 0x0010) { |
| 15239 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15240 | spec->cdefine.platform_type == 1) { |
| 15241 | alc_codec_rename(codec, "ALC271X"); |
| 15242 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15243 | } else if ((coef & 0xf000) == 0x1000) { |
| 15244 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15245 | } else if ((coef & 0xf000) == 0x2000) { |
| 15246 | alc_codec_rename(codec, "ALC259"); |
| 15247 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15248 | } else if ((coef & 0xf000) == 0x3000) { |
| 15249 | alc_codec_rename(codec, "ALC258"); |
| 15250 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15251 | } else { |
| 15252 | alc_codec_rename(codec, "ALC269VB"); |
| 15253 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15254 | } |
| 15255 | } else |
| 15256 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15257 | alc269_fill_coef(codec); |
| 15258 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15259 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15260 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15261 | alc269_models, |
| 15262 | alc269_cfg_tbl); |
| 15263 | |
| 15264 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15265 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15266 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15267 | board_config = ALC269_AUTO; |
| 15268 | } |
| 15269 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15270 | if (board_config == ALC269_AUTO) { |
| 15271 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15272 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15273 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15274 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15275 | if (board_config == ALC269_AUTO) { |
| 15276 | /* automatic parse from the BIOS config */ |
| 15277 | err = alc269_parse_auto_config(codec); |
| 15278 | if (err < 0) { |
| 15279 | alc_free(codec); |
| 15280 | return err; |
| 15281 | } else if (!err) { |
| 15282 | printk(KERN_INFO |
| 15283 | "hda_codec: Cannot set up configuration " |
| 15284 | "from BIOS. Using base mode...\n"); |
| 15285 | board_config = ALC269_BASIC; |
| 15286 | } |
| 15287 | } |
| 15288 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15289 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15290 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15291 | if (err < 0) { |
| 15292 | alc_free(codec); |
| 15293 | return err; |
| 15294 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15295 | } |
| 15296 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15297 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15298 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15299 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15300 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15301 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15302 | * fix the sample rate of analog I/O to 44.1kHz |
| 15303 | */ |
| 15304 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15305 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15306 | } else if (spec->dual_adc_switch) { |
| 15307 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15308 | /* switch ADC dynamically */ |
| 15309 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15310 | } else { |
| 15311 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15312 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15313 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15314 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15315 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15316 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15317 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15318 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15319 | spec->adc_nids = alc269_adc_nids; |
| 15320 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15321 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15322 | } else { |
| 15323 | spec->adc_nids = alc269vb_adc_nids; |
| 15324 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15325 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15326 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15327 | } |
| 15328 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15329 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15330 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15331 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15332 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15333 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15334 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15335 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15336 | spec->vmaster_nid = 0x02; |
| 15337 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15338 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15339 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15340 | codec->patch_ops.suspend = alc269_suspend; |
| 15341 | #endif |
| 15342 | #ifdef SND_HDA_NEEDS_RESUME |
| 15343 | codec->patch_ops.resume = alc269_resume; |
| 15344 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15345 | if (board_config == ALC269_AUTO) |
| 15346 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15347 | |
| 15348 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15350 | if (!spec->loopback.amplist) |
| 15351 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15352 | if (alc269_mic2_for_mute_led(codec)) |
| 15353 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15354 | #endif |
| 15355 | |
| 15356 | return 0; |
| 15357 | } |
| 15358 | |
| 15359 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15360 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15361 | */ |
| 15362 | |
| 15363 | /* |
| 15364 | * set the path ways for 2 channel output |
| 15365 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15366 | */ |
| 15367 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15368 | /* set pin widget 1Ah (line in) for input */ |
| 15369 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15370 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15371 | * the vref |
| 15372 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15373 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15374 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15375 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15376 | #if 0 |
| 15377 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15378 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15379 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15380 | { } /* end */ |
| 15381 | }; |
| 15382 | /* |
| 15383 | * 6ch mode |
| 15384 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15385 | */ |
| 15386 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15387 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15388 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15389 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15390 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15391 | |
| 15392 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15393 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15394 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15395 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15396 | #if 0 |
| 15397 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15398 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15399 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15400 | { } /* end */ |
| 15401 | }; |
| 15402 | |
| 15403 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15404 | { 2, alc861_threestack_ch2_init }, |
| 15405 | { 6, alc861_threestack_ch6_init }, |
| 15406 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15407 | /* Set mic1 as input and unmute the mixer */ |
| 15408 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15409 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15410 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15411 | { } /* end */ |
| 15412 | }; |
| 15413 | /* Set mic1 as output and mute mixer */ |
| 15414 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15415 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15416 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15417 | { } /* end */ |
| 15418 | }; |
| 15419 | |
| 15420 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15421 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15422 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15423 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15424 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15425 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15426 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15427 | /* set pin widget 1Ah (line in) for input */ |
| 15428 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15429 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15430 | * the vref |
| 15431 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15432 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15433 | |
| 15434 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15435 | #if 0 |
| 15436 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15437 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15438 | #endif |
| 15439 | { } /* end */ |
| 15440 | }; |
| 15441 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15442 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15443 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15444 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15445 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15446 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15447 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15448 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15449 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15450 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15451 | |
| 15452 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15453 | #if 0 |
| 15454 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15455 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15456 | #endif |
| 15457 | { } /* end */ |
| 15458 | }; |
| 15459 | |
| 15460 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15461 | { 2, alc861_asus_ch2_init }, |
| 15462 | { 6, alc861_asus_ch6_init }, |
| 15463 | }; |
| 15464 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15465 | /* patch-ALC861 */ |
| 15466 | |
| 15467 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15468 | /* output mixer control */ |
| 15469 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15470 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15471 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15472 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15473 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15474 | |
| 15475 | /*Input mixer control */ |
| 15476 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15477 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15478 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15479 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15480 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15481 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15484 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15485 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15486 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15487 | { } /* end */ |
| 15488 | }; |
| 15489 | |
| 15490 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15491 | /* output mixer control */ |
| 15492 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15493 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15494 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15495 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15496 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15497 | |
| 15498 | /* Input mixer control */ |
| 15499 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15500 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15501 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15502 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15504 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15505 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15506 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15507 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15508 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15509 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15510 | { |
| 15511 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15512 | .name = "Channel Mode", |
| 15513 | .info = alc_ch_mode_info, |
| 15514 | .get = alc_ch_mode_get, |
| 15515 | .put = alc_ch_mode_put, |
| 15516 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15517 | }, |
| 15518 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15519 | }; |
| 15520 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15521 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15522 | /* output mixer control */ |
| 15523 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15526 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15527 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15528 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15529 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15530 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15531 | /* output mixer control */ |
| 15532 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15533 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15534 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15535 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15536 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15537 | |
| 15538 | /* Input mixer control */ |
| 15539 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15540 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15541 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15542 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15543 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15544 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15547 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15549 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15550 | { |
| 15551 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15552 | .name = "Channel Mode", |
| 15553 | .info = alc_ch_mode_info, |
| 15554 | .get = alc_ch_mode_get, |
| 15555 | .put = alc_ch_mode_put, |
| 15556 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15557 | }, |
| 15558 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15559 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15560 | |
| 15561 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15562 | /* output mixer control */ |
| 15563 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15564 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15565 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15566 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15567 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15568 | |
| 15569 | /* Input mixer control */ |
| 15570 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15571 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15572 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15573 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15574 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15575 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15577 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15578 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15579 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15580 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15581 | { |
| 15582 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15583 | .name = "Channel Mode", |
| 15584 | .info = alc_ch_mode_info, |
| 15585 | .get = alc_ch_mode_get, |
| 15586 | .put = alc_ch_mode_put, |
| 15587 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15588 | }, |
| 15589 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15590 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15591 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15592 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15593 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15595 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15596 | { } |
| 15597 | }; |
| 15598 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15599 | /* |
| 15600 | * generic initialization of ADC, input mixers and output mixers |
| 15601 | */ |
| 15602 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15603 | /* |
| 15604 | * Unmute ADC0 and set the default input to mic-in |
| 15605 | */ |
| 15606 | /* port-A for surround (rear panel) */ |
| 15607 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15608 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15609 | /* port-B for mic-in (rear panel) with vref */ |
| 15610 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15611 | /* port-C for line-in (rear panel) */ |
| 15612 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15613 | /* port-D for Front */ |
| 15614 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15615 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15616 | /* port-E for HP out (front panel) */ |
| 15617 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15618 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15619 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15620 | /* port-F for mic-in (front panel) with vref */ |
| 15621 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15622 | /* port-G for CLFE (rear panel) */ |
| 15623 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15624 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15625 | /* port-H for side (rear panel) */ |
| 15626 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15627 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15628 | /* CD-in */ |
| 15629 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15630 | /* route front mic to ADC1*/ |
| 15631 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15632 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15634 | /* Unmute DAC0~3 & spdif out*/ |
| 15635 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15636 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15637 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15638 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15639 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15640 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15641 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15642 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15643 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15644 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15645 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15647 | /* Unmute Stereo Mixer 15 */ |
| 15648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15651 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15652 | |
| 15653 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15654 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15655 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15656 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15657 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15658 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15659 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15660 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15661 | /* hp used DAC 3 (Front) */ |
| 15662 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15663 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15664 | |
| 15665 | { } |
| 15666 | }; |
| 15667 | |
| 15668 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15669 | /* |
| 15670 | * Unmute ADC0 and set the default input to mic-in |
| 15671 | */ |
| 15672 | /* port-A for surround (rear panel) */ |
| 15673 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15674 | /* port-B for mic-in (rear panel) with vref */ |
| 15675 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15676 | /* port-C for line-in (rear panel) */ |
| 15677 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15678 | /* port-D for Front */ |
| 15679 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15680 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15681 | /* port-E for HP out (front panel) */ |
| 15682 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15683 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15684 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15685 | /* port-F for mic-in (front panel) with vref */ |
| 15686 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15687 | /* port-G for CLFE (rear panel) */ |
| 15688 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15689 | /* port-H for side (rear panel) */ |
| 15690 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15691 | /* CD-in */ |
| 15692 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15693 | /* route front mic to ADC1*/ |
| 15694 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15695 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15696 | /* Unmute DAC0~3 & spdif out*/ |
| 15697 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15698 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15699 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15700 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15702 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15703 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15704 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15705 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15706 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15707 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15708 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15709 | /* Unmute Stereo Mixer 15 */ |
| 15710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15713 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15714 | |
| 15715 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15717 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15718 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15719 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15720 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15721 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15722 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15723 | /* hp used DAC 3 (Front) */ |
| 15724 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15725 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15726 | { } |
| 15727 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15728 | |
| 15729 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15730 | /* |
| 15731 | * Unmute ADC0 and set the default input to mic-in |
| 15732 | */ |
| 15733 | /* port-A for surround (rear panel) */ |
| 15734 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15735 | /* port-B for mic-in (rear panel) with vref */ |
| 15736 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15737 | /* port-C for line-in (rear panel) */ |
| 15738 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15739 | /* port-D for Front */ |
| 15740 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15741 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15742 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15743 | /* this has to be set to VREF80 */ |
| 15744 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15745 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15746 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15747 | /* port-F for mic-in (front panel) with vref */ |
| 15748 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15749 | /* port-G for CLFE (rear panel) */ |
| 15750 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15751 | /* port-H for side (rear panel) */ |
| 15752 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15753 | /* CD-in */ |
| 15754 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15755 | /* route front mic to ADC1*/ |
| 15756 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15757 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15758 | /* Unmute DAC0~3 & spdif out*/ |
| 15759 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15760 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15761 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15762 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15763 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15764 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15765 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15766 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15767 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15768 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15769 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15770 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15771 | /* Unmute Stereo Mixer 15 */ |
| 15772 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15776 | |
| 15777 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15778 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15779 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15780 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15781 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15782 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15783 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15784 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15785 | /* hp used DAC 3 (Front) */ |
| 15786 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15787 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15788 | { } |
| 15789 | }; |
| 15790 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15791 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15792 | /* |
| 15793 | * Unmute ADC0 and set the default input to mic-in |
| 15794 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15795 | /* port-A for surround (rear panel) |
| 15796 | * according to codec#0 this is the HP jack |
| 15797 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15798 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15799 | /* route front PCM to HP */ |
| 15800 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15801 | /* port-B for mic-in (rear panel) with vref */ |
| 15802 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15803 | /* port-C for line-in (rear panel) */ |
| 15804 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15805 | /* port-D for Front */ |
| 15806 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15807 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15808 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15809 | /* this has to be set to VREF80 */ |
| 15810 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15811 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15812 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15813 | /* port-F for mic-in (front panel) with vref */ |
| 15814 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15815 | /* port-G for CLFE (rear panel) */ |
| 15816 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15817 | /* port-H for side (rear panel) */ |
| 15818 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15819 | /* CD-in */ |
| 15820 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15821 | /* route front mic to ADC1*/ |
| 15822 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15824 | /* Unmute DAC0~3 & spdif out*/ |
| 15825 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15826 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15827 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15828 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15830 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15831 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15832 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15833 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15834 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15835 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15836 | /* Unmute Stereo Mixer 15 */ |
| 15837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15838 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15839 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15840 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15841 | |
| 15842 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15843 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15844 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15845 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15846 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15849 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15850 | /* hp used DAC 3 (Front) */ |
| 15851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15853 | { } |
| 15854 | }; |
| 15855 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15856 | /* additional init verbs for ASUS laptops */ |
| 15857 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15858 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15859 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15860 | { } |
| 15861 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15863 | /* |
| 15864 | * generic initialization of ADC, input mixers and output mixers |
| 15865 | */ |
| 15866 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15867 | /* |
| 15868 | * Unmute ADC0 and set the default input to mic-in |
| 15869 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15870 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15871 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15872 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15873 | /* Unmute DAC0~3 & spdif out*/ |
| 15874 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15875 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15876 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15877 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15878 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15879 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15880 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15881 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15882 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15883 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15884 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15886 | /* Unmute Stereo Mixer 15 */ |
| 15887 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15891 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15892 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15893 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15894 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15895 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15896 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15897 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15898 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15899 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15900 | |
| 15901 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15902 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15903 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15905 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15906 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15907 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15908 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15909 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15910 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15911 | |
| 15912 | { } |
| 15913 | }; |
| 15914 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15915 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15916 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15917 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15918 | { } |
| 15919 | }; |
| 15920 | |
| 15921 | /* toggle speaker-output according to the hp-jack state */ |
| 15922 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15923 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15924 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15925 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15926 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15927 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15928 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15929 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15930 | } |
| 15931 | |
| 15932 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15933 | unsigned int res) |
| 15934 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15935 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15936 | alc861_toshiba_automute(codec); |
| 15937 | } |
| 15938 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15939 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15940 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15941 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15942 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15943 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15944 | |
| 15945 | |
| 15946 | #define ALC861_DIGOUT_NID 0x07 |
| 15947 | |
| 15948 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15949 | { 8, NULL } |
| 15950 | }; |
| 15951 | |
| 15952 | static hda_nid_t alc861_dac_nids[4] = { |
| 15953 | /* front, surround, clfe, side */ |
| 15954 | 0x03, 0x06, 0x05, 0x04 |
| 15955 | }; |
| 15956 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15957 | static hda_nid_t alc660_dac_nids[3] = { |
| 15958 | /* front, clfe, surround */ |
| 15959 | 0x03, 0x05, 0x06 |
| 15960 | }; |
| 15961 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15962 | static hda_nid_t alc861_adc_nids[1] = { |
| 15963 | /* ADC0-2 */ |
| 15964 | 0x08, |
| 15965 | }; |
| 15966 | |
| 15967 | static struct hda_input_mux alc861_capture_source = { |
| 15968 | .num_items = 5, |
| 15969 | .items = { |
| 15970 | { "Mic", 0x0 }, |
| 15971 | { "Front Mic", 0x3 }, |
| 15972 | { "Line", 0x1 }, |
| 15973 | { "CD", 0x4 }, |
| 15974 | { "Mixer", 0x5 }, |
| 15975 | }, |
| 15976 | }; |
| 15977 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15978 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15979 | { |
| 15980 | struct alc_spec *spec = codec->spec; |
| 15981 | hda_nid_t mix, srcs[5]; |
| 15982 | int i, j, num; |
| 15983 | |
| 15984 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15985 | return 0; |
| 15986 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15987 | if (num < 0) |
| 15988 | return 0; |
| 15989 | for (i = 0; i < num; i++) { |
| 15990 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15991 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15992 | if (type != AC_WID_AUD_OUT) |
| 15993 | continue; |
| 15994 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15995 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15996 | break; |
| 15997 | if (j >= spec->multiout.num_dacs) |
| 15998 | return srcs[i]; |
| 15999 | } |
| 16000 | return 0; |
| 16001 | } |
| 16002 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16003 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16004 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16005 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16006 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16007 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16008 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16009 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16010 | |
| 16011 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 16012 | for (i = 0; i < cfg->line_outs; i++) { |
| 16013 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16014 | dac = alc861_look_for_dac(codec, nid); |
| 16015 | if (!dac) |
| 16016 | continue; |
| 16017 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16018 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16019 | return 0; |
| 16020 | } |
| 16021 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16022 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 16023 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16024 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16025 | 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] | 16026 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 16027 | } |
| 16028 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16029 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 16030 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 16031 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16032 | /* add playback controls from the parsed DAC table */ |
| 16033 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 16034 | const struct auto_pin_cfg *cfg) |
| 16035 | { |
| 16036 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16037 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16038 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16039 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16040 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16041 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16042 | int i, err; |
| 16043 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16044 | for (i = 0; i < cfg->line_outs; i++) { |
| 16045 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16046 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16047 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16048 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16049 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16050 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16051 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16052 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16053 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16054 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16055 | return err; |
| 16056 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16057 | const char *name = pfx; |
| 16058 | if (!name) |
| 16059 | name = chname[i]; |
| 16060 | err = __alc861_create_out_sw(codec, name, nid, i, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16061 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16062 | return err; |
| 16063 | } |
| 16064 | } |
| 16065 | return 0; |
| 16066 | } |
| 16067 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16068 | 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] | 16069 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16070 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16071 | int err; |
| 16072 | hda_nid_t nid; |
| 16073 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16074 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16075 | return 0; |
| 16076 | |
| 16077 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16078 | nid = alc861_look_for_dac(codec, pin); |
| 16079 | if (nid) { |
| 16080 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16081 | if (err < 0) |
| 16082 | return err; |
| 16083 | spec->multiout.hp_nid = nid; |
| 16084 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16085 | } |
| 16086 | return 0; |
| 16087 | } |
| 16088 | |
| 16089 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16090 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16091 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16092 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16093 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16094 | } |
| 16095 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16096 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16097 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16098 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16099 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16100 | hda_nid_t mix, srcs[5]; |
| 16101 | int i, num; |
| 16102 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16103 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16104 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16105 | 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] | 16106 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16107 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16108 | return; |
| 16109 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16110 | if (num < 0) |
| 16111 | return; |
| 16112 | for (i = 0; i < num; i++) { |
| 16113 | unsigned int mute; |
| 16114 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16115 | mute = AMP_IN_UNMUTE(i); |
| 16116 | else |
| 16117 | mute = AMP_IN_MUTE(i); |
| 16118 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16119 | mute); |
| 16120 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16121 | } |
| 16122 | |
| 16123 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16124 | { |
| 16125 | struct alc_spec *spec = codec->spec; |
| 16126 | int i; |
| 16127 | |
| 16128 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16129 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16130 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16131 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16132 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16133 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16134 | } |
| 16135 | } |
| 16136 | |
| 16137 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16138 | { |
| 16139 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16140 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16141 | if (spec->autocfg.hp_outs) |
| 16142 | alc861_auto_set_output_and_unmute(codec, |
| 16143 | spec->autocfg.hp_pins[0], |
| 16144 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16145 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16146 | if (spec->autocfg.speaker_outs) |
| 16147 | alc861_auto_set_output_and_unmute(codec, |
| 16148 | spec->autocfg.speaker_pins[0], |
| 16149 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16150 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16151 | } |
| 16152 | |
| 16153 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16154 | { |
| 16155 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16156 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16157 | int i; |
| 16158 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16159 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16160 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16161 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16162 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16163 | } |
| 16164 | } |
| 16165 | |
| 16166 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16167 | /* return 1 if successful, 0 if the proper config is not found, |
| 16168 | * or a negative error code |
| 16169 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16170 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16171 | { |
| 16172 | struct alc_spec *spec = codec->spec; |
| 16173 | int err; |
| 16174 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16175 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16176 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16177 | alc861_ignore); |
| 16178 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16179 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16180 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16181 | return 0; /* can't find valid BIOS pin config */ |
| 16182 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16183 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16184 | if (err < 0) |
| 16185 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16186 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16187 | if (err < 0) |
| 16188 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16189 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16190 | if (err < 0) |
| 16191 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16192 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16193 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16194 | return err; |
| 16195 | |
| 16196 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16197 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16198 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16199 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16200 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16201 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16202 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16203 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16204 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16205 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16206 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16207 | |
| 16208 | spec->adc_nids = alc861_adc_nids; |
| 16209 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16210 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16211 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16212 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16213 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16214 | return 1; |
| 16215 | } |
| 16216 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16217 | /* additional initialization for auto-configuration model */ |
| 16218 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16219 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16220 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16221 | alc861_auto_init_multi_out(codec); |
| 16222 | alc861_auto_init_hp_out(codec); |
| 16223 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16224 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16225 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16226 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16227 | } |
| 16228 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16229 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16230 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16231 | { 0x15, HDA_INPUT, 0 }, |
| 16232 | { 0x15, HDA_INPUT, 1 }, |
| 16233 | { 0x15, HDA_INPUT, 2 }, |
| 16234 | { 0x15, HDA_INPUT, 3 }, |
| 16235 | { } /* end */ |
| 16236 | }; |
| 16237 | #endif |
| 16238 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16239 | |
| 16240 | /* |
| 16241 | * configuration and preset |
| 16242 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16243 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16244 | [ALC861_3ST] = "3stack", |
| 16245 | [ALC660_3ST] = "3stack-660", |
| 16246 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16247 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16248 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16249 | [ALC861_TOSHIBA] = "toshiba", |
| 16250 | [ALC861_ASUS] = "asus", |
| 16251 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16252 | [ALC861_AUTO] = "auto", |
| 16253 | }; |
| 16254 | |
| 16255 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16256 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16257 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16258 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16259 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16260 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16261 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16262 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16263 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16264 | * Any other models that need this preset? |
| 16265 | */ |
| 16266 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16267 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16268 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16269 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16270 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16271 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16272 | /* FIXME: the below seems conflict */ |
| 16273 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16274 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16275 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16276 | {} |
| 16277 | }; |
| 16278 | |
| 16279 | static struct alc_config_preset alc861_presets[] = { |
| 16280 | [ALC861_3ST] = { |
| 16281 | .mixers = { alc861_3ST_mixer }, |
| 16282 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16283 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16284 | .dac_nids = alc861_dac_nids, |
| 16285 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16286 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16287 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16288 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16289 | .adc_nids = alc861_adc_nids, |
| 16290 | .input_mux = &alc861_capture_source, |
| 16291 | }, |
| 16292 | [ALC861_3ST_DIG] = { |
| 16293 | .mixers = { alc861_base_mixer }, |
| 16294 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16295 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16296 | .dac_nids = alc861_dac_nids, |
| 16297 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16298 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16299 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16300 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16301 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16302 | .adc_nids = alc861_adc_nids, |
| 16303 | .input_mux = &alc861_capture_source, |
| 16304 | }, |
| 16305 | [ALC861_6ST_DIG] = { |
| 16306 | .mixers = { alc861_base_mixer }, |
| 16307 | .init_verbs = { alc861_base_init_verbs }, |
| 16308 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16309 | .dac_nids = alc861_dac_nids, |
| 16310 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16311 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16312 | .channel_mode = alc861_8ch_modes, |
| 16313 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16314 | .adc_nids = alc861_adc_nids, |
| 16315 | .input_mux = &alc861_capture_source, |
| 16316 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16317 | [ALC660_3ST] = { |
| 16318 | .mixers = { alc861_3ST_mixer }, |
| 16319 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16320 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16321 | .dac_nids = alc660_dac_nids, |
| 16322 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16323 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16324 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16325 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16326 | .adc_nids = alc861_adc_nids, |
| 16327 | .input_mux = &alc861_capture_source, |
| 16328 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16329 | [ALC861_UNIWILL_M31] = { |
| 16330 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16331 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16332 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16333 | .dac_nids = alc861_dac_nids, |
| 16334 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16335 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16336 | .channel_mode = alc861_uniwill_m31_modes, |
| 16337 | .need_dac_fix = 1, |
| 16338 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16339 | .adc_nids = alc861_adc_nids, |
| 16340 | .input_mux = &alc861_capture_source, |
| 16341 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16342 | [ALC861_TOSHIBA] = { |
| 16343 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16344 | .init_verbs = { alc861_base_init_verbs, |
| 16345 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16346 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16347 | .dac_nids = alc861_dac_nids, |
| 16348 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16349 | .channel_mode = alc883_3ST_2ch_modes, |
| 16350 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16351 | .adc_nids = alc861_adc_nids, |
| 16352 | .input_mux = &alc861_capture_source, |
| 16353 | .unsol_event = alc861_toshiba_unsol_event, |
| 16354 | .init_hook = alc861_toshiba_automute, |
| 16355 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16356 | [ALC861_ASUS] = { |
| 16357 | .mixers = { alc861_asus_mixer }, |
| 16358 | .init_verbs = { alc861_asus_init_verbs }, |
| 16359 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16360 | .dac_nids = alc861_dac_nids, |
| 16361 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16362 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16363 | .channel_mode = alc861_asus_modes, |
| 16364 | .need_dac_fix = 1, |
| 16365 | .hp_nid = 0x06, |
| 16366 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16367 | .adc_nids = alc861_adc_nids, |
| 16368 | .input_mux = &alc861_capture_source, |
| 16369 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16370 | [ALC861_ASUS_LAPTOP] = { |
| 16371 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16372 | .init_verbs = { alc861_asus_init_verbs, |
| 16373 | alc861_asus_laptop_init_verbs }, |
| 16374 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16375 | .dac_nids = alc861_dac_nids, |
| 16376 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16377 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16378 | .channel_mode = alc883_3ST_2ch_modes, |
| 16379 | .need_dac_fix = 1, |
| 16380 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16381 | .adc_nids = alc861_adc_nids, |
| 16382 | .input_mux = &alc861_capture_source, |
| 16383 | }, |
| 16384 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16385 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16386 | /* Pin config fixes */ |
| 16387 | enum { |
| 16388 | PINFIX_FSC_AMILO_PI1505, |
| 16389 | }; |
| 16390 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16391 | static const struct alc_fixup alc861_fixups[] = { |
| 16392 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16393 | .type = ALC_FIXUP_PINS, |
| 16394 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16395 | { 0x0b, 0x0221101f }, /* HP */ |
| 16396 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16397 | { } |
| 16398 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16399 | }, |
| 16400 | }; |
| 16401 | |
| 16402 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16403 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16404 | {} |
| 16405 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16406 | |
| 16407 | static int patch_alc861(struct hda_codec *codec) |
| 16408 | { |
| 16409 | struct alc_spec *spec; |
| 16410 | int board_config; |
| 16411 | int err; |
| 16412 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16413 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16414 | if (spec == NULL) |
| 16415 | return -ENOMEM; |
| 16416 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16417 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16418 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16419 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16420 | alc861_models, |
| 16421 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16422 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16423 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16424 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16425 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16426 | board_config = ALC861_AUTO; |
| 16427 | } |
| 16428 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16429 | if (board_config == ALC861_AUTO) { |
| 16430 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16431 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16432 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16433 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16434 | if (board_config == ALC861_AUTO) { |
| 16435 | /* automatic parse from the BIOS config */ |
| 16436 | err = alc861_parse_auto_config(codec); |
| 16437 | if (err < 0) { |
| 16438 | alc_free(codec); |
| 16439 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16440 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16441 | printk(KERN_INFO |
| 16442 | "hda_codec: Cannot set up configuration " |
| 16443 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16444 | board_config = ALC861_3ST_DIG; |
| 16445 | } |
| 16446 | } |
| 16447 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16448 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16449 | if (err < 0) { |
| 16450 | alc_free(codec); |
| 16451 | return err; |
| 16452 | } |
| 16453 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16454 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16455 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16456 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16457 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16458 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16459 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16460 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16461 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16462 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16463 | if (!spec->cap_mixer) |
| 16464 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16465 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16466 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16467 | spec->vmaster_nid = 0x03; |
| 16468 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16469 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16470 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16471 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16472 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16473 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16474 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16475 | spec->power_hook = alc_power_eapd; |
| 16476 | #endif |
| 16477 | } |
| 16478 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16479 | if (!spec->loopback.amplist) |
| 16480 | spec->loopback.amplist = alc861_loopbacks; |
| 16481 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16482 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16483 | return 0; |
| 16484 | } |
| 16485 | |
| 16486 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16487 | * ALC861-VD support |
| 16488 | * |
| 16489 | * Based on ALC882 |
| 16490 | * |
| 16491 | * In addition, an independent DAC |
| 16492 | */ |
| 16493 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16494 | |
| 16495 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16496 | /* front, surr, clfe, side surr */ |
| 16497 | 0x02, 0x03, 0x04, 0x05 |
| 16498 | }; |
| 16499 | |
| 16500 | /* dac_nids for ALC660vd are in a different order - according to |
| 16501 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16502 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16503 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16504 | * - and it is the same as in 861vd. |
| 16505 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16506 | */ |
| 16507 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16508 | /* front, rear, clfe, rear_surr */ |
| 16509 | 0x02, 0x04, 0x03 |
| 16510 | }; |
| 16511 | |
| 16512 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16513 | /* ADC0 */ |
| 16514 | 0x09, |
| 16515 | }; |
| 16516 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16517 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16518 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16519 | /* input MUX */ |
| 16520 | /* FIXME: should be a matrix-type input source selection */ |
| 16521 | static struct hda_input_mux alc861vd_capture_source = { |
| 16522 | .num_items = 4, |
| 16523 | .items = { |
| 16524 | { "Mic", 0x0 }, |
| 16525 | { "Front Mic", 0x1 }, |
| 16526 | { "Line", 0x2 }, |
| 16527 | { "CD", 0x4 }, |
| 16528 | }, |
| 16529 | }; |
| 16530 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16531 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16532 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16533 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16534 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16535 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16536 | }, |
| 16537 | }; |
| 16538 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16539 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16540 | .num_items = 2, |
| 16541 | .items = { |
| 16542 | { "Front Mic", 0x0 }, |
| 16543 | { "ATAPI Mic", 0x1 }, |
| 16544 | }, |
| 16545 | }; |
| 16546 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16547 | /* |
| 16548 | * 2ch mode |
| 16549 | */ |
| 16550 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16551 | { 2, NULL } |
| 16552 | }; |
| 16553 | |
| 16554 | /* |
| 16555 | * 6ch mode |
| 16556 | */ |
| 16557 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16558 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16559 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16560 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16561 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16562 | { } /* end */ |
| 16563 | }; |
| 16564 | |
| 16565 | /* |
| 16566 | * 8ch mode |
| 16567 | */ |
| 16568 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16569 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16570 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16571 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16572 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16573 | { } /* end */ |
| 16574 | }; |
| 16575 | |
| 16576 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16577 | { 6, alc861vd_6stack_ch6_init }, |
| 16578 | { 8, alc861vd_6stack_ch8_init }, |
| 16579 | }; |
| 16580 | |
| 16581 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16582 | { |
| 16583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16584 | .name = "Channel Mode", |
| 16585 | .info = alc_ch_mode_info, |
| 16586 | .get = alc_ch_mode_get, |
| 16587 | .put = alc_ch_mode_put, |
| 16588 | }, |
| 16589 | { } /* end */ |
| 16590 | }; |
| 16591 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16592 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16593 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16594 | */ |
| 16595 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16596 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16597 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16598 | |
| 16599 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16600 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16601 | |
| 16602 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16603 | HDA_OUTPUT), |
| 16604 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16605 | HDA_OUTPUT), |
| 16606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16608 | |
| 16609 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16610 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16611 | |
| 16612 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16613 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16614 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16615 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16617 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16618 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16621 | |
| 16622 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16623 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16624 | |
| 16625 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16626 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16627 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16628 | { } /* end */ |
| 16629 | }; |
| 16630 | |
| 16631 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16634 | |
| 16635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16636 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16637 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16640 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16641 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16644 | |
| 16645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16646 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16647 | |
| 16648 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16649 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16650 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16651 | { } /* end */ |
| 16652 | }; |
| 16653 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16654 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16655 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16656 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16657 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16658 | |
| 16659 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16660 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16661 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16664 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16665 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16666 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16667 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16668 | |
| 16669 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16670 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16671 | |
| 16672 | { } /* end */ |
| 16673 | }; |
| 16674 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16675 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16676 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16677 | */ |
| 16678 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16679 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16680 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16681 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16682 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16683 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16686 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16687 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16688 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16689 | { } /* end */ |
| 16690 | }; |
| 16691 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16692 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16693 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16694 | */ |
| 16695 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16697 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16698 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16699 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16700 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16701 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16702 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16703 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16704 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16705 | { } /* end */ |
| 16706 | }; |
| 16707 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16708 | /* |
| 16709 | * generic initialization of ADC, input mixers and output mixers |
| 16710 | */ |
| 16711 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16712 | /* |
| 16713 | * Unmute ADC0 and set the default input to mic-in |
| 16714 | */ |
| 16715 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16716 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16717 | |
| 16718 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16719 | * the analog-loopback mixer widget |
| 16720 | */ |
| 16721 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16727 | |
| 16728 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16733 | |
| 16734 | /* |
| 16735 | * Set up output mixers (0x02 - 0x05) |
| 16736 | */ |
| 16737 | /* set vol=0 to output mixers */ |
| 16738 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16739 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16740 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16741 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16742 | |
| 16743 | /* set up input amps for analog loopback */ |
| 16744 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16748 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16750 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16752 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16753 | |
| 16754 | { } |
| 16755 | }; |
| 16756 | |
| 16757 | /* |
| 16758 | * 3-stack pin configuration: |
| 16759 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16760 | */ |
| 16761 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16762 | /* |
| 16763 | * Set pin mode and muting |
| 16764 | */ |
| 16765 | /* set front pin widgets 0x14 for output */ |
| 16766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16768 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16769 | |
| 16770 | /* Mic (rear) pin: input vref at 80% */ |
| 16771 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16772 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16773 | /* Front Mic pin: input vref at 80% */ |
| 16774 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16775 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16776 | /* Line In pin: input */ |
| 16777 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16778 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16779 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16780 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16781 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16782 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16783 | /* CD pin widget for input */ |
| 16784 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16785 | |
| 16786 | { } |
| 16787 | }; |
| 16788 | |
| 16789 | /* |
| 16790 | * 6-stack pin configuration: |
| 16791 | */ |
| 16792 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16793 | /* |
| 16794 | * Set pin mode and muting |
| 16795 | */ |
| 16796 | /* set front pin widgets 0x14 for output */ |
| 16797 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16798 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16799 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16800 | |
| 16801 | /* Rear Pin: output 1 (0x0d) */ |
| 16802 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16803 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16804 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16805 | /* CLFE Pin: output 2 (0x0e) */ |
| 16806 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16807 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16808 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16809 | /* Side Pin: output 3 (0x0f) */ |
| 16810 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16811 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16812 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16813 | |
| 16814 | /* Mic (rear) pin: input vref at 80% */ |
| 16815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16817 | /* Front Mic pin: input vref at 80% */ |
| 16818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16820 | /* Line In pin: input */ |
| 16821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16823 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16824 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16825 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16826 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16827 | /* CD pin widget for input */ |
| 16828 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16829 | |
| 16830 | { } |
| 16831 | }; |
| 16832 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16833 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16834 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16835 | { } |
| 16836 | }; |
| 16837 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16838 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16839 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16840 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16841 | { } |
| 16842 | }; |
| 16843 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16844 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16848 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16849 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16850 | {} |
| 16851 | }; |
| 16852 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16853 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16854 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16855 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16856 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16857 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16858 | } |
| 16859 | |
| 16860 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16861 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16862 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16863 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16864 | } |
| 16865 | |
| 16866 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16867 | unsigned int res) |
| 16868 | { |
| 16869 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16870 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16871 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16872 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16873 | default: |
| 16874 | alc_automute_amp_unsol_event(codec, res); |
| 16875 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16876 | } |
| 16877 | } |
| 16878 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16879 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16880 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16881 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16882 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16883 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16884 | |
| 16885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16888 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16890 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16891 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16892 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16893 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16894 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16895 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16896 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16897 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16898 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16899 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16900 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16901 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16902 | |
| 16903 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16904 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16905 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16906 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16907 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16908 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16909 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16910 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16911 | |
| 16912 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16913 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16915 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16916 | |
| 16917 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16918 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16919 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16920 | |
| 16921 | { } /* end */ |
| 16922 | }; |
| 16923 | |
| 16924 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16925 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16926 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16927 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16928 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16929 | spec->autocfg.hp_pins[0] = 0x15; |
| 16930 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16931 | } |
| 16932 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16933 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16934 | #define alc861vd_loopbacks alc880_loopbacks |
| 16935 | #endif |
| 16936 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16937 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16938 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16939 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16940 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16941 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16942 | |
| 16943 | /* |
| 16944 | * configuration and preset |
| 16945 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16946 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16947 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16948 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16949 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16950 | [ALC861VD_3ST] = "3stack", |
| 16951 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16952 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16953 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16954 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16955 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16956 | [ALC861VD_AUTO] = "auto", |
| 16957 | }; |
| 16958 | |
| 16959 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16960 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16961 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16962 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16963 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16964 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16965 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16966 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16967 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16968 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16969 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16970 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16971 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16972 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16973 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16974 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16975 | {} |
| 16976 | }; |
| 16977 | |
| 16978 | static struct alc_config_preset alc861vd_presets[] = { |
| 16979 | [ALC660VD_3ST] = { |
| 16980 | .mixers = { alc861vd_3st_mixer }, |
| 16981 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16982 | alc861vd_3stack_init_verbs }, |
| 16983 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16984 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16985 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16986 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16987 | .input_mux = &alc861vd_capture_source, |
| 16988 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16989 | [ALC660VD_3ST_DIG] = { |
| 16990 | .mixers = { alc861vd_3st_mixer }, |
| 16991 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16992 | alc861vd_3stack_init_verbs }, |
| 16993 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16994 | .dac_nids = alc660vd_dac_nids, |
| 16995 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16996 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16997 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16998 | .input_mux = &alc861vd_capture_source, |
| 16999 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17000 | [ALC861VD_3ST] = { |
| 17001 | .mixers = { alc861vd_3st_mixer }, |
| 17002 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17003 | alc861vd_3stack_init_verbs }, |
| 17004 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17005 | .dac_nids = alc861vd_dac_nids, |
| 17006 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17007 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17008 | .input_mux = &alc861vd_capture_source, |
| 17009 | }, |
| 17010 | [ALC861VD_3ST_DIG] = { |
| 17011 | .mixers = { alc861vd_3st_mixer }, |
| 17012 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17013 | alc861vd_3stack_init_verbs }, |
| 17014 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17015 | .dac_nids = alc861vd_dac_nids, |
| 17016 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17017 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17018 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17019 | .input_mux = &alc861vd_capture_source, |
| 17020 | }, |
| 17021 | [ALC861VD_6ST_DIG] = { |
| 17022 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 17023 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17024 | alc861vd_6stack_init_verbs }, |
| 17025 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17026 | .dac_nids = alc861vd_dac_nids, |
| 17027 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17028 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 17029 | .channel_mode = alc861vd_6stack_modes, |
| 17030 | .input_mux = &alc861vd_capture_source, |
| 17031 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17032 | [ALC861VD_LENOVO] = { |
| 17033 | .mixers = { alc861vd_lenovo_mixer }, |
| 17034 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17035 | alc861vd_3stack_init_verbs, |
| 17036 | alc861vd_eapd_verbs, |
| 17037 | alc861vd_lenovo_unsol_verbs }, |
| 17038 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17039 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17040 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17041 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17042 | .input_mux = &alc861vd_capture_source, |
| 17043 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17044 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17045 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17046 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17047 | [ALC861VD_DALLAS] = { |
| 17048 | .mixers = { alc861vd_dallas_mixer }, |
| 17049 | .init_verbs = { alc861vd_dallas_verbs }, |
| 17050 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17051 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17052 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17053 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17054 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17055 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17056 | .setup = alc861vd_dallas_setup, |
| 17057 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17058 | }, |
| 17059 | [ALC861VD_HP] = { |
| 17060 | .mixers = { alc861vd_hp_mixer }, |
| 17061 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17062 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17063 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17064 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17065 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17066 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17067 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17068 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17069 | .setup = alc861vd_dallas_setup, |
| 17070 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17071 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17072 | [ALC660VD_ASUS_V1S] = { |
| 17073 | .mixers = { alc861vd_lenovo_mixer }, |
| 17074 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17075 | alc861vd_3stack_init_verbs, |
| 17076 | alc861vd_eapd_verbs, |
| 17077 | alc861vd_lenovo_unsol_verbs }, |
| 17078 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17079 | .dac_nids = alc660vd_dac_nids, |
| 17080 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17081 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17082 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17083 | .input_mux = &alc861vd_capture_source, |
| 17084 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17085 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17086 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17087 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17088 | }; |
| 17089 | |
| 17090 | /* |
| 17091 | * BIOS auto configuration |
| 17092 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17093 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17094 | const struct auto_pin_cfg *cfg) |
| 17095 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17096 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17097 | } |
| 17098 | |
| 17099 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17100 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17101 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17102 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17103 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17104 | } |
| 17105 | |
| 17106 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17107 | { |
| 17108 | struct alc_spec *spec = codec->spec; |
| 17109 | int i; |
| 17110 | |
| 17111 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17112 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17113 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17114 | if (nid) |
| 17115 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17116 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17117 | } |
| 17118 | } |
| 17119 | |
| 17120 | |
| 17121 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17122 | { |
| 17123 | struct alc_spec *spec = codec->spec; |
| 17124 | hda_nid_t pin; |
| 17125 | |
| 17126 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17127 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17128 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17129 | pin = spec->autocfg.speaker_pins[0]; |
| 17130 | if (pin) |
| 17131 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17132 | } |
| 17133 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17134 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17135 | |
| 17136 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17137 | { |
| 17138 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17139 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17140 | int i; |
| 17141 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17142 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17143 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17144 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17145 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17146 | if (nid != ALC861VD_PIN_CD_NID && |
| 17147 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17148 | snd_hda_codec_write(codec, nid, 0, |
| 17149 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17150 | AMP_OUT_MUTE); |
| 17151 | } |
| 17152 | } |
| 17153 | } |
| 17154 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17155 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17156 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17157 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17158 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17159 | |
| 17160 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17161 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17162 | * different NIDs for mute/unmute switch and volume control */ |
| 17163 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17164 | const struct auto_pin_cfg *cfg) |
| 17165 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17166 | static const char * const chname[4] = { |
| 17167 | "Front", "Surround", "CLFE", "Side" |
| 17168 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17169 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17170 | hda_nid_t nid_v, nid_s; |
| 17171 | int i, err; |
| 17172 | |
| 17173 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17174 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17175 | continue; |
| 17176 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17177 | alc880_dac_to_idx( |
| 17178 | spec->multiout.dac_nids[i])); |
| 17179 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17180 | alc880_dac_to_idx( |
| 17181 | spec->multiout.dac_nids[i])); |
| 17182 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17183 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17184 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17185 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17186 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17187 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17188 | HDA_OUTPUT)); |
| 17189 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17190 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17191 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17192 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17193 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17194 | HDA_OUTPUT)); |
| 17195 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17196 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17197 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17198 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17199 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17200 | HDA_INPUT)); |
| 17201 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17202 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17203 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17204 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17205 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17206 | HDA_INPUT)); |
| 17207 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17208 | return err; |
| 17209 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17210 | const char *name = pfx; |
| 17211 | if (!name) |
| 17212 | name = chname[i]; |
| 17213 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17214 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17215 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17216 | HDA_OUTPUT)); |
| 17217 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17218 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17219 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17220 | name, i, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17221 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17222 | HDA_INPUT)); |
| 17223 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17224 | return err; |
| 17225 | } |
| 17226 | } |
| 17227 | return 0; |
| 17228 | } |
| 17229 | |
| 17230 | /* add playback controls for speaker and HP outputs */ |
| 17231 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17232 | * different NIDs for mute/unmute switch and volume control */ |
| 17233 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17234 | hda_nid_t pin, const char *pfx) |
| 17235 | { |
| 17236 | hda_nid_t nid_v, nid_s; |
| 17237 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17238 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17239 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17240 | return 0; |
| 17241 | |
| 17242 | if (alc880_is_fixed_pin(pin)) { |
| 17243 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17244 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17245 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17246 | spec->multiout.hp_nid = nid_v; |
| 17247 | else |
| 17248 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17249 | /* control HP volume/switch on the output mixer amp */ |
| 17250 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17251 | alc880_fixed_pin_idx(pin)); |
| 17252 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17253 | alc880_fixed_pin_idx(pin)); |
| 17254 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17255 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17256 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17257 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17258 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17259 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17260 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17261 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17262 | return err; |
| 17263 | } else if (alc880_is_multi_pin(pin)) { |
| 17264 | /* set manual connection */ |
| 17265 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17266 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17267 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17268 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17269 | return err; |
| 17270 | } |
| 17271 | return 0; |
| 17272 | } |
| 17273 | |
| 17274 | /* parse the BIOS configuration and set up the alc_spec |
| 17275 | * return 1 if successful, 0 if the proper config is not found, |
| 17276 | * or a negative error code |
| 17277 | * Based on ALC880 version - had to change it to override |
| 17278 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17279 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17280 | { |
| 17281 | struct alc_spec *spec = codec->spec; |
| 17282 | int err; |
| 17283 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17284 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17285 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17286 | alc861vd_ignore); |
| 17287 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17288 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17289 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17290 | return 0; /* can't find valid BIOS pin config */ |
| 17291 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17292 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17293 | if (err < 0) |
| 17294 | return err; |
| 17295 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17296 | if (err < 0) |
| 17297 | return err; |
| 17298 | err = alc861vd_auto_create_extra_out(spec, |
| 17299 | spec->autocfg.speaker_pins[0], |
| 17300 | "Speaker"); |
| 17301 | if (err < 0) |
| 17302 | return err; |
| 17303 | err = alc861vd_auto_create_extra_out(spec, |
| 17304 | spec->autocfg.hp_pins[0], |
| 17305 | "Headphone"); |
| 17306 | if (err < 0) |
| 17307 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17308 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17309 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17310 | return err; |
| 17311 | |
| 17312 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17313 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17314 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17315 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17316 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17317 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17318 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17319 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17320 | |
| 17321 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17322 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17323 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17324 | err = alc_auto_add_mic_boost(codec); |
| 17325 | if (err < 0) |
| 17326 | return err; |
| 17327 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17328 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17329 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17330 | return 1; |
| 17331 | } |
| 17332 | |
| 17333 | /* additional initialization for auto-configuration model */ |
| 17334 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17335 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17336 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17337 | alc861vd_auto_init_multi_out(codec); |
| 17338 | alc861vd_auto_init_hp_out(codec); |
| 17339 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17340 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17341 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17342 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17343 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17344 | } |
| 17345 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17346 | enum { |
| 17347 | ALC660VD_FIX_ASUS_GPIO1 |
| 17348 | }; |
| 17349 | |
| 17350 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17351 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17352 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17353 | .type = ALC_FIXUP_VERBS, |
| 17354 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17355 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17356 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17357 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17358 | { } |
| 17359 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17360 | }, |
| 17361 | }; |
| 17362 | |
| 17363 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17364 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17365 | {} |
| 17366 | }; |
| 17367 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17368 | static int patch_alc861vd(struct hda_codec *codec) |
| 17369 | { |
| 17370 | struct alc_spec *spec; |
| 17371 | int err, board_config; |
| 17372 | |
| 17373 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17374 | if (spec == NULL) |
| 17375 | return -ENOMEM; |
| 17376 | |
| 17377 | codec->spec = spec; |
| 17378 | |
| 17379 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17380 | alc861vd_models, |
| 17381 | alc861vd_cfg_tbl); |
| 17382 | |
| 17383 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17384 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17385 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17386 | board_config = ALC861VD_AUTO; |
| 17387 | } |
| 17388 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17389 | if (board_config == ALC861VD_AUTO) { |
| 17390 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17391 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17392 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17393 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17394 | if (board_config == ALC861VD_AUTO) { |
| 17395 | /* automatic parse from the BIOS config */ |
| 17396 | err = alc861vd_parse_auto_config(codec); |
| 17397 | if (err < 0) { |
| 17398 | alc_free(codec); |
| 17399 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17400 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17401 | printk(KERN_INFO |
| 17402 | "hda_codec: Cannot set up configuration " |
| 17403 | "from BIOS. Using base mode...\n"); |
| 17404 | board_config = ALC861VD_3ST; |
| 17405 | } |
| 17406 | } |
| 17407 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17408 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17409 | if (err < 0) { |
| 17410 | alc_free(codec); |
| 17411 | return err; |
| 17412 | } |
| 17413 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17414 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17415 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17416 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17417 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17418 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17419 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17420 | } |
| 17421 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17422 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17423 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17424 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17425 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17426 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17427 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17428 | if (!spec->adc_nids) { |
| 17429 | spec->adc_nids = alc861vd_adc_nids; |
| 17430 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17431 | } |
| 17432 | if (!spec->capsrc_nids) |
| 17433 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17434 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17435 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17436 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17437 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17438 | spec->vmaster_nid = 0x02; |
| 17439 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17440 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17441 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17442 | codec->patch_ops = alc_patch_ops; |
| 17443 | |
| 17444 | if (board_config == ALC861VD_AUTO) |
| 17445 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17446 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17447 | if (!spec->loopback.amplist) |
| 17448 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17449 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17450 | |
| 17451 | return 0; |
| 17452 | } |
| 17453 | |
| 17454 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17455 | * ALC662 support |
| 17456 | * |
| 17457 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17458 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17459 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17460 | * 6-channel independent captures. |
| 17461 | * |
| 17462 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17463 | * driver yet). |
| 17464 | */ |
| 17465 | #define ALC662_DIGOUT_NID 0x06 |
| 17466 | #define ALC662_DIGIN_NID 0x0a |
| 17467 | |
| 17468 | static hda_nid_t alc662_dac_nids[4] = { |
| 17469 | /* front, rear, clfe, rear_surr */ |
| 17470 | 0x02, 0x03, 0x04 |
| 17471 | }; |
| 17472 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17473 | static hda_nid_t alc272_dac_nids[2] = { |
| 17474 | 0x02, 0x03 |
| 17475 | }; |
| 17476 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17477 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17478 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17479 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17480 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17481 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17482 | static hda_nid_t alc272_adc_nids[1] = { |
| 17483 | /* ADC1-2 */ |
| 17484 | 0x08, |
| 17485 | }; |
| 17486 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17487 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17488 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17489 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17490 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17491 | /* input MUX */ |
| 17492 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17493 | static struct hda_input_mux alc662_capture_source = { |
| 17494 | .num_items = 4, |
| 17495 | .items = { |
| 17496 | { "Mic", 0x0 }, |
| 17497 | { "Front Mic", 0x1 }, |
| 17498 | { "Line", 0x2 }, |
| 17499 | { "CD", 0x4 }, |
| 17500 | }, |
| 17501 | }; |
| 17502 | |
| 17503 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17504 | .num_items = 2, |
| 17505 | .items = { |
| 17506 | { "Mic", 0x1 }, |
| 17507 | { "Line", 0x2 }, |
| 17508 | }, |
| 17509 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17510 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17511 | static struct hda_input_mux alc663_capture_source = { |
| 17512 | .num_items = 3, |
| 17513 | .items = { |
| 17514 | { "Mic", 0x0 }, |
| 17515 | { "Front Mic", 0x1 }, |
| 17516 | { "Line", 0x2 }, |
| 17517 | }, |
| 17518 | }; |
| 17519 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17520 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17521 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17522 | .num_items = 16, |
| 17523 | .items = { |
| 17524 | { "Autoselect Mic", 0x0 }, |
| 17525 | { "Internal Mic", 0x1 }, |
| 17526 | { "In-0x02", 0x2 }, |
| 17527 | { "In-0x03", 0x3 }, |
| 17528 | { "In-0x04", 0x4 }, |
| 17529 | { "In-0x05", 0x5 }, |
| 17530 | { "In-0x06", 0x6 }, |
| 17531 | { "In-0x07", 0x7 }, |
| 17532 | { "In-0x08", 0x8 }, |
| 17533 | { "In-0x09", 0x9 }, |
| 17534 | { "In-0x0a", 0x0a }, |
| 17535 | { "In-0x0b", 0x0b }, |
| 17536 | { "In-0x0c", 0x0c }, |
| 17537 | { "In-0x0d", 0x0d }, |
| 17538 | { "In-0x0e", 0x0e }, |
| 17539 | { "In-0x0f", 0x0f }, |
| 17540 | }, |
| 17541 | }; |
| 17542 | #endif |
| 17543 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17544 | /* |
| 17545 | * 2ch mode |
| 17546 | */ |
| 17547 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17548 | { 2, NULL } |
| 17549 | }; |
| 17550 | |
| 17551 | /* |
| 17552 | * 2ch mode |
| 17553 | */ |
| 17554 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17555 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17556 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17557 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17558 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17559 | { } /* end */ |
| 17560 | }; |
| 17561 | |
| 17562 | /* |
| 17563 | * 6ch mode |
| 17564 | */ |
| 17565 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17566 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17567 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17568 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17569 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17570 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17571 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17572 | { } /* end */ |
| 17573 | }; |
| 17574 | |
| 17575 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17576 | { 2, alc662_3ST_ch2_init }, |
| 17577 | { 6, alc662_3ST_ch6_init }, |
| 17578 | }; |
| 17579 | |
| 17580 | /* |
| 17581 | * 2ch mode |
| 17582 | */ |
| 17583 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17584 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17585 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17586 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17587 | { } /* end */ |
| 17588 | }; |
| 17589 | |
| 17590 | /* |
| 17591 | * 6ch mode |
| 17592 | */ |
| 17593 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17594 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17595 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17596 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17597 | { } /* end */ |
| 17598 | }; |
| 17599 | |
| 17600 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17601 | { 2, alc662_sixstack_ch6_init }, |
| 17602 | { 6, alc662_sixstack_ch8_init }, |
| 17603 | }; |
| 17604 | |
| 17605 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17606 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17607 | */ |
| 17608 | |
| 17609 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17610 | /* output mixer control */ |
| 17611 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17612 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17613 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17614 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17615 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17616 | 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] | 17617 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17618 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17619 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17620 | |
| 17621 | /*Input mixer control */ |
| 17622 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17623 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17624 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17625 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17627 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17628 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17629 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17630 | { } /* end */ |
| 17631 | }; |
| 17632 | |
| 17633 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17635 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17638 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17639 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17640 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17643 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17644 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17645 | { } /* end */ |
| 17646 | }; |
| 17647 | |
| 17648 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17650 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17651 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17652 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17653 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17654 | 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] | 17655 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17656 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17658 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17659 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17660 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17661 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17664 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17665 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17666 | { } /* end */ |
| 17667 | }; |
| 17668 | |
| 17669 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17670 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17671 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17672 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17673 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17674 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17676 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17678 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17679 | { } /* end */ |
| 17680 | }; |
| 17681 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17682 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17683 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17684 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17685 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17686 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17689 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17690 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17691 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17692 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17693 | { } /* end */ |
| 17694 | }; |
| 17695 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17696 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17697 | ALC262_HIPPO_MASTER_SWITCH, |
| 17698 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17699 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17700 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17701 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17702 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17703 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17704 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17705 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17707 | { } /* end */ |
| 17708 | }; |
| 17709 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17710 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17711 | .ops = &snd_hda_bind_vol, |
| 17712 | .values = { |
| 17713 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17714 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17715 | 0 |
| 17716 | }, |
| 17717 | }; |
| 17718 | |
| 17719 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17720 | .ops = &snd_hda_bind_sw, |
| 17721 | .values = { |
| 17722 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17723 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17724 | 0 |
| 17725 | }, |
| 17726 | }; |
| 17727 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17728 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17729 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17730 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17733 | { } /* end */ |
| 17734 | }; |
| 17735 | |
| 17736 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17737 | .ops = &snd_hda_bind_sw, |
| 17738 | .values = { |
| 17739 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17740 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17741 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17742 | 0 |
| 17743 | }, |
| 17744 | }; |
| 17745 | |
| 17746 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17747 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17748 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17749 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17750 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17751 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17752 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17753 | |
| 17754 | { } /* end */ |
| 17755 | }; |
| 17756 | |
| 17757 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17758 | .ops = &snd_hda_bind_sw, |
| 17759 | .values = { |
| 17760 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17761 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17762 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17763 | 0 |
| 17764 | }, |
| 17765 | }; |
| 17766 | |
| 17767 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17768 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17769 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17772 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17773 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17774 | { } /* end */ |
| 17775 | }; |
| 17776 | |
| 17777 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17778 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17779 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17780 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17782 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17783 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17784 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17785 | { } /* end */ |
| 17786 | }; |
| 17787 | |
| 17788 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17789 | .ops = &snd_hda_bind_vol, |
| 17790 | .values = { |
| 17791 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17792 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17793 | 0 |
| 17794 | }, |
| 17795 | }; |
| 17796 | |
| 17797 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17798 | .ops = &snd_hda_bind_sw, |
| 17799 | .values = { |
| 17800 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17801 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17802 | 0 |
| 17803 | }, |
| 17804 | }; |
| 17805 | |
| 17806 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17807 | HDA_BIND_VOL("Master Playback Volume", |
| 17808 | &alc663_asus_two_bind_master_vol), |
| 17809 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17810 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17811 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17814 | { } /* end */ |
| 17815 | }; |
| 17816 | |
| 17817 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17818 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17819 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17820 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17821 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17823 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17824 | { } /* end */ |
| 17825 | }; |
| 17826 | |
| 17827 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17828 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17829 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17830 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17831 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17832 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17833 | |
| 17834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17836 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17837 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17838 | { } /* end */ |
| 17839 | }; |
| 17840 | |
| 17841 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17842 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17843 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17845 | |
| 17846 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17847 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17848 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17849 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17851 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17852 | { } /* end */ |
| 17853 | }; |
| 17854 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17855 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17856 | .ops = &snd_hda_bind_sw, |
| 17857 | .values = { |
| 17858 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17859 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17860 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17861 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17862 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17863 | 0 |
| 17864 | }, |
| 17865 | }; |
| 17866 | |
| 17867 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17868 | .ops = &snd_hda_bind_sw, |
| 17869 | .values = { |
| 17870 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17871 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17872 | 0 |
| 17873 | }, |
| 17874 | }; |
| 17875 | |
| 17876 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17877 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17878 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17879 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17880 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17881 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17882 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17883 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17886 | { } /* end */ |
| 17887 | }; |
| 17888 | |
| 17889 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17890 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17891 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17892 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17893 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17894 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17897 | { } /* end */ |
| 17898 | }; |
| 17899 | |
| 17900 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17901 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17902 | { |
| 17903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17904 | .name = "Channel Mode", |
| 17905 | .info = alc_ch_mode_info, |
| 17906 | .get = alc_ch_mode_get, |
| 17907 | .put = alc_ch_mode_put, |
| 17908 | }, |
| 17909 | { } /* end */ |
| 17910 | }; |
| 17911 | |
| 17912 | static struct hda_verb alc662_init_verbs[] = { |
| 17913 | /* ADC: mute amp left and right */ |
| 17914 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17915 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17916 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17923 | |
| 17924 | /* Front Pin: output 0 (0x0c) */ |
| 17925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17927 | |
| 17928 | /* Rear Pin: output 1 (0x0d) */ |
| 17929 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17930 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17931 | |
| 17932 | /* CLFE Pin: output 2 (0x0e) */ |
| 17933 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17934 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17935 | |
| 17936 | /* Mic (rear) pin: input vref at 80% */ |
| 17937 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17938 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17939 | /* Front Mic pin: input vref at 80% */ |
| 17940 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17941 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17942 | /* Line In pin: input */ |
| 17943 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17944 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17945 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17946 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17947 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17948 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17949 | /* CD pin widget for input */ |
| 17950 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17951 | |
| 17952 | /* FIXME: use matrix-type input source selection */ |
| 17953 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17954 | /* Input mixer */ |
| 17955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17957 | |
| 17958 | /* always trun on EAPD */ |
| 17959 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17960 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17961 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17962 | { } |
| 17963 | }; |
| 17964 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17965 | static struct hda_verb alc663_init_verbs[] = { |
| 17966 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17967 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17968 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17969 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17970 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17971 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17972 | { } |
| 17973 | }; |
| 17974 | |
| 17975 | static struct hda_verb alc272_init_verbs[] = { |
| 17976 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17977 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17978 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17979 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17980 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17981 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17982 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17983 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17984 | { } |
| 17985 | }; |
| 17986 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17987 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17988 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17989 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17990 | {} |
| 17991 | }; |
| 17992 | |
| 17993 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17994 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17995 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17996 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17997 | }; |
| 17998 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17999 | /* Set Unsolicited Event*/ |
| 18000 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 18001 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18002 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18003 | {} |
| 18004 | }; |
| 18005 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18006 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18008 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18009 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18010 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18011 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18012 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18013 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18014 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18015 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18016 | {} |
| 18017 | }; |
| 18018 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18019 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 18020 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18021 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18022 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18023 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18024 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18025 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18026 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18027 | {} |
| 18028 | }; |
| 18029 | |
| 18030 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 18031 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18033 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18034 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18037 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18038 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18039 | {} |
| 18040 | }; |
| 18041 | |
| 18042 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 18043 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18044 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18045 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18048 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18049 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18050 | {} |
| 18051 | }; |
| 18052 | |
| 18053 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 18054 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18055 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18056 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18057 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18058 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18059 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18060 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18063 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18064 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18065 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18066 | {} |
| 18067 | }; |
| 18068 | |
| 18069 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18070 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18071 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18072 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18073 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18076 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18079 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18080 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18081 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18082 | {} |
| 18083 | }; |
| 18084 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18085 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18086 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18087 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18088 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18089 | |
| 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, 0x00}, /* Headphone */ |
| 18093 | |
| 18094 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 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 | |
| 18100 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18101 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18102 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18103 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18104 | |
| 18105 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18106 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18107 | {} |
| 18108 | }; |
| 18109 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18110 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18113 | {0x18, 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 | {} |
| 18116 | }; |
| 18117 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18118 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18119 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18120 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18123 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18124 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18125 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18127 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18128 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18129 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18130 | {} |
| 18131 | }; |
| 18132 | |
| 18133 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18134 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18135 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18138 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18139 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18140 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18141 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18142 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18143 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18144 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18145 | {} |
| 18146 | }; |
| 18147 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18148 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18149 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18150 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18151 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18152 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18153 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18154 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18155 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18156 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18157 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18158 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18160 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18161 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18162 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18163 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18164 | {} |
| 18165 | }; |
| 18166 | |
| 18167 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18168 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18170 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18172 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18173 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18174 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18175 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18176 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18177 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18178 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18181 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18182 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18183 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18184 | {} |
| 18185 | }; |
| 18186 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18187 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18188 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18189 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18190 | { } /* end */ |
| 18191 | }; |
| 18192 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18193 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18194 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18195 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18196 | { } /* end */ |
| 18197 | }; |
| 18198 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18199 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18200 | { |
| 18201 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18202 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18203 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18204 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18205 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18206 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18207 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18208 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18209 | } |
| 18210 | |
| 18211 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18212 | { |
| 18213 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18214 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18215 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18216 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18217 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18218 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18219 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18220 | HDA_AMP_MUTE, bits); |
| 18221 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18222 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18223 | } |
| 18224 | |
| 18225 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18226 | unsigned int res) |
| 18227 | { |
| 18228 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18229 | alc662_lenovo_101e_all_automute(codec); |
| 18230 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18231 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18232 | } |
| 18233 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18234 | /* unsolicited event for HP jack sensing */ |
| 18235 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18236 | unsigned int res) |
| 18237 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18238 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18239 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18240 | else |
| 18241 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18242 | } |
| 18243 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18244 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18245 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18246 | struct alc_spec *spec = codec->spec; |
| 18247 | |
| 18248 | alc262_hippo1_setup(codec); |
| 18249 | spec->ext_mic.pin = 0x18; |
| 18250 | spec->ext_mic.mux_idx = 0; |
| 18251 | spec->int_mic.pin = 0x19; |
| 18252 | spec->int_mic.mux_idx = 1; |
| 18253 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18254 | } |
| 18255 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18256 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18257 | { |
| 18258 | alc262_hippo_automute(codec); |
| 18259 | alc_mic_automute(codec); |
| 18260 | } |
| 18261 | |
| 18262 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18263 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18264 | struct alc_spec *spec = codec->spec; |
| 18265 | |
| 18266 | spec->autocfg.hp_pins[0] = 0x14; |
| 18267 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18268 | } |
| 18269 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18270 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18271 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18272 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18273 | { |
| 18274 | unsigned int present; |
| 18275 | unsigned char bits; |
| 18276 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18277 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18278 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18279 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18280 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18281 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18282 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18283 | } |
| 18284 | |
| 18285 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18286 | { |
| 18287 | unsigned int present; |
| 18288 | unsigned char bits; |
| 18289 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18290 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18291 | bits = present ? HDA_AMP_MUTE : 0; |
| 18292 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18293 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18294 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18295 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18296 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18297 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18298 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18299 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18300 | } |
| 18301 | |
| 18302 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18303 | { |
| 18304 | unsigned int present; |
| 18305 | unsigned char bits; |
| 18306 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18307 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18308 | bits = present ? HDA_AMP_MUTE : 0; |
| 18309 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18310 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18311 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18312 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18313 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18314 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18315 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18316 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18317 | } |
| 18318 | |
| 18319 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18320 | { |
| 18321 | unsigned int present; |
| 18322 | unsigned char bits; |
| 18323 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18324 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18325 | bits = present ? 0 : PIN_OUT; |
| 18326 | snd_hda_codec_write(codec, 0x14, 0, |
| 18327 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18328 | } |
| 18329 | |
| 18330 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18331 | { |
| 18332 | unsigned int present1, present2; |
| 18333 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18334 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18335 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18336 | |
| 18337 | if (present1 || present2) { |
| 18338 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18339 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18340 | } else { |
| 18341 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18342 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18343 | } |
| 18344 | } |
| 18345 | |
| 18346 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18347 | { |
| 18348 | unsigned int present1, present2; |
| 18349 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18350 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18351 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18352 | |
| 18353 | if (present1 || present2) { |
| 18354 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18355 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18356 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18357 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18358 | } else { |
| 18359 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18360 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18361 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18362 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18363 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18364 | } |
| 18365 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18366 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18367 | { |
| 18368 | unsigned int present1, present2; |
| 18369 | |
| 18370 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18371 | AC_VERB_GET_PIN_SENSE, 0) |
| 18372 | & AC_PINSENSE_PRESENCE; |
| 18373 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18374 | AC_VERB_GET_PIN_SENSE, 0) |
| 18375 | & AC_PINSENSE_PRESENCE; |
| 18376 | |
| 18377 | if (present1 || present2) { |
| 18378 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18379 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18380 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18381 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18382 | } else { |
| 18383 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18384 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18385 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18386 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18387 | } |
| 18388 | } |
| 18389 | |
| 18390 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18391 | { |
| 18392 | unsigned int present1, present2; |
| 18393 | |
| 18394 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18395 | AC_VERB_GET_PIN_SENSE, 0) |
| 18396 | & AC_PINSENSE_PRESENCE; |
| 18397 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18398 | AC_VERB_GET_PIN_SENSE, 0) |
| 18399 | & AC_PINSENSE_PRESENCE; |
| 18400 | |
| 18401 | if (present1 || present2) { |
| 18402 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18403 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18404 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18405 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18406 | } else { |
| 18407 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18408 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18409 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18410 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18411 | } |
| 18412 | } |
| 18413 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18414 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18415 | unsigned int res) |
| 18416 | { |
| 18417 | switch (res >> 26) { |
| 18418 | case ALC880_HP_EVENT: |
| 18419 | alc663_m51va_speaker_automute(codec); |
| 18420 | break; |
| 18421 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18422 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18423 | break; |
| 18424 | } |
| 18425 | } |
| 18426 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18427 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18428 | { |
| 18429 | struct alc_spec *spec = codec->spec; |
| 18430 | spec->ext_mic.pin = 0x18; |
| 18431 | spec->ext_mic.mux_idx = 0; |
| 18432 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18433 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18434 | spec->auto_mic = 1; |
| 18435 | } |
| 18436 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18437 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18438 | { |
| 18439 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18440 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18441 | } |
| 18442 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18443 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18444 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18445 | |
| 18446 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18447 | { |
| 18448 | struct alc_spec *spec = codec->spec; |
| 18449 | spec->ext_mic.pin = 0x18; |
| 18450 | spec->ext_mic.mux_idx = 0; |
| 18451 | spec->int_mic.pin = 0x19; |
| 18452 | spec->int_mic.mux_idx = 1; |
| 18453 | spec->auto_mic = 1; |
| 18454 | } |
| 18455 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18456 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18457 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18458 | /* ***************** Mode2 ******************************/ |
| 18459 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18460 | unsigned int res) |
| 18461 | { |
| 18462 | switch (res >> 26) { |
| 18463 | case ALC880_HP_EVENT: |
| 18464 | alc662_f5z_speaker_automute(codec); |
| 18465 | break; |
| 18466 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18467 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18468 | break; |
| 18469 | } |
| 18470 | } |
| 18471 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18472 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18473 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18474 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18475 | { |
| 18476 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18477 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18478 | } |
| 18479 | /* ***************** Mode3 ******************************/ |
| 18480 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18481 | unsigned int res) |
| 18482 | { |
| 18483 | switch (res >> 26) { |
| 18484 | case ALC880_HP_EVENT: |
| 18485 | alc663_two_hp_m1_speaker_automute(codec); |
| 18486 | break; |
| 18487 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18488 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18489 | break; |
| 18490 | } |
| 18491 | } |
| 18492 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18493 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18494 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18495 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18496 | { |
| 18497 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18498 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18499 | } |
| 18500 | /* ***************** Mode4 ******************************/ |
| 18501 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18502 | unsigned int res) |
| 18503 | { |
| 18504 | switch (res >> 26) { |
| 18505 | case ALC880_HP_EVENT: |
| 18506 | alc663_21jd_two_speaker_automute(codec); |
| 18507 | break; |
| 18508 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18509 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18510 | break; |
| 18511 | } |
| 18512 | } |
| 18513 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18514 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18515 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18516 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18517 | { |
| 18518 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18519 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18520 | } |
| 18521 | /* ***************** Mode5 ******************************/ |
| 18522 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18523 | unsigned int res) |
| 18524 | { |
| 18525 | switch (res >> 26) { |
| 18526 | case ALC880_HP_EVENT: |
| 18527 | alc663_15jd_two_speaker_automute(codec); |
| 18528 | break; |
| 18529 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18530 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18531 | break; |
| 18532 | } |
| 18533 | } |
| 18534 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18535 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18536 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18537 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18538 | { |
| 18539 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18540 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18541 | } |
| 18542 | /* ***************** Mode6 ******************************/ |
| 18543 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18544 | unsigned int res) |
| 18545 | { |
| 18546 | switch (res >> 26) { |
| 18547 | case ALC880_HP_EVENT: |
| 18548 | alc663_two_hp_m2_speaker_automute(codec); |
| 18549 | break; |
| 18550 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18551 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18552 | break; |
| 18553 | } |
| 18554 | } |
| 18555 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18556 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18557 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18558 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18559 | { |
| 18560 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18561 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18562 | } |
| 18563 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18564 | /* ***************** Mode7 ******************************/ |
| 18565 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18566 | unsigned int res) |
| 18567 | { |
| 18568 | switch (res >> 26) { |
| 18569 | case ALC880_HP_EVENT: |
| 18570 | alc663_two_hp_m7_speaker_automute(codec); |
| 18571 | break; |
| 18572 | case ALC880_MIC_EVENT: |
| 18573 | alc_mic_automute(codec); |
| 18574 | break; |
| 18575 | } |
| 18576 | } |
| 18577 | |
| 18578 | #define alc663_mode7_setup alc663_mode1_setup |
| 18579 | |
| 18580 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18581 | { |
| 18582 | alc663_two_hp_m7_speaker_automute(codec); |
| 18583 | alc_mic_automute(codec); |
| 18584 | } |
| 18585 | |
| 18586 | /* ***************** Mode8 ******************************/ |
| 18587 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18588 | unsigned int res) |
| 18589 | { |
| 18590 | switch (res >> 26) { |
| 18591 | case ALC880_HP_EVENT: |
| 18592 | alc663_two_hp_m8_speaker_automute(codec); |
| 18593 | break; |
| 18594 | case ALC880_MIC_EVENT: |
| 18595 | alc_mic_automute(codec); |
| 18596 | break; |
| 18597 | } |
| 18598 | } |
| 18599 | |
| 18600 | #define alc663_mode8_setup alc663_m51va_setup |
| 18601 | |
| 18602 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18603 | { |
| 18604 | alc663_two_hp_m8_speaker_automute(codec); |
| 18605 | alc_mic_automute(codec); |
| 18606 | } |
| 18607 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18608 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18609 | { |
| 18610 | unsigned int present; |
| 18611 | unsigned char bits; |
| 18612 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18613 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18614 | bits = present ? HDA_AMP_MUTE : 0; |
| 18615 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18616 | HDA_AMP_MUTE, bits); |
| 18617 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18618 | HDA_AMP_MUTE, bits); |
| 18619 | } |
| 18620 | |
| 18621 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18622 | { |
| 18623 | unsigned int present; |
| 18624 | unsigned char bits; |
| 18625 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18626 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18627 | bits = present ? HDA_AMP_MUTE : 0; |
| 18628 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18629 | HDA_AMP_MUTE, bits); |
| 18630 | } |
| 18631 | |
| 18632 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18633 | unsigned int res) |
| 18634 | { |
| 18635 | switch (res >> 26) { |
| 18636 | case ALC880_HP_EVENT: |
| 18637 | alc663_g71v_hp_automute(codec); |
| 18638 | break; |
| 18639 | case ALC880_FRONT_EVENT: |
| 18640 | alc663_g71v_front_automute(codec); |
| 18641 | break; |
| 18642 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18643 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18644 | break; |
| 18645 | } |
| 18646 | } |
| 18647 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18648 | #define alc663_g71v_setup alc663_m51va_setup |
| 18649 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18650 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18651 | { |
| 18652 | alc663_g71v_front_automute(codec); |
| 18653 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18654 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18655 | } |
| 18656 | |
| 18657 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18658 | unsigned int res) |
| 18659 | { |
| 18660 | switch (res >> 26) { |
| 18661 | case ALC880_HP_EVENT: |
| 18662 | alc663_m51va_speaker_automute(codec); |
| 18663 | break; |
| 18664 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18665 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18666 | break; |
| 18667 | } |
| 18668 | } |
| 18669 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18670 | #define alc663_g50v_setup alc663_m51va_setup |
| 18671 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18672 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18673 | { |
| 18674 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18675 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18676 | } |
| 18677 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18678 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18679 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18680 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18681 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18682 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18683 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18684 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18685 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18686 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18687 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18688 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18689 | { } /* end */ |
| 18690 | }; |
| 18691 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18692 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18693 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18694 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18695 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18696 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18698 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18701 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18702 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18703 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18704 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18705 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18706 | { } /* end */ |
| 18707 | }; |
| 18708 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18709 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18710 | #define alc662_loopbacks alc880_loopbacks |
| 18711 | #endif |
| 18712 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18713 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18714 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18715 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18716 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18717 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18718 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18719 | |
| 18720 | /* |
| 18721 | * configuration and preset |
| 18722 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18723 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18724 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18725 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18726 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18727 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18728 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18729 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18730 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18731 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18732 | [ALC663_ASUS_M51VA] = "m51va", |
| 18733 | [ALC663_ASUS_G71V] = "g71v", |
| 18734 | [ALC663_ASUS_H13] = "h13", |
| 18735 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18736 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18737 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18738 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18739 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18740 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18741 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18742 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18743 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18744 | [ALC272_DELL] = "dell", |
| 18745 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18746 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18747 | [ALC662_AUTO] = "auto", |
| 18748 | }; |
| 18749 | |
| 18750 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18751 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18752 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18753 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18754 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18755 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18756 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18757 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18758 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18759 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18760 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18761 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18762 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18763 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18764 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18765 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18766 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18767 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18768 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18769 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18770 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18771 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18772 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18773 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18774 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18775 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18776 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18777 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18778 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18779 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18780 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18781 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18782 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18783 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18784 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18785 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18786 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18787 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18788 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18789 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18790 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18791 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18792 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18793 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18794 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18795 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18796 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18797 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18798 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18799 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18800 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18801 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18802 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18803 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18804 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18805 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18806 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18807 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18808 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18809 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18810 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18811 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18812 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18813 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18814 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18815 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18816 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18817 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18818 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18819 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18820 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18821 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18822 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18823 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18824 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18825 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18826 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18827 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18828 | {} |
| 18829 | }; |
| 18830 | |
| 18831 | static struct alc_config_preset alc662_presets[] = { |
| 18832 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18833 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18834 | .init_verbs = { alc662_init_verbs }, |
| 18835 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18836 | .dac_nids = alc662_dac_nids, |
| 18837 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18838 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18839 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18840 | .channel_mode = alc662_3ST_2ch_modes, |
| 18841 | .input_mux = &alc662_capture_source, |
| 18842 | }, |
| 18843 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18844 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18845 | .init_verbs = { alc662_init_verbs }, |
| 18846 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18847 | .dac_nids = alc662_dac_nids, |
| 18848 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18849 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18850 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18851 | .channel_mode = alc662_3ST_6ch_modes, |
| 18852 | .need_dac_fix = 1, |
| 18853 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18854 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18855 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18856 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18857 | .init_verbs = { alc662_init_verbs }, |
| 18858 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18859 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18860 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18861 | .channel_mode = alc662_3ST_6ch_modes, |
| 18862 | .need_dac_fix = 1, |
| 18863 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18864 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18865 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18866 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18867 | .init_verbs = { alc662_init_verbs }, |
| 18868 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18869 | .dac_nids = alc662_dac_nids, |
| 18870 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18871 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18872 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18873 | .channel_mode = alc662_5stack_modes, |
| 18874 | .input_mux = &alc662_capture_source, |
| 18875 | }, |
| 18876 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18877 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18878 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18879 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18880 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18881 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18882 | .channel_mode = alc662_3ST_2ch_modes, |
| 18883 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18884 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18885 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18886 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18887 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18888 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18889 | .init_verbs = { alc662_init_verbs, |
| 18890 | alc662_eeepc_sue_init_verbs }, |
| 18891 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18892 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18893 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18894 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18895 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18896 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18897 | .init_hook = alc662_eeepc_inithook, |
| 18898 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18899 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18900 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18901 | alc662_chmode_mixer }, |
| 18902 | .init_verbs = { alc662_init_verbs, |
| 18903 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18904 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18905 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18906 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18907 | .channel_mode = alc662_3ST_6ch_modes, |
| 18908 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18909 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18910 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18911 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18912 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18913 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18914 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18915 | .init_verbs = { alc662_init_verbs, |
| 18916 | alc662_ecs_init_verbs }, |
| 18917 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18918 | .dac_nids = alc662_dac_nids, |
| 18919 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18920 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18921 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18922 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18923 | .init_hook = alc662_eeepc_inithook, |
| 18924 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18925 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18926 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18927 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18928 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18929 | .dac_nids = alc662_dac_nids, |
| 18930 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18931 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18932 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18933 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18934 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18935 | .init_hook = alc663_m51va_inithook, |
| 18936 | }, |
| 18937 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18938 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18939 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18940 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18941 | .dac_nids = alc662_dac_nids, |
| 18942 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18944 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18945 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18946 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18947 | .init_hook = alc663_g71v_inithook, |
| 18948 | }, |
| 18949 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18950 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18951 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18952 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18953 | .dac_nids = alc662_dac_nids, |
| 18954 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18955 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18956 | .unsol_event = alc663_m51va_unsol_event, |
| 18957 | .init_hook = alc663_m51va_inithook, |
| 18958 | }, |
| 18959 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18960 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18961 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18962 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18963 | .dac_nids = alc662_dac_nids, |
| 18964 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18965 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18966 | .channel_mode = alc662_3ST_6ch_modes, |
| 18967 | .input_mux = &alc663_capture_source, |
| 18968 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18969 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18970 | .init_hook = alc663_g50v_inithook, |
| 18971 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18972 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18973 | .mixers = { alc663_m51va_mixer }, |
| 18974 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18975 | .init_verbs = { alc662_init_verbs, |
| 18976 | alc663_21jd_amic_init_verbs }, |
| 18977 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18978 | .hp_nid = 0x03, |
| 18979 | .dac_nids = alc662_dac_nids, |
| 18980 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18981 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18982 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18983 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18984 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18985 | .init_hook = alc663_mode1_inithook, |
| 18986 | }, |
| 18987 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18988 | .mixers = { alc662_1bjd_mixer }, |
| 18989 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18990 | .init_verbs = { alc662_init_verbs, |
| 18991 | alc662_1bjd_amic_init_verbs }, |
| 18992 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18993 | .dac_nids = alc662_dac_nids, |
| 18994 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18995 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18996 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18997 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18998 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18999 | .init_hook = alc662_mode2_inithook, |
| 19000 | }, |
| 19001 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19002 | .mixers = { alc663_two_hp_m1_mixer }, |
| 19003 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19004 | .init_verbs = { alc662_init_verbs, |
| 19005 | alc663_two_hp_amic_m1_init_verbs }, |
| 19006 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19007 | .hp_nid = 0x03, |
| 19008 | .dac_nids = alc662_dac_nids, |
| 19009 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19010 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19011 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19012 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19013 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19014 | .init_hook = alc663_mode3_inithook, |
| 19015 | }, |
| 19016 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19017 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 19018 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19019 | .init_verbs = { alc662_init_verbs, |
| 19020 | alc663_21jd_amic_init_verbs}, |
| 19021 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19022 | .hp_nid = 0x03, |
| 19023 | .dac_nids = alc662_dac_nids, |
| 19024 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19025 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19026 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19027 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19028 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19029 | .init_hook = alc663_mode4_inithook, |
| 19030 | }, |
| 19031 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19032 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 19033 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19034 | .init_verbs = { alc662_init_verbs, |
| 19035 | alc663_15jd_amic_init_verbs }, |
| 19036 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19037 | .hp_nid = 0x03, |
| 19038 | .dac_nids = alc662_dac_nids, |
| 19039 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19040 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19041 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19042 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19043 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19044 | .init_hook = alc663_mode5_inithook, |
| 19045 | }, |
| 19046 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19047 | .mixers = { alc663_two_hp_m2_mixer }, |
| 19048 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19049 | .init_verbs = { alc662_init_verbs, |
| 19050 | alc663_two_hp_amic_m2_init_verbs }, |
| 19051 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19052 | .hp_nid = 0x03, |
| 19053 | .dac_nids = alc662_dac_nids, |
| 19054 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19055 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19056 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19057 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19058 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 19059 | .init_hook = alc663_mode6_inithook, |
| 19060 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19061 | [ALC663_ASUS_MODE7] = { |
| 19062 | .mixers = { alc663_mode7_mixer }, |
| 19063 | .cap_mixer = alc662_auto_capture_mixer, |
| 19064 | .init_verbs = { alc662_init_verbs, |
| 19065 | alc663_mode7_init_verbs }, |
| 19066 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19067 | .hp_nid = 0x03, |
| 19068 | .dac_nids = alc662_dac_nids, |
| 19069 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19070 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19071 | .channel_mode = alc662_3ST_2ch_modes, |
| 19072 | .unsol_event = alc663_mode7_unsol_event, |
| 19073 | .setup = alc663_mode7_setup, |
| 19074 | .init_hook = alc663_mode7_inithook, |
| 19075 | }, |
| 19076 | [ALC663_ASUS_MODE8] = { |
| 19077 | .mixers = { alc663_mode8_mixer }, |
| 19078 | .cap_mixer = alc662_auto_capture_mixer, |
| 19079 | .init_verbs = { alc662_init_verbs, |
| 19080 | alc663_mode8_init_verbs }, |
| 19081 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19082 | .hp_nid = 0x03, |
| 19083 | .dac_nids = alc662_dac_nids, |
| 19084 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19085 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19086 | .channel_mode = alc662_3ST_2ch_modes, |
| 19087 | .unsol_event = alc663_mode8_unsol_event, |
| 19088 | .setup = alc663_mode8_setup, |
| 19089 | .init_hook = alc663_mode8_inithook, |
| 19090 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19091 | [ALC272_DELL] = { |
| 19092 | .mixers = { alc663_m51va_mixer }, |
| 19093 | .cap_mixer = alc272_auto_capture_mixer, |
| 19094 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 19095 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19096 | .dac_nids = alc662_dac_nids, |
| 19097 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19098 | .adc_nids = alc272_adc_nids, |
| 19099 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 19100 | .capsrc_nids = alc272_capsrc_nids, |
| 19101 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19102 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19103 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19104 | .init_hook = alc663_m51va_inithook, |
| 19105 | }, |
| 19106 | [ALC272_DELL_ZM1] = { |
| 19107 | .mixers = { alc663_m51va_mixer }, |
| 19108 | .cap_mixer = alc662_auto_capture_mixer, |
| 19109 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 19110 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19111 | .dac_nids = alc662_dac_nids, |
| 19112 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19113 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19114 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19115 | .capsrc_nids = alc662_capsrc_nids, |
| 19116 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19117 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19118 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19119 | .init_hook = alc663_m51va_inithook, |
| 19120 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19121 | [ALC272_SAMSUNG_NC10] = { |
| 19122 | .mixers = { alc272_nc10_mixer }, |
| 19123 | .init_verbs = { alc662_init_verbs, |
| 19124 | alc663_21jd_amic_init_verbs }, |
| 19125 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19126 | .dac_nids = alc272_dac_nids, |
| 19127 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19128 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19129 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19130 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19131 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19132 | .init_hook = alc663_mode4_inithook, |
| 19133 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19134 | }; |
| 19135 | |
| 19136 | |
| 19137 | /* |
| 19138 | * BIOS auto configuration |
| 19139 | */ |
| 19140 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19141 | /* convert from MIX nid to DAC */ |
| 19142 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19143 | { |
| 19144 | if (nid == 0x0f) |
| 19145 | return 0x02; |
| 19146 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19147 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19148 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19149 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19150 | else |
| 19151 | return 0; |
| 19152 | } |
| 19153 | |
| 19154 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19155 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19156 | hda_nid_t dac) |
| 19157 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19158 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19159 | int i, num; |
| 19160 | |
| 19161 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19162 | for (i = 0; i < num; i++) { |
| 19163 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19164 | return mix[i]; |
| 19165 | } |
| 19166 | return 0; |
| 19167 | } |
| 19168 | |
| 19169 | /* look for an empty DAC slot */ |
| 19170 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19171 | { |
| 19172 | struct alc_spec *spec = codec->spec; |
| 19173 | hda_nid_t srcs[5]; |
| 19174 | int i, j, num; |
| 19175 | |
| 19176 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19177 | if (num < 0) |
| 19178 | return 0; |
| 19179 | for (i = 0; i < num; i++) { |
| 19180 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19181 | if (!nid) |
| 19182 | continue; |
| 19183 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19184 | if (spec->multiout.dac_nids[j] == nid) |
| 19185 | break; |
| 19186 | if (j >= spec->multiout.num_dacs) |
| 19187 | return nid; |
| 19188 | } |
| 19189 | return 0; |
| 19190 | } |
| 19191 | |
| 19192 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19193 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19194 | const struct auto_pin_cfg *cfg) |
| 19195 | { |
| 19196 | struct alc_spec *spec = codec->spec; |
| 19197 | int i; |
| 19198 | hda_nid_t dac; |
| 19199 | |
| 19200 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19201 | for (i = 0; i < cfg->line_outs; i++) { |
| 19202 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19203 | if (!dac) |
| 19204 | continue; |
| 19205 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19206 | } |
| 19207 | return 0; |
| 19208 | } |
| 19209 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19210 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 19211 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19212 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19213 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19214 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19215 | } |
| 19216 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19217 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19218 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19219 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19220 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19221 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19222 | } |
| 19223 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19224 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19225 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19226 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19227 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19228 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19229 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19230 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19231 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19232 | |
| 19233 | /* add playback controls from the parsed DAC table */ |
| 19234 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19235 | const struct auto_pin_cfg *cfg) |
| 19236 | { |
| 19237 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19238 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19239 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19240 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19241 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19242 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19243 | int i, err; |
| 19244 | |
| 19245 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19246 | nid = spec->multiout.dac_nids[i]; |
| 19247 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19248 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19249 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19250 | if (!mix) |
| 19251 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19252 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19253 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19254 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19255 | if (err < 0) |
| 19256 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19257 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19258 | if (err < 0) |
| 19259 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19260 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19261 | if (err < 0) |
| 19262 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19263 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19264 | if (err < 0) |
| 19265 | return err; |
| 19266 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19267 | const char *name = pfx; |
| 19268 | if (!name) |
| 19269 | name = chname[i]; |
| 19270 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19271 | if (err < 0) |
| 19272 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19273 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19274 | if (err < 0) |
| 19275 | return err; |
| 19276 | } |
| 19277 | } |
| 19278 | return 0; |
| 19279 | } |
| 19280 | |
| 19281 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19282 | /* return DAC nid if any new DAC is assigned */ |
| 19283 | 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] | 19284 | const char *pfx) |
| 19285 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19286 | struct alc_spec *spec = codec->spec; |
| 19287 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19288 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19289 | |
| 19290 | if (!pin) |
| 19291 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19292 | nid = alc662_look_for_dac(codec, pin); |
| 19293 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19294 | /* the corresponding DAC is already occupied */ |
| 19295 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19296 | return 0; /* no way */ |
| 19297 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19298 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19299 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19300 | } |
| 19301 | |
| 19302 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19303 | if (!mix) |
| 19304 | return 0; |
| 19305 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19306 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19307 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19308 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19309 | if (err < 0) |
| 19310 | return err; |
| 19311 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19312 | } |
| 19313 | |
| 19314 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19315 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19316 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19317 | |
| 19318 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19319 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19320 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19321 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19322 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19323 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19324 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19325 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19326 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19327 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19328 | if (num <= 1) |
| 19329 | return; |
| 19330 | for (i = 0; i < num; i++) { |
| 19331 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19332 | continue; |
| 19333 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19334 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19335 | } |
| 19336 | } |
| 19337 | |
| 19338 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19339 | { |
| 19340 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19341 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19342 | int i; |
| 19343 | |
| 19344 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19345 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19346 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19347 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19348 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19349 | } |
| 19350 | } |
| 19351 | |
| 19352 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19353 | { |
| 19354 | struct alc_spec *spec = codec->spec; |
| 19355 | hda_nid_t pin; |
| 19356 | |
| 19357 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19358 | if (pin) |
| 19359 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19360 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19361 | pin = spec->autocfg.speaker_pins[0]; |
| 19362 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19363 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19364 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19365 | } |
| 19366 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19367 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19368 | |
| 19369 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19370 | { |
| 19371 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19372 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19373 | int i; |
| 19374 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19375 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19376 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19377 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19378 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19379 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19380 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19381 | snd_hda_codec_write(codec, nid, 0, |
| 19382 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19383 | AMP_OUT_MUTE); |
| 19384 | } |
| 19385 | } |
| 19386 | } |
| 19387 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19388 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19389 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19390 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19391 | { |
| 19392 | struct alc_spec *spec = codec->spec; |
| 19393 | int err; |
| 19394 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19395 | |
| 19396 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19397 | alc662_ignore); |
| 19398 | if (err < 0) |
| 19399 | return err; |
| 19400 | if (!spec->autocfg.line_outs) |
| 19401 | return 0; /* can't find valid BIOS pin config */ |
| 19402 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19403 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19404 | if (err < 0) |
| 19405 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19406 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19407 | if (err < 0) |
| 19408 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19409 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19410 | spec->autocfg.speaker_pins[0], |
| 19411 | "Speaker"); |
| 19412 | if (err < 0) |
| 19413 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19414 | if (err) |
| 19415 | spec->multiout.extra_out_nid[0] = err; |
| 19416 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19417 | "Headphone"); |
| 19418 | if (err < 0) |
| 19419 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19420 | if (err) |
| 19421 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19422 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19423 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19424 | return err; |
| 19425 | |
| 19426 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19427 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19428 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19429 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19430 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19431 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19432 | |
| 19433 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19434 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19435 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19436 | add_verb(spec, alc662_init_verbs); |
| 19437 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19438 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19439 | add_verb(spec, alc663_init_verbs); |
| 19440 | |
| 19441 | if (codec->vendor_id == 0x10ec0272) |
| 19442 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19443 | |
| 19444 | err = alc_auto_add_mic_boost(codec); |
| 19445 | if (err < 0) |
| 19446 | return err; |
| 19447 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19448 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19449 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19450 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19451 | else |
| 19452 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19453 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19454 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19455 | } |
| 19456 | |
| 19457 | /* additional initialization for auto-configuration model */ |
| 19458 | static void alc662_auto_init(struct hda_codec *codec) |
| 19459 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19460 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19461 | alc662_auto_init_multi_out(codec); |
| 19462 | alc662_auto_init_hp_out(codec); |
| 19463 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19464 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19465 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19466 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19467 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19468 | } |
| 19469 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19470 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19471 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19472 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19473 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19474 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19475 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19476 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19477 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19478 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19479 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19480 | printk(KERN_WARNING |
| 19481 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19482 | } |
| 19483 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19484 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19485 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19486 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19487 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19488 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19489 | }; |
| 19490 | |
| 19491 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19492 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19493 | .type = ALC_FIXUP_PINS, |
| 19494 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19495 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19496 | { } |
| 19497 | } |
| 19498 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19499 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19500 | .type = ALC_FIXUP_PINS, |
| 19501 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19502 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19503 | { } |
| 19504 | } |
| 19505 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19506 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19507 | .type = ALC_FIXUP_FUNC, |
| 19508 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19509 | }, |
| 19510 | [ALC662_FIXUP_CZC_P10T] = { |
| 19511 | .type = ALC_FIXUP_VERBS, |
| 19512 | .v.verbs = (const struct hda_verb[]) { |
| 19513 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19514 | {} |
| 19515 | } |
| 19516 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19517 | }; |
| 19518 | |
| 19519 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19520 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19521 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19522 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19523 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19524 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19525 | {} |
| 19526 | }; |
| 19527 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19528 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19529 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19530 | {} |
| 19531 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19532 | |
| 19533 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19534 | static int patch_alc662(struct hda_codec *codec) |
| 19535 | { |
| 19536 | struct alc_spec *spec; |
| 19537 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19538 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19539 | |
| 19540 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19541 | if (!spec) |
| 19542 | return -ENOMEM; |
| 19543 | |
| 19544 | codec->spec = spec; |
| 19545 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19546 | alc_auto_parse_customize_define(codec); |
| 19547 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19548 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19549 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19550 | coef = alc_read_coef_idx(codec, 0); |
| 19551 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19552 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19553 | else if (coef & (1 << 14) && |
| 19554 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19555 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19556 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19557 | else if (coef == 0x4011) |
| 19558 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19559 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19560 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19561 | alc662_models, |
| 19562 | alc662_cfg_tbl); |
| 19563 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19564 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19565 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19566 | board_config = ALC662_AUTO; |
| 19567 | } |
| 19568 | |
| 19569 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19570 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19571 | alc662_fixup_tbl, alc662_fixups); |
| 19572 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19573 | /* automatic parse from the BIOS config */ |
| 19574 | err = alc662_parse_auto_config(codec); |
| 19575 | if (err < 0) { |
| 19576 | alc_free(codec); |
| 19577 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19578 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19579 | printk(KERN_INFO |
| 19580 | "hda_codec: Cannot set up configuration " |
| 19581 | "from BIOS. Using base mode...\n"); |
| 19582 | board_config = ALC662_3ST_2ch_DIG; |
| 19583 | } |
| 19584 | } |
| 19585 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19586 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19587 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19588 | if (err < 0) { |
| 19589 | alc_free(codec); |
| 19590 | return err; |
| 19591 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19592 | } |
| 19593 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19594 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19595 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19596 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19597 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19598 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19599 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19600 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19601 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19602 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19603 | if (!spec->adc_nids) { |
| 19604 | spec->adc_nids = alc662_adc_nids; |
| 19605 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19606 | } |
| 19607 | if (!spec->capsrc_nids) |
| 19608 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19609 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19610 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19611 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19612 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19613 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19614 | switch (codec->vendor_id) { |
| 19615 | case 0x10ec0662: |
| 19616 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19617 | break; |
| 19618 | case 0x10ec0272: |
| 19619 | case 0x10ec0663: |
| 19620 | case 0x10ec0665: |
| 19621 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19622 | break; |
| 19623 | case 0x10ec0273: |
| 19624 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19625 | break; |
| 19626 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19627 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19628 | spec->vmaster_nid = 0x02; |
| 19629 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19630 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19631 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19632 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19633 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19634 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19635 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19636 | alc_init_jacks(codec); |
| 19637 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19638 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19639 | if (!spec->loopback.amplist) |
| 19640 | spec->loopback.amplist = alc662_loopbacks; |
| 19641 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19642 | |
| 19643 | return 0; |
| 19644 | } |
| 19645 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19646 | static int patch_alc888(struct hda_codec *codec) |
| 19647 | { |
| 19648 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19649 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19650 | if (codec->vendor_id == 0x10ec0887) |
| 19651 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19652 | else |
| 19653 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19654 | if (!codec->chip_name) { |
| 19655 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19656 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19657 | } |
| 19658 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19659 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19660 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19661 | } |
| 19662 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19663 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19664 | * ALC680 support |
| 19665 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19666 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19667 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19668 | #define alc680_modes alc260_modes |
| 19669 | |
| 19670 | static hda_nid_t alc680_dac_nids[3] = { |
| 19671 | /* Lout1, Lout2, hp */ |
| 19672 | 0x02, 0x03, 0x04 |
| 19673 | }; |
| 19674 | |
| 19675 | static hda_nid_t alc680_adc_nids[3] = { |
| 19676 | /* ADC0-2 */ |
| 19677 | /* DMIC, MIC, Line-in*/ |
| 19678 | 0x07, 0x08, 0x09 |
| 19679 | }; |
| 19680 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19681 | /* |
| 19682 | * Analog capture ADC cgange |
| 19683 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19684 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19685 | { |
| 19686 | struct alc_spec *spec = codec->spec; |
| 19687 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19688 | int pin_found = 0; |
| 19689 | int type_found = AUTO_PIN_LAST; |
| 19690 | hda_nid_t nid; |
| 19691 | int i; |
| 19692 | |
| 19693 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19694 | nid = cfg->inputs[i].pin; |
| 19695 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19696 | AC_PINCAP_PRES_DETECT)) |
| 19697 | continue; |
| 19698 | if (snd_hda_jack_detect(codec, nid)) { |
| 19699 | if (cfg->inputs[i].type < type_found) { |
| 19700 | type_found = cfg->inputs[i].type; |
| 19701 | pin_found = nid; |
| 19702 | } |
| 19703 | } |
| 19704 | } |
| 19705 | |
| 19706 | nid = 0x07; |
| 19707 | if (pin_found) |
| 19708 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19709 | |
| 19710 | if (nid != spec->cur_adc) |
| 19711 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19712 | spec->cur_adc = nid; |
| 19713 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19714 | spec->cur_adc_format); |
| 19715 | } |
| 19716 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19717 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19718 | struct hda_codec *codec, |
| 19719 | unsigned int stream_tag, |
| 19720 | unsigned int format, |
| 19721 | struct snd_pcm_substream *substream) |
| 19722 | { |
| 19723 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19724 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19725 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19726 | spec->cur_adc_stream_tag = stream_tag; |
| 19727 | spec->cur_adc_format = format; |
| 19728 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19729 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19730 | return 0; |
| 19731 | } |
| 19732 | |
| 19733 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19734 | struct hda_codec *codec, |
| 19735 | struct snd_pcm_substream *substream) |
| 19736 | { |
| 19737 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19738 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19739 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19740 | return 0; |
| 19741 | } |
| 19742 | |
| 19743 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19744 | .substreams = 1, /* can be overridden */ |
| 19745 | .channels_min = 2, |
| 19746 | .channels_max = 2, |
| 19747 | /* NID is set in alc_build_pcms */ |
| 19748 | .ops = { |
| 19749 | .prepare = alc680_capture_pcm_prepare, |
| 19750 | .cleanup = alc680_capture_pcm_cleanup |
| 19751 | }, |
| 19752 | }; |
| 19753 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19754 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19755 | /* output mixer control */ |
| 19756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19757 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19758 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19760 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19761 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19762 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19763 | { } |
| 19764 | }; |
| 19765 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19766 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19767 | .ops = &snd_hda_bind_vol, |
| 19768 | .values = { |
| 19769 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19770 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19771 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19772 | 0 |
| 19773 | }, |
| 19774 | }; |
| 19775 | |
| 19776 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19777 | .ops = &snd_hda_bind_sw, |
| 19778 | .values = { |
| 19779 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19780 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19781 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19782 | 0 |
| 19783 | }, |
| 19784 | }; |
| 19785 | |
| 19786 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19787 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19788 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19789 | { } /* end */ |
| 19790 | }; |
| 19791 | |
| 19792 | /* |
| 19793 | * generic initialization of ADC, input mixers and output mixers |
| 19794 | */ |
| 19795 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19796 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19797 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19798 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19799 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19800 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19801 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19802 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19803 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19804 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19805 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19806 | |
| 19807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19809 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19810 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19811 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19812 | |
| 19813 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19814 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19815 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19816 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19817 | { } |
| 19818 | }; |
| 19819 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19820 | /* toggle speaker-output according to the hp-jack state */ |
| 19821 | static void alc680_base_setup(struct hda_codec *codec) |
| 19822 | { |
| 19823 | struct alc_spec *spec = codec->spec; |
| 19824 | |
| 19825 | spec->autocfg.hp_pins[0] = 0x16; |
| 19826 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19827 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19828 | spec->autocfg.num_inputs = 2; |
| 19829 | spec->autocfg.inputs[0].pin = 0x18; |
| 19830 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19831 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19832 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19833 | } |
| 19834 | |
| 19835 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19836 | unsigned int res) |
| 19837 | { |
| 19838 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19839 | alc_automute_amp(codec); |
| 19840 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19841 | alc680_rec_autoswitch(codec); |
| 19842 | } |
| 19843 | |
| 19844 | static void alc680_inithook(struct hda_codec *codec) |
| 19845 | { |
| 19846 | alc_automute_amp(codec); |
| 19847 | alc680_rec_autoswitch(codec); |
| 19848 | } |
| 19849 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19850 | /* create input playback/capture controls for the given pin */ |
| 19851 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19852 | const char *ctlname, int idx) |
| 19853 | { |
| 19854 | hda_nid_t dac; |
| 19855 | int err; |
| 19856 | |
| 19857 | switch (nid) { |
| 19858 | case 0x14: |
| 19859 | dac = 0x02; |
| 19860 | break; |
| 19861 | case 0x15: |
| 19862 | dac = 0x03; |
| 19863 | break; |
| 19864 | case 0x16: |
| 19865 | dac = 0x04; |
| 19866 | break; |
| 19867 | default: |
| 19868 | return 0; |
| 19869 | } |
| 19870 | if (spec->multiout.dac_nids[0] != dac && |
| 19871 | spec->multiout.dac_nids[1] != dac) { |
| 19872 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19873 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19874 | HDA_OUTPUT)); |
| 19875 | if (err < 0) |
| 19876 | return err; |
| 19877 | |
| 19878 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19879 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19880 | |
| 19881 | if (err < 0) |
| 19882 | return err; |
| 19883 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19884 | } |
| 19885 | |
| 19886 | return 0; |
| 19887 | } |
| 19888 | |
| 19889 | /* add playback controls from the parsed DAC table */ |
| 19890 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19891 | const struct auto_pin_cfg *cfg) |
| 19892 | { |
| 19893 | hda_nid_t nid; |
| 19894 | int err; |
| 19895 | |
| 19896 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19897 | |
| 19898 | nid = cfg->line_out_pins[0]; |
| 19899 | if (nid) { |
| 19900 | const char *name; |
| 19901 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19902 | name = "Speaker"; |
| 19903 | else |
| 19904 | name = "Front"; |
| 19905 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19906 | if (err < 0) |
| 19907 | return err; |
| 19908 | } |
| 19909 | |
| 19910 | nid = cfg->speaker_pins[0]; |
| 19911 | if (nid) { |
| 19912 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19913 | if (err < 0) |
| 19914 | return err; |
| 19915 | } |
| 19916 | nid = cfg->hp_pins[0]; |
| 19917 | if (nid) { |
| 19918 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19919 | if (err < 0) |
| 19920 | return err; |
| 19921 | } |
| 19922 | |
| 19923 | return 0; |
| 19924 | } |
| 19925 | |
| 19926 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19927 | hda_nid_t nid, int pin_type) |
| 19928 | { |
| 19929 | alc_set_pin_output(codec, nid, pin_type); |
| 19930 | } |
| 19931 | |
| 19932 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19933 | { |
| 19934 | struct alc_spec *spec = codec->spec; |
| 19935 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19936 | if (nid) { |
| 19937 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19938 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19939 | } |
| 19940 | } |
| 19941 | |
| 19942 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19943 | { |
| 19944 | struct alc_spec *spec = codec->spec; |
| 19945 | hda_nid_t pin; |
| 19946 | |
| 19947 | pin = spec->autocfg.hp_pins[0]; |
| 19948 | if (pin) |
| 19949 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19950 | pin = spec->autocfg.speaker_pins[0]; |
| 19951 | if (pin) |
| 19952 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19953 | } |
| 19954 | |
| 19955 | /* pcm configuration: identical with ALC880 */ |
| 19956 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19957 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19958 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19959 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19960 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19961 | |
| 19962 | /* |
| 19963 | * BIOS auto configuration |
| 19964 | */ |
| 19965 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19966 | { |
| 19967 | struct alc_spec *spec = codec->spec; |
| 19968 | int err; |
| 19969 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19970 | |
| 19971 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19972 | alc680_ignore); |
| 19973 | if (err < 0) |
| 19974 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19975 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19976 | if (!spec->autocfg.line_outs) { |
| 19977 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19978 | spec->multiout.max_channels = 2; |
| 19979 | spec->no_analog = 1; |
| 19980 | goto dig_only; |
| 19981 | } |
| 19982 | return 0; /* can't find valid BIOS pin config */ |
| 19983 | } |
| 19984 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19985 | if (err < 0) |
| 19986 | return err; |
| 19987 | |
| 19988 | spec->multiout.max_channels = 2; |
| 19989 | |
| 19990 | dig_only: |
| 19991 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19992 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19993 | if (spec->kctls.list) |
| 19994 | add_mixer(spec, spec->kctls.list); |
| 19995 | |
| 19996 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19997 | |
| 19998 | err = alc_auto_add_mic_boost(codec); |
| 19999 | if (err < 0) |
| 20000 | return err; |
| 20001 | |
| 20002 | return 1; |
| 20003 | } |
| 20004 | |
| 20005 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 20006 | |
| 20007 | /* init callback for auto-configuration model -- overriding the default init */ |
| 20008 | static void alc680_auto_init(struct hda_codec *codec) |
| 20009 | { |
| 20010 | struct alc_spec *spec = codec->spec; |
| 20011 | alc680_auto_init_multi_out(codec); |
| 20012 | alc680_auto_init_hp_out(codec); |
| 20013 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 20014 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20015 | if (spec->unsol_event) |
| 20016 | alc_inithook(codec); |
| 20017 | } |
| 20018 | |
| 20019 | /* |
| 20020 | * configuration and preset |
| 20021 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 20022 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 20023 | [ALC680_BASE] = "base", |
| 20024 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20025 | }; |
| 20026 | |
| 20027 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 20028 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 20029 | {} |
| 20030 | }; |
| 20031 | |
| 20032 | static struct alc_config_preset alc680_presets[] = { |
| 20033 | [ALC680_BASE] = { |
| 20034 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20035 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20036 | .init_verbs = { alc680_init_verbs }, |
| 20037 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 20038 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20039 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 20040 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 20041 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20042 | .unsol_event = alc680_unsol_event, |
| 20043 | .setup = alc680_base_setup, |
| 20044 | .init_hook = alc680_inithook, |
| 20045 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20046 | }, |
| 20047 | }; |
| 20048 | |
| 20049 | static int patch_alc680(struct hda_codec *codec) |
| 20050 | { |
| 20051 | struct alc_spec *spec; |
| 20052 | int board_config; |
| 20053 | int err; |
| 20054 | |
| 20055 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 20056 | if (spec == NULL) |
| 20057 | return -ENOMEM; |
| 20058 | |
| 20059 | codec->spec = spec; |
| 20060 | |
| 20061 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 20062 | alc680_models, |
| 20063 | alc680_cfg_tbl); |
| 20064 | |
| 20065 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 20066 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 20067 | codec->chip_name); |
| 20068 | board_config = ALC680_AUTO; |
| 20069 | } |
| 20070 | |
| 20071 | if (board_config == ALC680_AUTO) { |
| 20072 | /* automatic parse from the BIOS config */ |
| 20073 | err = alc680_parse_auto_config(codec); |
| 20074 | if (err < 0) { |
| 20075 | alc_free(codec); |
| 20076 | return err; |
| 20077 | } else if (!err) { |
| 20078 | printk(KERN_INFO |
| 20079 | "hda_codec: Cannot set up configuration " |
| 20080 | "from BIOS. Using base mode...\n"); |
| 20081 | board_config = ALC680_BASE; |
| 20082 | } |
| 20083 | } |
| 20084 | |
| 20085 | if (board_config != ALC680_AUTO) |
| 20086 | setup_preset(codec, &alc680_presets[board_config]); |
| 20087 | |
| 20088 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20089 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20090 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20091 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20092 | |
| 20093 | if (!spec->adc_nids) { |
| 20094 | spec->adc_nids = alc680_adc_nids; |
| 20095 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 20096 | } |
| 20097 | |
| 20098 | if (!spec->cap_mixer) |
| 20099 | set_capture_mixer(codec); |
| 20100 | |
| 20101 | spec->vmaster_nid = 0x02; |
| 20102 | |
| 20103 | codec->patch_ops = alc_patch_ops; |
| 20104 | if (board_config == ALC680_AUTO) |
| 20105 | spec->init_hook = alc680_auto_init; |
| 20106 | |
| 20107 | return 0; |
| 20108 | } |
| 20109 | |
| 20110 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20111 | * patch entries |
| 20112 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20113 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20114 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20115 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20116 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20117 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20118 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20119 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20120 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20121 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20122 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20123 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20124 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20125 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20126 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20127 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20128 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20129 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20130 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20131 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20132 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20133 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20134 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20135 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20136 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20137 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20138 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20139 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20140 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20141 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20142 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20143 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20144 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20145 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20146 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20147 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20148 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20149 | {} /* terminator */ |
| 20150 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20151 | |
| 20152 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20153 | |
| 20154 | MODULE_LICENSE("GPL"); |
| 20155 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20156 | |
| 20157 | static struct hda_codec_preset_list realtek_list = { |
| 20158 | .preset = snd_hda_preset_realtek, |
| 20159 | .owner = THIS_MODULE, |
| 20160 | }; |
| 20161 | |
| 20162 | static int __init patch_realtek_init(void) |
| 20163 | { |
| 20164 | return snd_hda_add_codec_preset(&realtek_list); |
| 20165 | } |
| 20166 | |
| 20167 | static void __exit patch_realtek_exit(void) |
| 20168 | { |
| 20169 | snd_hda_delete_codec_preset(&realtek_list); |
| 20170 | } |
| 20171 | |
| 20172 | module_init(patch_realtek_init) |
| 20173 | module_exit(patch_realtek_exit) |