Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 297 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 298 | }; |
| 299 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 300 | struct alc_fixup; |
| 301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | struct alc_spec { |
| 303 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 304 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 306 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 307 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 309 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 310 | * don't forget NULL |
| 311 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 312 | */ |
| 313 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 315 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | struct hda_pcm_stream *stream_analog_playback; |
| 317 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 318 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 319 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 321 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | struct hda_pcm_stream *stream_digital_playback; |
| 323 | struct hda_pcm_stream *stream_digital_capture; |
| 324 | |
| 325 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 326 | struct hda_multi_out multiout; /* playback set-up |
| 327 | * max_channels, dacs must be set |
| 328 | * dig_out_nid and hp_nid are optional |
| 329 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 330 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 331 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 332 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | |
| 334 | /* capture */ |
| 335 | unsigned int num_adc_nids; |
| 336 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 337 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 338 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 340 | /* capture setup for dynamic dual-adc switch */ |
| 341 | unsigned int cur_adc_idx; |
| 342 | hda_nid_t cur_adc; |
| 343 | unsigned int cur_adc_stream_tag; |
| 344 | unsigned int cur_adc_format; |
| 345 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 347 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | const struct hda_input_mux *input_mux; |
| 349 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 350 | struct alc_mic_route ext_mic; |
| 351 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
| 353 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 354 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 356 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 357 | int const_channel_count; |
| 358 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | |
| 360 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 361 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 362 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 363 | /* dynamic controls, init_verbs and input_mux */ |
| 364 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 365 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 366 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 367 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 368 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 369 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 370 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 371 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 372 | /* hooks */ |
| 373 | void (*init_hook)(struct hda_codec *codec); |
| 374 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 376 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 377 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 378 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 379 | /* for pin sensing */ |
| 380 | unsigned int sense_updated: 1; |
| 381 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 382 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 383 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 384 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 385 | /* other flags */ |
| 386 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 387 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 388 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 389 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 390 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 391 | /* for virtual master */ |
| 392 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 393 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 394 | struct hda_loopback_check loopback; |
| 395 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 396 | |
| 397 | /* for PLL fix */ |
| 398 | hda_nid_t pll_nid; |
| 399 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 400 | |
| 401 | /* fix-up list */ |
| 402 | int fixup_id; |
| 403 | const struct alc_fixup *fixup_list; |
| 404 | const char *fixup_name; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 405 | }; |
| 406 | |
| 407 | /* |
| 408 | * configuration template - to be copied to the spec instance |
| 409 | */ |
| 410 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 411 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 412 | * with spec |
| 413 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 414 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 415 | const struct hda_verb *init_verbs[5]; |
| 416 | unsigned int num_dacs; |
| 417 | hda_nid_t *dac_nids; |
| 418 | hda_nid_t dig_out_nid; /* optional */ |
| 419 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 420 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 421 | unsigned int num_adc_nids; |
| 422 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 423 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 424 | hda_nid_t dig_in_nid; |
| 425 | unsigned int num_channel_mode; |
| 426 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 427 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 428 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 429 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 430 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 431 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 432 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 433 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 434 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 435 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 436 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 437 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | }; |
| 439 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | |
| 441 | /* |
| 442 | * input MUX handling |
| 443 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 444 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 445 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | { |
| 447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 448 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 449 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 450 | if (mux_idx >= spec->num_mux_defs) |
| 451 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 452 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 453 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 454 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | } |
| 456 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 457 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 458 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | { |
| 460 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 461 | struct alc_spec *spec = codec->spec; |
| 462 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 463 | |
| 464 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 465 | return 0; |
| 466 | } |
| 467 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | { |
| 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 473 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 475 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 476 | hda_nid_t nid = spec->capsrc_nids ? |
| 477 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 478 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 480 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 481 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 482 | if (!imux->num_items && mux_idx > 0) |
| 483 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 484 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 485 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 486 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 487 | /* Matrix-mixer style (e.g. ALC882) */ |
| 488 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 489 | unsigned int i, idx; |
| 490 | |
| 491 | idx = ucontrol->value.enumerated.item[0]; |
| 492 | if (idx >= imux->num_items) |
| 493 | idx = imux->num_items - 1; |
| 494 | if (*cur_val == idx) |
| 495 | return 0; |
| 496 | for (i = 0; i < imux->num_items; i++) { |
| 497 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 498 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 499 | imux->items[i].index, |
| 500 | HDA_AMP_MUTE, v); |
| 501 | } |
| 502 | *cur_val = idx; |
| 503 | return 1; |
| 504 | } else { |
| 505 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 506 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 507 | &spec->cur_mux[adc_idx]); |
| 508 | } |
| 509 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 510 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | /* |
| 512 | * channel mode setting |
| 513 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 515 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | { |
| 517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 518 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 519 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 520 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | } |
| 522 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 524 | struct snd_ctl_elem_value *ucontrol) |
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_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 529 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 530 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | } |
| 532 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 533 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 534 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | { |
| 536 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 537 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 538 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 539 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 540 | &spec->ext_channel_count); |
| 541 | if (err >= 0 && !spec->const_channel_count) { |
| 542 | spec->multiout.max_channels = spec->ext_channel_count; |
| 543 | if (spec->need_dac_fix) |
| 544 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 545 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 546 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | } |
| 548 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 550 | * 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] | 551 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | * being part of a format specifier. Maximum allowed length of a value is |
| 553 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 554 | * |
| 555 | * Note: some retasking pin complexes seem to ignore requests for input |
| 556 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 557 | * are requested. Therefore order this list so that this behaviour will not |
| 558 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 559 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 560 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 561 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 562 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 563 | "Mic 50pc bias", "Mic 80pc bias", |
| 564 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 565 | }; |
| 566 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 567 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 568 | }; |
| 569 | /* 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] | 570 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 571 | * addition, "input" pins may or may not process the mic bias option |
| 572 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 573 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 574 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 575 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 576 | #define ALC_PIN_DIR_IN 0x00 |
| 577 | #define ALC_PIN_DIR_OUT 0x01 |
| 578 | #define ALC_PIN_DIR_INOUT 0x02 |
| 579 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 580 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 582 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 583 | * For each direction the minimum and maximum values are given. |
| 584 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 585 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 586 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 587 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 588 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 589 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 590 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | }; |
| 592 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 593 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 594 | #define alc_pin_mode_n_items(_dir) \ |
| 595 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 596 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 597 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 598 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 599 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 600 | unsigned int item_num = uinfo->value.enumerated.item; |
| 601 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 602 | |
| 603 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 604 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 605 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 606 | |
| 607 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 608 | item_num = alc_pin_mode_min(dir); |
| 609 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 610 | return 0; |
| 611 | } |
| 612 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 613 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 614 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 615 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 616 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 617 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 618 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 619 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 620 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 621 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 622 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 623 | 0x00); |
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 | /* Find enumerated value for current pinctl setting */ |
| 626 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 627 | 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] | 628 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 629 | *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] | 630 | return 0; |
| 631 | } |
| 632 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 633 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 634 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 635 | { |
| 636 | signed int change; |
| 637 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 638 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 639 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 640 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 641 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 642 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 643 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 644 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 645 | 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] | 646 | val = alc_pin_mode_min(dir); |
| 647 | |
| 648 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 649 | if (change) { |
| 650 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 651 | snd_hda_codec_write_cache(codec, nid, 0, |
| 652 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 653 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 654 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 655 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 656 | * for the requested pin mode. Enum values of 2 or less are |
| 657 | * input modes. |
| 658 | * |
| 659 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 660 | * reduces noise slightly (particularly on input) so we'll |
| 661 | * do it. However, having both input and output buffers |
| 662 | * enabled simultaneously doesn't seem to be problematic if |
| 663 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 664 | */ |
| 665 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 666 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 667 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 668 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 669 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 670 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 671 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 672 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 673 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 674 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 675 | } |
| 676 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 677 | return change; |
| 678 | } |
| 679 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 680 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 681 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 682 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 683 | .info = alc_pin_mode_info, \ |
| 684 | .get = alc_pin_mode_get, \ |
| 685 | .put = alc_pin_mode_put, \ |
| 686 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 687 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 688 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 689 | * together using a mask with more than one bit set. This control is |
| 690 | * currently used only by the ALC260 test model. At this stage they are not |
| 691 | * needed for any "production" models. |
| 692 | */ |
| 693 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 694 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 695 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 696 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 697 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 698 | { |
| 699 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 700 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 701 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 702 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 704 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 705 | |
| 706 | *valp = (val & mask) != 0; |
| 707 | return 0; |
| 708 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 709 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 710 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 711 | { |
| 712 | signed int change; |
| 713 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 714 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 715 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 716 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 717 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 718 | AC_VERB_GET_GPIO_DATA, |
| 719 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 720 | |
| 721 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 723 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 724 | gpio_data &= ~mask; |
| 725 | else |
| 726 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 727 | snd_hda_codec_write_cache(codec, nid, 0, |
| 728 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 729 | |
| 730 | return change; |
| 731 | } |
| 732 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 733 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 734 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 735 | .info = alc_gpio_data_info, \ |
| 736 | .get = alc_gpio_data_get, \ |
| 737 | .put = alc_gpio_data_put, \ |
| 738 | .private_value = nid | (mask<<16) } |
| 739 | #endif /* CONFIG_SND_DEBUG */ |
| 740 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 741 | /* A switch control to allow the enabling of the digital IO pins on the |
| 742 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 743 | * to provide something in the test model allowing digital outputs to be |
| 744 | * identified if present. If models are found which can utilise these |
| 745 | * outputs a more complete mixer control can be devised for those models if |
| 746 | * necessary. |
| 747 | */ |
| 748 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 749 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 750 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 751 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 752 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 753 | { |
| 754 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 755 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 756 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 757 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 758 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 759 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 760 | |
| 761 | *valp = (val & mask) != 0; |
| 762 | return 0; |
| 763 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 764 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 765 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 766 | { |
| 767 | signed int change; |
| 768 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 769 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 770 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 771 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 772 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 773 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 774 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 775 | |
| 776 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 777 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 778 | if (val==0) |
| 779 | ctrl_data &= ~mask; |
| 780 | else |
| 781 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 782 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 783 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 784 | |
| 785 | return change; |
| 786 | } |
| 787 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 788 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 789 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 790 | .info = alc_spdif_ctrl_info, \ |
| 791 | .get = alc_spdif_ctrl_get, \ |
| 792 | .put = alc_spdif_ctrl_put, \ |
| 793 | .private_value = nid | (mask<<16) } |
| 794 | #endif /* CONFIG_SND_DEBUG */ |
| 795 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 796 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 797 | * Again, this is only used in the ALC26x test models to help identify when |
| 798 | * the EAPD line must be asserted for features to work. |
| 799 | */ |
| 800 | #ifdef CONFIG_SND_DEBUG |
| 801 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 802 | |
| 803 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 804 | struct snd_ctl_elem_value *ucontrol) |
| 805 | { |
| 806 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 807 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 808 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 809 | long *valp = ucontrol->value.integer.value; |
| 810 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 811 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 812 | |
| 813 | *valp = (val & mask) != 0; |
| 814 | return 0; |
| 815 | } |
| 816 | |
| 817 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 818 | struct snd_ctl_elem_value *ucontrol) |
| 819 | { |
| 820 | int change; |
| 821 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 822 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 823 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 824 | long val = *ucontrol->value.integer.value; |
| 825 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 826 | AC_VERB_GET_EAPD_BTLENABLE, |
| 827 | 0x00); |
| 828 | |
| 829 | /* Set/unset the masked control bit(s) as needed */ |
| 830 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 831 | if (!val) |
| 832 | ctrl_data &= ~mask; |
| 833 | else |
| 834 | ctrl_data |= mask; |
| 835 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 836 | ctrl_data); |
| 837 | |
| 838 | return change; |
| 839 | } |
| 840 | |
| 841 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 842 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 843 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 844 | .info = alc_eapd_ctrl_info, \ |
| 845 | .get = alc_eapd_ctrl_get, \ |
| 846 | .put = alc_eapd_ctrl_put, \ |
| 847 | .private_value = nid | (mask<<16) } |
| 848 | #endif /* CONFIG_SND_DEBUG */ |
| 849 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 850 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 851 | * set up the input pin config (depending on the given auto-pin type) |
| 852 | */ |
| 853 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 854 | int auto_pin_type) |
| 855 | { |
| 856 | unsigned int val = PIN_IN; |
| 857 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 858 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 859 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 860 | unsigned int oldval; |
| 861 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 862 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 863 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 864 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 865 | /* if the default pin setup is vref50, we give it priority */ |
| 866 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 867 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 868 | else if (pincap & AC_PINCAP_VREF_50) |
| 869 | val = PIN_VREF50; |
| 870 | else if (pincap & AC_PINCAP_VREF_100) |
| 871 | val = PIN_VREF100; |
| 872 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 873 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 874 | } |
| 875 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 876 | } |
| 877 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 878 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 879 | { |
| 880 | struct alc_spec *spec = codec->spec; |
| 881 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 882 | |
| 883 | if (!cfg->line_outs) { |
| 884 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 885 | cfg->line_out_pins[cfg->line_outs]) |
| 886 | cfg->line_outs++; |
| 887 | } |
| 888 | if (!cfg->speaker_outs) { |
| 889 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 890 | cfg->speaker_pins[cfg->speaker_outs]) |
| 891 | cfg->speaker_outs++; |
| 892 | } |
| 893 | if (!cfg->hp_outs) { |
| 894 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 895 | cfg->hp_pins[cfg->hp_outs]) |
| 896 | cfg->hp_outs++; |
| 897 | } |
| 898 | } |
| 899 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 900 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 901 | */ |
| 902 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 903 | { |
| 904 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 905 | return; |
| 906 | spec->mixers[spec->num_mixers++] = mix; |
| 907 | } |
| 908 | |
| 909 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 910 | { |
| 911 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 912 | return; |
| 913 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 914 | } |
| 915 | |
| 916 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 917 | * set up from the preset table |
| 918 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 919 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 920 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 921 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 922 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 923 | int i; |
| 924 | |
| 925 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 926 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 927 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 928 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 929 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 930 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 931 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 932 | spec->channel_mode = preset->channel_mode; |
| 933 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 934 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 935 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 936 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 937 | if (preset->const_channel_count) |
| 938 | spec->multiout.max_channels = preset->const_channel_count; |
| 939 | else |
| 940 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 941 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 942 | |
| 943 | spec->multiout.num_dacs = preset->num_dacs; |
| 944 | spec->multiout.dac_nids = preset->dac_nids; |
| 945 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 946 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 947 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 948 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 949 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 950 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 951 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 952 | spec->input_mux = preset->input_mux; |
| 953 | |
| 954 | spec->num_adc_nids = preset->num_adc_nids; |
| 955 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 956 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 957 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 958 | |
| 959 | spec->unsol_event = preset->unsol_event; |
| 960 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 961 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 962 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 963 | spec->loopback.amplist = preset->loopbacks; |
| 964 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 965 | |
| 966 | if (preset->setup) |
| 967 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 968 | |
| 969 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 970 | } |
| 971 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 972 | /* Enable GPIO mask and set output */ |
| 973 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 974 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 975 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 976 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 977 | { } |
| 978 | }; |
| 979 | |
| 980 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 981 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 982 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 983 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 984 | { } |
| 985 | }; |
| 986 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 987 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 988 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 989 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 990 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 991 | { } |
| 992 | }; |
| 993 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 994 | /* |
| 995 | * Fix hardware PLL issue |
| 996 | * On some codecs, the analog PLL gating control must be off while |
| 997 | * the default value is 1. |
| 998 | */ |
| 999 | static void alc_fix_pll(struct hda_codec *codec) |
| 1000 | { |
| 1001 | struct alc_spec *spec = codec->spec; |
| 1002 | unsigned int val; |
| 1003 | |
| 1004 | if (!spec->pll_nid) |
| 1005 | return; |
| 1006 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1007 | spec->pll_coef_idx); |
| 1008 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1009 | AC_VERB_GET_PROC_COEF, 0); |
| 1010 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1011 | spec->pll_coef_idx); |
| 1012 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1013 | val & ~(1 << spec->pll_coef_bit)); |
| 1014 | } |
| 1015 | |
| 1016 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1017 | unsigned int coef_idx, unsigned int coef_bit) |
| 1018 | { |
| 1019 | struct alc_spec *spec = codec->spec; |
| 1020 | spec->pll_nid = nid; |
| 1021 | spec->pll_coef_idx = coef_idx; |
| 1022 | spec->pll_coef_bit = coef_bit; |
| 1023 | alc_fix_pll(codec); |
| 1024 | } |
| 1025 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1026 | static int alc_init_jacks(struct hda_codec *codec) |
| 1027 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1028 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1029 | struct alc_spec *spec = codec->spec; |
| 1030 | int err; |
| 1031 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1032 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1033 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1034 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1035 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1036 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1037 | if (err < 0) |
| 1038 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1039 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1040 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1041 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1042 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1043 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1044 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1045 | if (err < 0) |
| 1046 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1047 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1048 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1049 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1050 | return 0; |
| 1051 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1052 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1053 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1054 | { |
| 1055 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1056 | unsigned int mute; |
| 1057 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1058 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1059 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1060 | spec->jack_present = 0; |
| 1061 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1062 | nid = spec->autocfg.hp_pins[i]; |
| 1063 | if (!nid) |
| 1064 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1065 | snd_hda_input_jack_report(codec, nid); |
David Henningsson | f0ce279 | 2011-02-28 15:58:07 +0100 | [diff] [blame] | 1066 | spec->jack_present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1067 | } |
| 1068 | |
| 1069 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1070 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1071 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1072 | nid = spec->autocfg.speaker_pins[i]; |
| 1073 | if (!nid) |
| 1074 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1075 | if (pinctl) { |
| 1076 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1077 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1078 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1079 | } else { |
| 1080 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1081 | HDA_AMP_MUTE, mute); |
| 1082 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1083 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1084 | } |
| 1085 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1086 | static void alc_automute_pin(struct hda_codec *codec) |
| 1087 | { |
| 1088 | alc_automute_speaker(codec, 1); |
| 1089 | } |
| 1090 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1091 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1092 | hda_nid_t nid) |
| 1093 | { |
| 1094 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1095 | int i, nums; |
| 1096 | |
| 1097 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1098 | for (i = 0; i < nums; i++) |
| 1099 | if (conn[i] == nid) |
| 1100 | return i; |
| 1101 | return -1; |
| 1102 | } |
| 1103 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1104 | /* switch the current ADC according to the jack state */ |
| 1105 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1106 | { |
| 1107 | struct alc_spec *spec = codec->spec; |
| 1108 | unsigned int present; |
| 1109 | hda_nid_t new_adc; |
| 1110 | |
| 1111 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1112 | if (present) |
| 1113 | spec->cur_adc_idx = 1; |
| 1114 | else |
| 1115 | spec->cur_adc_idx = 0; |
| 1116 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1117 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1118 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1119 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1120 | spec->cur_adc = new_adc; |
| 1121 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1122 | spec->cur_adc_stream_tag, 0, |
| 1123 | spec->cur_adc_format); |
| 1124 | } |
| 1125 | } |
| 1126 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1127 | static void alc_mic_automute(struct hda_codec *codec) |
| 1128 | { |
| 1129 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1130 | struct alc_mic_route *dead, *alive; |
| 1131 | unsigned int present, type; |
| 1132 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1133 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1134 | if (!spec->auto_mic) |
| 1135 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1136 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1137 | return; |
| 1138 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1139 | return; |
| 1140 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1141 | if (spec->dual_adc_switch) { |
| 1142 | alc_dual_mic_adc_auto_switch(codec); |
| 1143 | return; |
| 1144 | } |
| 1145 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1146 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1147 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1148 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1149 | if (present) { |
| 1150 | alive = &spec->ext_mic; |
| 1151 | dead = &spec->int_mic; |
| 1152 | } else { |
| 1153 | alive = &spec->int_mic; |
| 1154 | dead = &spec->ext_mic; |
| 1155 | } |
| 1156 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1157 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1158 | if (type == AC_WID_AUD_MIX) { |
| 1159 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1160 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1161 | alive->mux_idx, |
| 1162 | HDA_AMP_MUTE, 0); |
| 1163 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1164 | dead->mux_idx, |
| 1165 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1166 | } else { |
| 1167 | /* MUX style (e.g. ALC880) */ |
| 1168 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1169 | AC_VERB_SET_CONNECT_SEL, |
| 1170 | alive->mux_idx); |
| 1171 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1172 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1173 | |
| 1174 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1175 | } |
| 1176 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1177 | /* unsolicited event for HP jack sensing */ |
| 1178 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1179 | { |
| 1180 | if (codec->vendor_id == 0x10ec0880) |
| 1181 | res >>= 28; |
| 1182 | else |
| 1183 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1184 | switch (res) { |
| 1185 | case ALC880_HP_EVENT: |
| 1186 | alc_automute_pin(codec); |
| 1187 | break; |
| 1188 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1189 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1190 | break; |
| 1191 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1192 | } |
| 1193 | |
| 1194 | static void alc_inithook(struct hda_codec *codec) |
| 1195 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1196 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1197 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1198 | } |
| 1199 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1200 | /* additional initialization for ALC888 variants */ |
| 1201 | static void alc888_coef_init(struct hda_codec *codec) |
| 1202 | { |
| 1203 | unsigned int tmp; |
| 1204 | |
| 1205 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1206 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1207 | 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] | 1208 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1209 | /* alc888S-VC */ |
| 1210 | snd_hda_codec_read(codec, 0x20, 0, |
| 1211 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1212 | else |
| 1213 | /* alc888-VB */ |
| 1214 | snd_hda_codec_read(codec, 0x20, 0, |
| 1215 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1216 | } |
| 1217 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1218 | static void alc889_coef_init(struct hda_codec *codec) |
| 1219 | { |
| 1220 | unsigned int tmp; |
| 1221 | |
| 1222 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1223 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1224 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1225 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1226 | } |
| 1227 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1228 | /* turn on/off EAPD control (only if available) */ |
| 1229 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1230 | { |
| 1231 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1232 | return; |
| 1233 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1234 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1235 | on ? 2 : 0); |
| 1236 | } |
| 1237 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1238 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1239 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1240 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1241 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1242 | switch (type) { |
| 1243 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1244 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1245 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1246 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1247 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1248 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1249 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1250 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1251 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1252 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1253 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1254 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1255 | set_eapd(codec, 0x0f, 1); |
| 1256 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1257 | break; |
| 1258 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1259 | case 0x10ec0267: |
| 1260 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1261 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1262 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1263 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1264 | case 0x10ec0660: |
| 1265 | case 0x10ec0662: |
| 1266 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1267 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1268 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1269 | set_eapd(codec, 0x14, 1); |
| 1270 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1271 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1272 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1273 | switch (codec->vendor_id) { |
| 1274 | case 0x10ec0260: |
| 1275 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1276 | AC_VERB_SET_COEF_INDEX, 7); |
| 1277 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1278 | AC_VERB_GET_PROC_COEF, 0); |
| 1279 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1280 | AC_VERB_SET_COEF_INDEX, 7); |
| 1281 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1282 | AC_VERB_SET_PROC_COEF, |
| 1283 | tmp | 0x2010); |
| 1284 | break; |
| 1285 | case 0x10ec0262: |
| 1286 | case 0x10ec0880: |
| 1287 | case 0x10ec0882: |
| 1288 | case 0x10ec0883: |
| 1289 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1290 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1291 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1292 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1293 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1294 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1295 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1296 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1297 | #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] | 1298 | case 0x10ec0267: |
| 1299 | case 0x10ec0268: |
| 1300 | snd_hda_codec_write(codec, 0x20, 0, |
| 1301 | AC_VERB_SET_COEF_INDEX, 7); |
| 1302 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1303 | AC_VERB_GET_PROC_COEF, 0); |
| 1304 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1305 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1306 | snd_hda_codec_write(codec, 0x20, 0, |
| 1307 | AC_VERB_SET_PROC_COEF, |
| 1308 | tmp | 0x3000); |
| 1309 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1310 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1311 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1312 | break; |
| 1313 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1314 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1315 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1316 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1317 | { |
| 1318 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1319 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1320 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1321 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1322 | if (!cfg->hp_pins[0]) { |
| 1323 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1324 | return; |
| 1325 | } |
| 1326 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1327 | if (!cfg->speaker_pins[0]) { |
| 1328 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1329 | return; |
| 1330 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1331 | sizeof(cfg->speaker_pins)); |
| 1332 | cfg->speaker_outs = cfg->line_outs; |
| 1333 | } |
| 1334 | |
| 1335 | if (!cfg->hp_pins[0]) { |
| 1336 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1337 | sizeof(cfg->hp_pins)); |
| 1338 | cfg->hp_outs = cfg->line_outs; |
| 1339 | } |
| 1340 | |
| 1341 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1342 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1343 | cfg->hp_pins[i]); |
| 1344 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1345 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1346 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1347 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1348 | spec->unsol_event = alc_sku_unsol_event; |
| 1349 | } |
| 1350 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1351 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1352 | { |
| 1353 | struct alc_spec *spec = codec->spec; |
| 1354 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1355 | hda_nid_t fixed, ext; |
| 1356 | int i; |
| 1357 | |
| 1358 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1359 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1360 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1361 | return; |
| 1362 | |
| 1363 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1364 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1365 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1366 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1367 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1368 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1369 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1370 | if (fixed) |
| 1371 | return; /* already occupied */ |
| 1372 | fixed = nid; |
| 1373 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1374 | case INPUT_PIN_ATTR_UNUSED: |
| 1375 | return; /* invalid entry */ |
| 1376 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1377 | if (ext) |
| 1378 | return; /* already occupied */ |
| 1379 | ext = nid; |
| 1380 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1381 | } |
| 1382 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1383 | if (!ext || !fixed) |
| 1384 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1385 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1386 | return; /* no unsol support */ |
| 1387 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1388 | ext, fixed); |
| 1389 | spec->ext_mic.pin = ext; |
| 1390 | spec->int_mic.pin = fixed; |
| 1391 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1392 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1393 | spec->auto_mic = 1; |
| 1394 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1395 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1396 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1397 | spec->unsol_event = alc_sku_unsol_event; |
| 1398 | } |
| 1399 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1400 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1401 | * the driver to ignore any present sku defines. |
| 1402 | */ |
| 1403 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1404 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1405 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1406 | { |
| 1407 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1408 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1409 | struct alc_spec *spec = codec->spec; |
| 1410 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1411 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1412 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1413 | if (spec->cdefine.fixup) { |
| 1414 | ass = spec->cdefine.sku_cfg; |
| 1415 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1416 | return -1; |
| 1417 | goto do_sku; |
| 1418 | } |
| 1419 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1420 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1421 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1422 | goto do_sku; |
| 1423 | |
| 1424 | nid = 0x1d; |
| 1425 | if (codec->vendor_id == 0x10ec0260) |
| 1426 | nid = 0x17; |
| 1427 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1428 | |
| 1429 | if (!(ass & 1)) { |
| 1430 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1431 | codec->chip_name, ass); |
| 1432 | return -1; |
| 1433 | } |
| 1434 | |
| 1435 | /* check sum */ |
| 1436 | tmp = 0; |
| 1437 | for (i = 1; i < 16; i++) { |
| 1438 | if ((ass >> i) & 1) |
| 1439 | tmp++; |
| 1440 | } |
| 1441 | if (((ass >> 16) & 0xf) != tmp) |
| 1442 | return -1; |
| 1443 | |
| 1444 | spec->cdefine.port_connectivity = ass >> 30; |
| 1445 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1446 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1447 | spec->cdefine.customization = ass >> 8; |
| 1448 | do_sku: |
| 1449 | spec->cdefine.sku_cfg = ass; |
| 1450 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1451 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1452 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1453 | spec->cdefine.override = ass & 0x1; |
| 1454 | |
| 1455 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1456 | nid, spec->cdefine.sku_cfg); |
| 1457 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1458 | spec->cdefine.port_connectivity); |
| 1459 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1460 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1461 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1462 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1463 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1464 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1465 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1466 | |
| 1467 | return 0; |
| 1468 | } |
| 1469 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1470 | /* check subsystem ID and set up device-specific initialization; |
| 1471 | * return 1 if initialized, 0 if invalid SSID |
| 1472 | */ |
| 1473 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1474 | * 31 ~ 16 : Manufacture ID |
| 1475 | * 15 ~ 8 : SKU ID |
| 1476 | * 7 ~ 0 : Assembly ID |
| 1477 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1478 | */ |
| 1479 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1480 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1481 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1482 | { |
| 1483 | unsigned int ass, tmp, i; |
| 1484 | unsigned nid; |
| 1485 | struct alc_spec *spec = codec->spec; |
| 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 0; |
| 1491 | goto do_sku; |
| 1492 | } |
| 1493 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1494 | ass = codec->subsystem_id & 0xffff; |
| 1495 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1496 | goto do_sku; |
| 1497 | |
| 1498 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1499 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1500 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1501 | * 29~21 : reserve |
| 1502 | * 20 : PCBEEP input |
| 1503 | * 19~16 : Check sum (15:1) |
| 1504 | * 15~1 : Custom |
| 1505 | * 0 : override |
| 1506 | */ |
| 1507 | nid = 0x1d; |
| 1508 | if (codec->vendor_id == 0x10ec0260) |
| 1509 | nid = 0x17; |
| 1510 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1511 | snd_printd("realtek: No valid SSID, " |
| 1512 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1513 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1514 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1515 | return 0; |
| 1516 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1517 | return 0; |
| 1518 | |
| 1519 | /* check sum */ |
| 1520 | tmp = 0; |
| 1521 | for (i = 1; i < 16; i++) { |
| 1522 | if ((ass >> i) & 1) |
| 1523 | tmp++; |
| 1524 | } |
| 1525 | if (((ass >> 16) & 0xf) != tmp) |
| 1526 | return 0; |
| 1527 | do_sku: |
| 1528 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1529 | ass & 0xffff, codec->vendor_id); |
| 1530 | /* |
| 1531 | * 0 : override |
| 1532 | * 1 : Swap Jack |
| 1533 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1534 | * 3~5 : External Amplifier control |
| 1535 | * 7~6 : Reserved |
| 1536 | */ |
| 1537 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1538 | switch (tmp) { |
| 1539 | case 1: |
| 1540 | spec->init_amp = ALC_INIT_GPIO1; |
| 1541 | break; |
| 1542 | case 3: |
| 1543 | spec->init_amp = ALC_INIT_GPIO2; |
| 1544 | break; |
| 1545 | case 7: |
| 1546 | spec->init_amp = ALC_INIT_GPIO3; |
| 1547 | break; |
| 1548 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1549 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1550 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1551 | break; |
| 1552 | } |
| 1553 | |
| 1554 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1555 | * when the external headphone out jack is plugged" |
| 1556 | */ |
| 1557 | if (!(ass & 0x8000)) |
| 1558 | return 1; |
| 1559 | /* |
| 1560 | * 10~8 : Jack location |
| 1561 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1562 | * 14~13: Resvered |
| 1563 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1564 | * when the external headphone out jack is plugged" |
| 1565 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1566 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1567 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1568 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1569 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1570 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1571 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1572 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1573 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1574 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1575 | else if (tmp == 3) |
| 1576 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1577 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1578 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1579 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1580 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1581 | return 1; |
| 1582 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1583 | } |
| 1584 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1585 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1586 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1587 | return 1; |
| 1588 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1589 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1590 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1591 | hda_nid_t porta, hda_nid_t porte, |
| 1592 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1593 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1594 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1595 | struct alc_spec *spec = codec->spec; |
| 1596 | snd_printd("realtek: " |
| 1597 | "Enable default setup for auto mode as fallback\n"); |
| 1598 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1599 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1600 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1601 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1602 | } |
| 1603 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1604 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1605 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1606 | */ |
| 1607 | |
| 1608 | struct alc_pincfg { |
| 1609 | hda_nid_t nid; |
| 1610 | u32 val; |
| 1611 | }; |
| 1612 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1613 | struct alc_model_fixup { |
| 1614 | const int id; |
| 1615 | const char *name; |
| 1616 | }; |
| 1617 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1618 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1619 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1620 | bool chained; |
| 1621 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1622 | union { |
| 1623 | unsigned int sku; |
| 1624 | const struct alc_pincfg *pins; |
| 1625 | const struct hda_verb *verbs; |
| 1626 | void (*func)(struct hda_codec *codec, |
| 1627 | const struct alc_fixup *fix, |
| 1628 | int action); |
| 1629 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1630 | }; |
| 1631 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1632 | enum { |
| 1633 | ALC_FIXUP_INVALID, |
| 1634 | ALC_FIXUP_SKU, |
| 1635 | ALC_FIXUP_PINS, |
| 1636 | ALC_FIXUP_VERBS, |
| 1637 | ALC_FIXUP_FUNC, |
| 1638 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1639 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1640 | enum { |
| 1641 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1642 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1643 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1644 | }; |
| 1645 | |
| 1646 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1647 | { |
| 1648 | struct alc_spec *spec = codec->spec; |
| 1649 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1650 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1651 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1652 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1653 | int depth = 0; |
| 1654 | |
| 1655 | if (!spec->fixup_list) |
| 1656 | return; |
| 1657 | |
| 1658 | while (id >= 0) { |
| 1659 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1660 | const struct alc_pincfg *cfg; |
| 1661 | |
| 1662 | switch (fix->type) { |
| 1663 | case ALC_FIXUP_SKU: |
| 1664 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1665 | break;; |
| 1666 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1667 | "Apply sku override for %s\n", |
| 1668 | codec->chip_name, modelname); |
| 1669 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1670 | spec->cdefine.fixup = 1; |
| 1671 | break; |
| 1672 | case ALC_FIXUP_PINS: |
| 1673 | cfg = fix->v.pins; |
| 1674 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1675 | break; |
| 1676 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1677 | "Apply pincfg for %s\n", |
| 1678 | codec->chip_name, modelname); |
| 1679 | for (; cfg->nid; cfg++) |
| 1680 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1681 | cfg->val); |
| 1682 | break; |
| 1683 | case ALC_FIXUP_VERBS: |
| 1684 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1685 | break; |
| 1686 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1687 | "Apply fix-verbs for %s\n", |
| 1688 | codec->chip_name, modelname); |
| 1689 | add_verb(codec->spec, fix->v.verbs); |
| 1690 | break; |
| 1691 | case ALC_FIXUP_FUNC: |
| 1692 | if (!fix->v.func) |
| 1693 | break; |
| 1694 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1695 | "Apply fix-func for %s\n", |
| 1696 | codec->chip_name, modelname); |
| 1697 | fix->v.func(codec, fix, action); |
| 1698 | break; |
| 1699 | default: |
| 1700 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1701 | "Invalid fixup type %d\n", |
| 1702 | codec->chip_name, fix->type); |
| 1703 | break; |
| 1704 | } |
| 1705 | if (!fix[id].chained) |
| 1706 | break; |
| 1707 | if (++depth > 10) |
| 1708 | break; |
| 1709 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1710 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1711 | } |
| 1712 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1713 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1714 | const struct alc_model_fixup *models, |
| 1715 | const struct snd_pci_quirk *quirk, |
| 1716 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1717 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1718 | struct alc_spec *spec = codec->spec; |
| 1719 | int id = -1; |
| 1720 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1721 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1722 | if (codec->modelname && models) { |
| 1723 | while (models->name) { |
| 1724 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1725 | id = models->id; |
| 1726 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1727 | break; |
| 1728 | } |
| 1729 | models++; |
| 1730 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1731 | } |
| 1732 | if (id < 0) { |
| 1733 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1734 | if (quirk) { |
| 1735 | id = quirk->value; |
| 1736 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1737 | name = quirk->name; |
| 1738 | #endif |
| 1739 | } |
| 1740 | } |
| 1741 | |
| 1742 | spec->fixup_id = id; |
| 1743 | if (id >= 0) { |
| 1744 | spec->fixup_list = fixlist; |
| 1745 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1746 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1747 | } |
| 1748 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1749 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1750 | unsigned int coef_idx) |
| 1751 | { |
| 1752 | unsigned int val; |
| 1753 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1754 | coef_idx); |
| 1755 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1756 | AC_VERB_GET_PROC_COEF, 0); |
| 1757 | return val; |
| 1758 | } |
| 1759 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1760 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1761 | unsigned int coef_val) |
| 1762 | { |
| 1763 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1764 | coef_idx); |
| 1765 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1766 | coef_val); |
| 1767 | } |
| 1768 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1769 | /* set right pin controls for digital I/O */ |
| 1770 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1771 | { |
| 1772 | struct alc_spec *spec = codec->spec; |
| 1773 | int i; |
| 1774 | hda_nid_t pin; |
| 1775 | |
| 1776 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1777 | pin = spec->autocfg.dig_out_pins[i]; |
| 1778 | if (pin) { |
| 1779 | snd_hda_codec_write(codec, pin, 0, |
| 1780 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1781 | PIN_OUT); |
| 1782 | } |
| 1783 | } |
| 1784 | pin = spec->autocfg.dig_in_pin; |
| 1785 | if (pin) |
| 1786 | snd_hda_codec_write(codec, pin, 0, |
| 1787 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1788 | PIN_IN); |
| 1789 | } |
| 1790 | |
| 1791 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1792 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1793 | { |
| 1794 | struct alc_spec *spec = codec->spec; |
| 1795 | int i, err; |
| 1796 | hda_nid_t dig_nid; |
| 1797 | |
| 1798 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1799 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1800 | err = snd_hda_get_connections(codec, |
| 1801 | spec->autocfg.dig_out_pins[i], |
| 1802 | &dig_nid, 1); |
| 1803 | if (err < 0) |
| 1804 | continue; |
| 1805 | if (!i) { |
| 1806 | spec->multiout.dig_out_nid = dig_nid; |
| 1807 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1808 | } else { |
| 1809 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1810 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1811 | break; |
| 1812 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1813 | } |
| 1814 | } |
| 1815 | |
| 1816 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1817 | dig_nid = codec->start_nid; |
| 1818 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1819 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1820 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1821 | continue; |
| 1822 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1823 | continue; |
| 1824 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1825 | continue; |
| 1826 | err = get_connection_index(codec, dig_nid, |
| 1827 | spec->autocfg.dig_in_pin); |
| 1828 | if (err >= 0) { |
| 1829 | spec->dig_in_nid = dig_nid; |
| 1830 | break; |
| 1831 | } |
| 1832 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1833 | } |
| 1834 | } |
| 1835 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1836 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1837 | * ALC888 |
| 1838 | */ |
| 1839 | |
| 1840 | /* |
| 1841 | * 2ch mode |
| 1842 | */ |
| 1843 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1844 | /* Mic-in jack as mic in */ |
| 1845 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1846 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1847 | /* Line-in jack as Line in */ |
| 1848 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1849 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1850 | /* Line-Out as Front */ |
| 1851 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1852 | { } /* end */ |
| 1853 | }; |
| 1854 | |
| 1855 | /* |
| 1856 | * 4ch mode |
| 1857 | */ |
| 1858 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1859 | /* Mic-in jack as mic in */ |
| 1860 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1861 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1862 | /* Line-in jack as Surround */ |
| 1863 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1864 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1865 | /* Line-Out as Front */ |
| 1866 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1867 | { } /* end */ |
| 1868 | }; |
| 1869 | |
| 1870 | /* |
| 1871 | * 6ch mode |
| 1872 | */ |
| 1873 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1874 | /* Mic-in jack as CLFE */ |
| 1875 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1876 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1877 | /* Line-in jack as Surround */ |
| 1878 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1879 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1880 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1881 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1882 | { } /* end */ |
| 1883 | }; |
| 1884 | |
| 1885 | /* |
| 1886 | * 8ch mode |
| 1887 | */ |
| 1888 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1889 | /* Mic-in jack as CLFE */ |
| 1890 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1891 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1892 | /* Line-in jack as Surround */ |
| 1893 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1894 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1895 | /* Line-Out as Side */ |
| 1896 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1897 | { } /* end */ |
| 1898 | }; |
| 1899 | |
| 1900 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1901 | { 2, alc888_4ST_ch2_intel_init }, |
| 1902 | { 4, alc888_4ST_ch4_intel_init }, |
| 1903 | { 6, alc888_4ST_ch6_intel_init }, |
| 1904 | { 8, alc888_4ST_ch8_intel_init }, |
| 1905 | }; |
| 1906 | |
| 1907 | /* |
| 1908 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1909 | */ |
| 1910 | |
| 1911 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1912 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1913 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1914 | /* Connect Internal HP to Front */ |
| 1915 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1916 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1917 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1918 | /* Connect Bass HP to Front */ |
| 1919 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1920 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1921 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1922 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1923 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1924 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1925 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1926 | /* Connect Mic jack to CLFE */ |
| 1927 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1928 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1929 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1930 | /* Connect Line-in jack to Surround */ |
| 1931 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1932 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1933 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1934 | /* Connect HP out jack to Front */ |
| 1935 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1936 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1937 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1938 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1939 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1940 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1941 | {} |
| 1942 | }; |
| 1943 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1944 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1945 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1946 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1947 | } |
| 1948 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1949 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1950 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1951 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1952 | if (codec->vendor_id == 0x10ec0880) |
| 1953 | res >>= 28; |
| 1954 | else |
| 1955 | res >>= 26; |
| 1956 | if (res == ALC880_HP_EVENT) |
| 1957 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1958 | } |
| 1959 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1960 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1961 | { |
| 1962 | struct alc_spec *spec = codec->spec; |
| 1963 | |
| 1964 | spec->autocfg.hp_pins[0] = 0x15; |
| 1965 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1966 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1967 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1968 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1969 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1970 | } |
| 1971 | |
| 1972 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1973 | { |
| 1974 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1975 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1976 | } |
| 1977 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1978 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1979 | { |
| 1980 | struct alc_spec *spec = codec->spec; |
| 1981 | |
| 1982 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1983 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1984 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1985 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1986 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1987 | |
| 1988 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1989 | * ALC888 Acer Aspire 4930G model |
| 1990 | */ |
| 1991 | |
| 1992 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1993 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1994 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1995 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1996 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1997 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1998 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1999 | /* Connect Internal HP to front */ |
| 2000 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2001 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2002 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2003 | /* Connect HP out to front */ |
| 2004 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2005 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2006 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2007 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2008 | { } |
| 2009 | }; |
| 2010 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2011 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2012 | * ALC888 Acer Aspire 6530G model |
| 2013 | */ |
| 2014 | |
| 2015 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2016 | /* Route to built-in subwoofer as well as speakers */ |
| 2017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2019 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2020 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2021 | /* Bias voltage on for external mic port */ |
| 2022 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2023 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2024 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2025 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2026 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2027 | /* Enable unsolicited event for HP jack */ |
| 2028 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2029 | /* Enable speaker output */ |
| 2030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2031 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2032 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2033 | /* Enable headphone output */ |
| 2034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2036 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2037 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2038 | { } |
| 2039 | }; |
| 2040 | |
| 2041 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2042 | *ALC888 Acer Aspire 7730G model |
| 2043 | */ |
| 2044 | |
| 2045 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2046 | /* Bias voltage on for external mic port */ |
| 2047 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2048 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2049 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2050 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2051 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2052 | /* Enable unsolicited event for HP jack */ |
| 2053 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2054 | /* Enable speaker output */ |
| 2055 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2056 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2057 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2058 | /* Enable headphone output */ |
| 2059 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2060 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2061 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2062 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2063 | /*Enable internal subwoofer */ |
| 2064 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2065 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2066 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2067 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2068 | { } |
| 2069 | }; |
| 2070 | |
| 2071 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2072 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2073 | */ |
| 2074 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2075 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2076 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2077 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2078 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2080 | /* Enable unsolicited event for HP jack */ |
| 2081 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2082 | /* Connect Internal Front to Front */ |
| 2083 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2084 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2085 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2086 | /* Connect Internal Rear to Rear */ |
| 2087 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2088 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2089 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2090 | /* Connect Internal CLFE to CLFE */ |
| 2091 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2092 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2093 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2094 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2096 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2097 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2098 | /* Enable all DACs */ |
| 2099 | /* DAC DISABLE/MUTE 1? */ |
| 2100 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2101 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2102 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2103 | /* DAC DISABLE/MUTE 2? */ |
| 2104 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2105 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2106 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2107 | /* DMIC fix |
| 2108 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2109 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2110 | * makes the signal become a difference/sum signal instead of standard |
| 2111 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2112 | * codec replicate the sum signal to both channels, turning it into a |
| 2113 | * normal mono mic. |
| 2114 | */ |
| 2115 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2116 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2117 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2118 | { } |
| 2119 | }; |
| 2120 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2121 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2122 | /* Front mic only available on one ADC */ |
| 2123 | { |
| 2124 | .num_items = 4, |
| 2125 | .items = { |
| 2126 | { "Mic", 0x0 }, |
| 2127 | { "Line", 0x2 }, |
| 2128 | { "CD", 0x4 }, |
| 2129 | { "Front Mic", 0xb }, |
| 2130 | }, |
| 2131 | }, |
| 2132 | { |
| 2133 | .num_items = 3, |
| 2134 | .items = { |
| 2135 | { "Mic", 0x0 }, |
| 2136 | { "Line", 0x2 }, |
| 2137 | { "CD", 0x4 }, |
| 2138 | }, |
| 2139 | } |
| 2140 | }; |
| 2141 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2142 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2143 | /* Interal mic only available on one ADC */ |
| 2144 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2145 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2146 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2147 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2148 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2149 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2150 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2151 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2152 | }, |
| 2153 | }, |
| 2154 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2155 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2156 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2157 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2158 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2159 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2160 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2161 | }, |
| 2162 | } |
| 2163 | }; |
| 2164 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2165 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2166 | /* Digital mic only available on first "ADC" */ |
| 2167 | { |
| 2168 | .num_items = 5, |
| 2169 | .items = { |
| 2170 | { "Mic", 0x0 }, |
| 2171 | { "Line", 0x2 }, |
| 2172 | { "CD", 0x4 }, |
| 2173 | { "Front Mic", 0xb }, |
| 2174 | { "Input Mix", 0xa }, |
| 2175 | }, |
| 2176 | }, |
| 2177 | { |
| 2178 | .num_items = 4, |
| 2179 | .items = { |
| 2180 | { "Mic", 0x0 }, |
| 2181 | { "Line", 0x2 }, |
| 2182 | { "CD", 0x4 }, |
| 2183 | { "Input Mix", 0xa }, |
| 2184 | }, |
| 2185 | }, |
| 2186 | { |
| 2187 | .num_items = 4, |
| 2188 | .items = { |
| 2189 | { "Mic", 0x0 }, |
| 2190 | { "Line", 0x2 }, |
| 2191 | { "CD", 0x4 }, |
| 2192 | { "Input Mix", 0xa }, |
| 2193 | }, |
| 2194 | } |
| 2195 | }; |
| 2196 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2197 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2198 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2199 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2200 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2201 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2202 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2203 | HDA_OUTPUT), |
| 2204 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2205 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2206 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2207 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2208 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2209 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2210 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2211 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2212 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2213 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2214 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2215 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2216 | { } /* end */ |
| 2217 | }; |
| 2218 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2219 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2220 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2221 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2223 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2224 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2225 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2226 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2227 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2228 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2229 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2230 | HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2231 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2232 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2233 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2234 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2236 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2237 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2238 | { } /* end */ |
| 2239 | }; |
| 2240 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2241 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2242 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2243 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2244 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2245 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2246 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2247 | HDA_OUTPUT), |
| 2248 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2249 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2250 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2254 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2256 | { } /* end */ |
| 2257 | }; |
| 2258 | |
| 2259 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2260 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2261 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2262 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2263 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2264 | spec->autocfg.hp_pins[0] = 0x15; |
| 2265 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2266 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2267 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2268 | } |
| 2269 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2270 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2271 | { |
| 2272 | struct alc_spec *spec = codec->spec; |
| 2273 | |
| 2274 | spec->autocfg.hp_pins[0] = 0x15; |
| 2275 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2276 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2277 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2278 | } |
| 2279 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2280 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2281 | { |
| 2282 | struct alc_spec *spec = codec->spec; |
| 2283 | |
| 2284 | spec->autocfg.hp_pins[0] = 0x15; |
| 2285 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2286 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2287 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2288 | } |
| 2289 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2290 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2291 | { |
| 2292 | struct alc_spec *spec = codec->spec; |
| 2293 | |
| 2294 | spec->autocfg.hp_pins[0] = 0x15; |
| 2295 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2296 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2297 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2298 | } |
| 2299 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2300 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2301 | * ALC880 3-stack model |
| 2302 | * |
| 2303 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2304 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2305 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2306 | */ |
| 2307 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2308 | static hda_nid_t alc880_dac_nids[4] = { |
| 2309 | /* front, rear, clfe, rear_surr */ |
| 2310 | 0x02, 0x05, 0x04, 0x03 |
| 2311 | }; |
| 2312 | |
| 2313 | static hda_nid_t alc880_adc_nids[3] = { |
| 2314 | /* ADC0-2 */ |
| 2315 | 0x07, 0x08, 0x09, |
| 2316 | }; |
| 2317 | |
| 2318 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2319 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2320 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2321 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2322 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2323 | /* ADC1-2 */ |
| 2324 | 0x08, 0x09, |
| 2325 | }; |
| 2326 | |
| 2327 | #define ALC880_DIGOUT_NID 0x06 |
| 2328 | #define ALC880_DIGIN_NID 0x0a |
| 2329 | |
| 2330 | static struct hda_input_mux alc880_capture_source = { |
| 2331 | .num_items = 4, |
| 2332 | .items = { |
| 2333 | { "Mic", 0x0 }, |
| 2334 | { "Front Mic", 0x3 }, |
| 2335 | { "Line", 0x2 }, |
| 2336 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2337 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2338 | }; |
| 2339 | |
| 2340 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2341 | /* 2ch mode */ |
| 2342 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2343 | /* set line-in to input, mute it */ |
| 2344 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2345 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2346 | /* set mic-in to input vref 80%, mute it */ |
| 2347 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2348 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2349 | { } /* end */ |
| 2350 | }; |
| 2351 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2352 | /* 6ch mode */ |
| 2353 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2354 | /* set line-in to output, unmute it */ |
| 2355 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2356 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2357 | /* set mic-in to output, unmute it */ |
| 2358 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2359 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2360 | { } /* end */ |
| 2361 | }; |
| 2362 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2363 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2364 | { 2, alc880_threestack_ch2_init }, |
| 2365 | { 6, alc880_threestack_ch6_init }, |
| 2366 | }; |
| 2367 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2368 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2369 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2370 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2371 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2372 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2373 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2374 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2375 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2376 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2378 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2379 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2380 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2382 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2383 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2384 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2385 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2386 | { |
| 2387 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2388 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2389 | .info = alc_ch_mode_info, |
| 2390 | .get = alc_ch_mode_get, |
| 2391 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2392 | }, |
| 2393 | { } /* end */ |
| 2394 | }; |
| 2395 | |
| 2396 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2397 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2398 | struct snd_ctl_elem_info *uinfo) |
| 2399 | { |
| 2400 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2401 | struct alc_spec *spec = codec->spec; |
| 2402 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2403 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2404 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2405 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2406 | HDA_INPUT); |
| 2407 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2408 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2409 | return err; |
| 2410 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2411 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2412 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2413 | unsigned int size, unsigned int __user *tlv) |
| 2414 | { |
| 2415 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2416 | struct alc_spec *spec = codec->spec; |
| 2417 | int err; |
| 2418 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2419 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2420 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2421 | HDA_INPUT); |
| 2422 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2423 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2424 | return err; |
| 2425 | } |
| 2426 | |
| 2427 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2428 | struct snd_ctl_elem_value *ucontrol); |
| 2429 | |
| 2430 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2431 | struct snd_ctl_elem_value *ucontrol, |
| 2432 | getput_call_t func) |
| 2433 | { |
| 2434 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2435 | struct alc_spec *spec = codec->spec; |
| 2436 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2437 | int err; |
| 2438 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2439 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2440 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2441 | 3, 0, HDA_INPUT); |
| 2442 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2443 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2444 | return err; |
| 2445 | } |
| 2446 | |
| 2447 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2448 | struct snd_ctl_elem_value *ucontrol) |
| 2449 | { |
| 2450 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2451 | snd_hda_mixer_amp_volume_get); |
| 2452 | } |
| 2453 | |
| 2454 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2455 | struct snd_ctl_elem_value *ucontrol) |
| 2456 | { |
| 2457 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2458 | snd_hda_mixer_amp_volume_put); |
| 2459 | } |
| 2460 | |
| 2461 | /* capture mixer elements */ |
| 2462 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2463 | |
| 2464 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2465 | struct snd_ctl_elem_value *ucontrol) |
| 2466 | { |
| 2467 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2468 | snd_hda_mixer_amp_switch_get); |
| 2469 | } |
| 2470 | |
| 2471 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2472 | struct snd_ctl_elem_value *ucontrol) |
| 2473 | { |
| 2474 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2475 | snd_hda_mixer_amp_switch_put); |
| 2476 | } |
| 2477 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2478 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2479 | { \ |
| 2480 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2481 | .name = "Capture Switch", \ |
| 2482 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2483 | .count = num, \ |
| 2484 | .info = alc_cap_sw_info, \ |
| 2485 | .get = alc_cap_sw_get, \ |
| 2486 | .put = alc_cap_sw_put, \ |
| 2487 | }, \ |
| 2488 | { \ |
| 2489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2490 | .name = "Capture Volume", \ |
| 2491 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2492 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2493 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2494 | .count = num, \ |
| 2495 | .info = alc_cap_vol_info, \ |
| 2496 | .get = alc_cap_vol_get, \ |
| 2497 | .put = alc_cap_vol_put, \ |
| 2498 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2499 | } |
| 2500 | |
| 2501 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2502 | { \ |
| 2503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2504 | /* .name = "Capture Source", */ \ |
| 2505 | .name = "Input Source", \ |
| 2506 | .count = num, \ |
| 2507 | .info = alc_mux_enum_info, \ |
| 2508 | .get = alc_mux_enum_get, \ |
| 2509 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2510 | } |
| 2511 | |
| 2512 | #define DEFINE_CAPMIX(num) \ |
| 2513 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2514 | _DEFINE_CAPMIX(num), \ |
| 2515 | _DEFINE_CAPSRC(num), \ |
| 2516 | { } /* end */ \ |
| 2517 | } |
| 2518 | |
| 2519 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2520 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2521 | _DEFINE_CAPMIX(num), \ |
| 2522 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2523 | } |
| 2524 | |
| 2525 | /* up to three ADCs */ |
| 2526 | DEFINE_CAPMIX(1); |
| 2527 | DEFINE_CAPMIX(2); |
| 2528 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2529 | DEFINE_CAPMIX_NOSRC(1); |
| 2530 | DEFINE_CAPMIX_NOSRC(2); |
| 2531 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2532 | |
| 2533 | /* |
| 2534 | * ALC880 5-stack model |
| 2535 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2536 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2537 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2538 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2539 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2540 | */ |
| 2541 | |
| 2542 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2543 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2545 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2546 | { } /* end */ |
| 2547 | }; |
| 2548 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2549 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2550 | /* 6ch mode */ |
| 2551 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2552 | /* set line-in to input, mute it */ |
| 2553 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2554 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2555 | { } /* end */ |
| 2556 | }; |
| 2557 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2558 | /* 8ch mode */ |
| 2559 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2560 | /* set line-in to output, unmute it */ |
| 2561 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2562 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2563 | { } /* end */ |
| 2564 | }; |
| 2565 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2566 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2567 | { 6, alc880_fivestack_ch6_init }, |
| 2568 | { 8, alc880_fivestack_ch8_init }, |
| 2569 | }; |
| 2570 | |
| 2571 | |
| 2572 | /* |
| 2573 | * ALC880 6-stack model |
| 2574 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2575 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2576 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2577 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2578 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2579 | */ |
| 2580 | |
| 2581 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2582 | /* front, rear, clfe, rear_surr */ |
| 2583 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2584 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2585 | |
| 2586 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2587 | .num_items = 4, |
| 2588 | .items = { |
| 2589 | { "Mic", 0x0 }, |
| 2590 | { "Front Mic", 0x1 }, |
| 2591 | { "Line", 0x2 }, |
| 2592 | { "CD", 0x4 }, |
| 2593 | }, |
| 2594 | }; |
| 2595 | |
| 2596 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2597 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2598 | { 8, NULL }, |
| 2599 | }; |
| 2600 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2601 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2603 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2604 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2605 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2606 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2607 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2608 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2609 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2610 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2611 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2612 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2613 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2614 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2615 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2618 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2619 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2620 | { |
| 2621 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2622 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2623 | .info = alc_ch_mode_info, |
| 2624 | .get = alc_ch_mode_get, |
| 2625 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2626 | }, |
| 2627 | { } /* end */ |
| 2628 | }; |
| 2629 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2630 | |
| 2631 | /* |
| 2632 | * ALC880 W810 model |
| 2633 | * |
| 2634 | * W810 has rear IO for: |
| 2635 | * Front (DAC 02) |
| 2636 | * Surround (DAC 03) |
| 2637 | * Center/LFE (DAC 04) |
| 2638 | * Digital out (06) |
| 2639 | * |
| 2640 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2641 | * 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] | 2642 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2643 | * There is a variable resistor to control the speaker or headphone |
| 2644 | * volume. This is a hardware-only device without a software API. |
| 2645 | * |
| 2646 | * Plugging headphones in will disable the internal speakers. This is |
| 2647 | * implemented in hardware, not via the driver using jack sense. In |
| 2648 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2649 | * disable both the speakers and headphones. |
| 2650 | * |
| 2651 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2652 | * These may not do anything useful with this driver yet, because I |
| 2653 | * haven't setup any initialization verbs for these yet... |
| 2654 | */ |
| 2655 | |
| 2656 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2657 | /* front, rear/surround, clfe */ |
| 2658 | 0x02, 0x03, 0x04 |
| 2659 | }; |
| 2660 | |
| 2661 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2662 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2663 | { 6, NULL } |
| 2664 | }; |
| 2665 | |
| 2666 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2667 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2668 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2669 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2671 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2672 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2673 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2674 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2675 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2676 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2677 | { } /* end */ |
| 2678 | }; |
| 2679 | |
| 2680 | |
| 2681 | /* |
| 2682 | * Z710V model |
| 2683 | * |
| 2684 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2685 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2686 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2687 | */ |
| 2688 | |
| 2689 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2690 | 0x02 |
| 2691 | }; |
| 2692 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2693 | |
| 2694 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2695 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2696 | { 2, NULL } |
| 2697 | }; |
| 2698 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2699 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2700 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2701 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2702 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2703 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2708 | { } /* end */ |
| 2709 | }; |
| 2710 | |
| 2711 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2712 | /* |
| 2713 | * ALC880 F1734 model |
| 2714 | * |
| 2715 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2716 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2717 | */ |
| 2718 | |
| 2719 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2720 | 0x03 |
| 2721 | }; |
| 2722 | #define ALC880_F1734_HP_DAC 0x02 |
| 2723 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2724 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2725 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2726 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2727 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2728 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2729 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2730 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2733 | { } /* end */ |
| 2734 | }; |
| 2735 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2736 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2737 | .num_items = 2, |
| 2738 | .items = { |
| 2739 | { "Mic", 0x1 }, |
| 2740 | { "CD", 0x4 }, |
| 2741 | }, |
| 2742 | }; |
| 2743 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2744 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2745 | /* |
| 2746 | * ALC880 ASUS model |
| 2747 | * |
| 2748 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2749 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2750 | * Mic = 0x18, Line = 0x1a |
| 2751 | */ |
| 2752 | |
| 2753 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2754 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2755 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2756 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2757 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2758 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2759 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2760 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2761 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2762 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2763 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2764 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2765 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2766 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2767 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2768 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2769 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2771 | { |
| 2772 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2773 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2774 | .info = alc_ch_mode_info, |
| 2775 | .get = alc_ch_mode_get, |
| 2776 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2777 | }, |
| 2778 | { } /* end */ |
| 2779 | }; |
| 2780 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2781 | /* |
| 2782 | * ALC880 ASUS W1V model |
| 2783 | * |
| 2784 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2785 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2786 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2787 | */ |
| 2788 | |
| 2789 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2790 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2791 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2792 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2793 | { } /* end */ |
| 2794 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2795 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2796 | /* TCL S700 */ |
| 2797 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2798 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2799 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2800 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2801 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2802 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2805 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2806 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2807 | { } /* end */ |
| 2808 | }; |
| 2809 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2810 | /* Uniwill */ |
| 2811 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2812 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2813 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2814 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2815 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2816 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2817 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2818 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2819 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2820 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2821 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2822 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2823 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2825 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2826 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2827 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2828 | { |
| 2829 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2830 | .name = "Channel Mode", |
| 2831 | .info = alc_ch_mode_info, |
| 2832 | .get = alc_ch_mode_get, |
| 2833 | .put = alc_ch_mode_put, |
| 2834 | }, |
| 2835 | { } /* end */ |
| 2836 | }; |
| 2837 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2838 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2839 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2840 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2841 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2842 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2843 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2844 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2847 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2848 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2849 | { } /* end */ |
| 2850 | }; |
| 2851 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2852 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2853 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2854 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2855 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2856 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2859 | { } /* end */ |
| 2860 | }; |
| 2861 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2862 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2863 | * virtual master controls |
| 2864 | */ |
| 2865 | |
| 2866 | /* |
| 2867 | * slave controls for virtual master |
| 2868 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2869 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2870 | "Front Playback Volume", |
| 2871 | "Surround Playback Volume", |
| 2872 | "Center Playback Volume", |
| 2873 | "LFE Playback Volume", |
| 2874 | "Side Playback Volume", |
| 2875 | "Headphone Playback Volume", |
| 2876 | "Speaker Playback Volume", |
| 2877 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2878 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2879 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2880 | NULL, |
| 2881 | }; |
| 2882 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2883 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2884 | "Front Playback Switch", |
| 2885 | "Surround Playback Switch", |
| 2886 | "Center Playback Switch", |
| 2887 | "LFE Playback Switch", |
| 2888 | "Side Playback Switch", |
| 2889 | "Headphone Playback Switch", |
| 2890 | "Speaker Playback Switch", |
| 2891 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2892 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2893 | "Line-Out Playback Switch", |
| 2894 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2895 | NULL, |
| 2896 | }; |
| 2897 | |
| 2898 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2899 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2900 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2901 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2902 | #define NID_MAPPING (-1) |
| 2903 | |
| 2904 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2905 | #define SUBDEV_HP_ (1 << 6) |
| 2906 | #define SUBDEV_LINE_ (2 << 6) |
| 2907 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2908 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2909 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2910 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2911 | static void alc_free_kctls(struct hda_codec *codec); |
| 2912 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2913 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2914 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2915 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2916 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2917 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2918 | { } /* end */ |
| 2919 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2920 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2921 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2922 | static int alc_build_controls(struct hda_codec *codec) |
| 2923 | { |
| 2924 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2925 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2926 | struct snd_kcontrol_new *knew; |
| 2927 | int i, j, err; |
| 2928 | unsigned int u; |
| 2929 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2930 | |
| 2931 | for (i = 0; i < spec->num_mixers; i++) { |
| 2932 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2933 | if (err < 0) |
| 2934 | return err; |
| 2935 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2936 | if (spec->cap_mixer) { |
| 2937 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2938 | if (err < 0) |
| 2939 | return err; |
| 2940 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2941 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2942 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2943 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2944 | if (err < 0) |
| 2945 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2946 | if (!spec->no_analog) { |
| 2947 | err = snd_hda_create_spdif_share_sw(codec, |
| 2948 | &spec->multiout); |
| 2949 | if (err < 0) |
| 2950 | return err; |
| 2951 | spec->multiout.share_spdif = 1; |
| 2952 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2953 | } |
| 2954 | if (spec->dig_in_nid) { |
| 2955 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2956 | if (err < 0) |
| 2957 | return err; |
| 2958 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2959 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2960 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2961 | /* create beep controls if needed */ |
| 2962 | if (spec->beep_amp) { |
| 2963 | struct snd_kcontrol_new *knew; |
| 2964 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2965 | struct snd_kcontrol *kctl; |
| 2966 | kctl = snd_ctl_new1(knew, codec); |
| 2967 | if (!kctl) |
| 2968 | return -ENOMEM; |
| 2969 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2970 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2971 | if (err < 0) |
| 2972 | return err; |
| 2973 | } |
| 2974 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2975 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2976 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2977 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2978 | if (!spec->no_analog && |
| 2979 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2980 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2981 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2982 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2983 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2984 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2985 | if (err < 0) |
| 2986 | return err; |
| 2987 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2988 | if (!spec->no_analog && |
| 2989 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2990 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2991 | NULL, alc_slave_sws); |
| 2992 | if (err < 0) |
| 2993 | return err; |
| 2994 | } |
| 2995 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2996 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2997 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2998 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2999 | if (!kctl) |
| 3000 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3001 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3002 | hda_nid_t *nids = spec->capsrc_nids; |
| 3003 | if (!nids) |
| 3004 | nids = spec->adc_nids; |
| 3005 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3006 | if (err < 0) |
| 3007 | return err; |
| 3008 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3009 | } |
| 3010 | if (spec->cap_mixer) { |
| 3011 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3012 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3013 | if (kname && strcmp(knew->name, kname) == 0) |
| 3014 | continue; |
| 3015 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3016 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3017 | err = snd_hda_add_nid(codec, kctl, i, |
| 3018 | spec->adc_nids[i]); |
| 3019 | if (err < 0) |
| 3020 | return err; |
| 3021 | } |
| 3022 | } |
| 3023 | } |
| 3024 | |
| 3025 | /* other nid->control mapping */ |
| 3026 | for (i = 0; i < spec->num_mixers; i++) { |
| 3027 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3028 | if (knew->iface != NID_MAPPING) |
| 3029 | continue; |
| 3030 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3031 | if (kctl == NULL) |
| 3032 | continue; |
| 3033 | u = knew->subdevice; |
| 3034 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3035 | nid = u & 0x3f; |
| 3036 | if (nid == 0) |
| 3037 | continue; |
| 3038 | switch (u & 0xc0) { |
| 3039 | case SUBDEV_SPEAKER_: |
| 3040 | nid = spec->autocfg.speaker_pins[nid]; |
| 3041 | break; |
| 3042 | case SUBDEV_LINE_: |
| 3043 | nid = spec->autocfg.line_out_pins[nid]; |
| 3044 | break; |
| 3045 | case SUBDEV_HP_: |
| 3046 | nid = spec->autocfg.hp_pins[nid]; |
| 3047 | break; |
| 3048 | default: |
| 3049 | continue; |
| 3050 | } |
| 3051 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3052 | if (err < 0) |
| 3053 | return err; |
| 3054 | } |
| 3055 | u = knew->private_value; |
| 3056 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3057 | nid = u & 0xff; |
| 3058 | if (nid == 0) |
| 3059 | continue; |
| 3060 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3061 | if (err < 0) |
| 3062 | return err; |
| 3063 | } |
| 3064 | } |
| 3065 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3066 | |
| 3067 | alc_free_kctls(codec); /* no longer needed */ |
| 3068 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3069 | return 0; |
| 3070 | } |
| 3071 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3072 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3073 | /* |
| 3074 | * initialize the codec volumes, etc |
| 3075 | */ |
| 3076 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3077 | /* |
| 3078 | * generic initialization of ADC, input mixers and output mixers |
| 3079 | */ |
| 3080 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3081 | /* |
| 3082 | * Unmute ADC0-2 and set the default input to mic-in |
| 3083 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3084 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3085 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3086 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3088 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3090 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3091 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3092 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3093 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3094 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3095 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3096 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3105 | /* |
| 3106 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3107 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3108 | /* set vol=0 to output mixers */ |
| 3109 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3110 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3112 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3113 | /* set up input amps for analog loopback */ |
| 3114 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3117 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3119 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3122 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3123 | |
| 3124 | { } |
| 3125 | }; |
| 3126 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3127 | /* |
| 3128 | * 3-stack pin configuration: |
| 3129 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3130 | */ |
| 3131 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3132 | /* |
| 3133 | * preset connection lists of input pins |
| 3134 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3135 | */ |
| 3136 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3137 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3138 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3139 | |
| 3140 | /* |
| 3141 | * Set pin mode and muting |
| 3142 | */ |
| 3143 | /* set front pin widgets 0x14 for output */ |
| 3144 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3145 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3146 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3147 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3148 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3149 | /* Mic2 (as headphone out) for HP output */ |
| 3150 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3151 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3152 | /* Line In pin widget for input */ |
| 3153 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3154 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3155 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3156 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3157 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3158 | /* CD pin widget for input */ |
| 3159 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3160 | |
| 3161 | { } |
| 3162 | }; |
| 3163 | |
| 3164 | /* |
| 3165 | * 5-stack pin configuration: |
| 3166 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3167 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3168 | */ |
| 3169 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3170 | /* |
| 3171 | * preset connection lists of input pins |
| 3172 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3173 | */ |
| 3174 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3175 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3176 | |
| 3177 | /* |
| 3178 | * Set pin mode and muting |
| 3179 | */ |
| 3180 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3181 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3182 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3183 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3184 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3185 | /* unmute pins for output (no gain on this amp) */ |
| 3186 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3188 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3189 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3191 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3192 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3193 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3194 | /* Mic2 (as headphone out) for HP output */ |
| 3195 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3196 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3197 | /* Line In pin widget for input */ |
| 3198 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3199 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3200 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3201 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3202 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3203 | /* CD pin widget for input */ |
| 3204 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3205 | |
| 3206 | { } |
| 3207 | }; |
| 3208 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3209 | /* |
| 3210 | * W810 pin configuration: |
| 3211 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3212 | */ |
| 3213 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3214 | /* hphone/speaker input selector: front DAC */ |
| 3215 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3216 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3218 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3220 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3221 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3222 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3223 | |
| 3224 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3225 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3226 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3227 | { } |
| 3228 | }; |
| 3229 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3230 | /* |
| 3231 | * Z71V pin configuration: |
| 3232 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3233 | */ |
| 3234 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3237 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3238 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3239 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3240 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3241 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3242 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3243 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3244 | |
| 3245 | { } |
| 3246 | }; |
| 3247 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3248 | /* |
| 3249 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3250 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3251 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3252 | */ |
| 3253 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3254 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3255 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3257 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3260 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3261 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3262 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3263 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3264 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3265 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3266 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3267 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3269 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3270 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3271 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3272 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3274 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3275 | { } |
| 3276 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3277 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3278 | /* |
| 3279 | * Uniwill pin configuration: |
| 3280 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3281 | * line = 0x1a |
| 3282 | */ |
| 3283 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3284 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3285 | |
| 3286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3287 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3288 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3289 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3290 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3291 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3292 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3293 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3296 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3300 | |
| 3301 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3302 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3303 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3304 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3305 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3306 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3307 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3308 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3309 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3310 | |
| 3311 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3312 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3313 | |
| 3314 | { } |
| 3315 | }; |
| 3316 | |
| 3317 | /* |
| 3318 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3319 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3320 | */ |
| 3321 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3322 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3323 | |
| 3324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3325 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3327 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3328 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3329 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3330 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3333 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3335 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3336 | |
| 3337 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3339 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3340 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3341 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3342 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3343 | |
| 3344 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3345 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3346 | |
| 3347 | { } |
| 3348 | }; |
| 3349 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3350 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3351 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3352 | { } |
| 3353 | }; |
| 3354 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3355 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3356 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3357 | { |
| 3358 | unsigned int present; |
| 3359 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3360 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3361 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3362 | bits = present ? HDA_AMP_MUTE : 0; |
| 3363 | 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] | 3364 | } |
| 3365 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3366 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3367 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3368 | struct alc_spec *spec = codec->spec; |
| 3369 | |
| 3370 | spec->autocfg.hp_pins[0] = 0x14; |
| 3371 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3372 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3373 | } |
| 3374 | |
| 3375 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3376 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3377 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3378 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3379 | } |
| 3380 | |
| 3381 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3382 | unsigned int res) |
| 3383 | { |
| 3384 | /* Looks like the unsol event is incompatible with the standard |
| 3385 | * definition. 4bit tag is placed at 28 bit! |
| 3386 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3387 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3388 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3389 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3390 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3391 | default: |
| 3392 | alc_automute_amp_unsol_event(codec, res); |
| 3393 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3394 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3395 | } |
| 3396 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3397 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3398 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3399 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3400 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3401 | spec->autocfg.hp_pins[0] = 0x14; |
| 3402 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3403 | } |
| 3404 | |
| 3405 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3406 | { |
| 3407 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3408 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3409 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3410 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3411 | present &= HDA_AMP_VOLMASK; |
| 3412 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3413 | HDA_AMP_VOLMASK, present); |
| 3414 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3415 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3416 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3417 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3418 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3419 | unsigned int res) |
| 3420 | { |
| 3421 | /* Looks like the unsol event is incompatible with the standard |
| 3422 | * definition. 4bit tag is placed at 28 bit! |
| 3423 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3424 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3425 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3426 | else |
| 3427 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3428 | } |
| 3429 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3430 | /* |
| 3431 | * F1734 pin configuration: |
| 3432 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3433 | */ |
| 3434 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3435 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3436 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3437 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3438 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3439 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3440 | |
| 3441 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3442 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3443 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3444 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3445 | |
| 3446 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3447 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3448 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3449 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3450 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3451 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3452 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3453 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3454 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3455 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3456 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3457 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3458 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3459 | { } |
| 3460 | }; |
| 3461 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3462 | /* |
| 3463 | * ASUS pin configuration: |
| 3464 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3465 | */ |
| 3466 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3467 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3468 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3469 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3470 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3471 | |
| 3472 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3473 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3474 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3475 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3476 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3477 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3478 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3480 | |
| 3481 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3482 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3483 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3484 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3485 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3486 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3487 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3488 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3489 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3490 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3491 | { } |
| 3492 | }; |
| 3493 | |
| 3494 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3495 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3496 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3497 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3498 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3499 | /* Clevo m520g init */ |
| 3500 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3501 | /* headphone output */ |
| 3502 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3503 | /* line-out */ |
| 3504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3506 | /* Line-in */ |
| 3507 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3508 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3509 | /* CD */ |
| 3510 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3511 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3512 | /* Mic1 (rear panel) */ |
| 3513 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3514 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3515 | /* Mic2 (front panel) */ |
| 3516 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3517 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3518 | /* headphone */ |
| 3519 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3520 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3521 | /* change to EAPD mode */ |
| 3522 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3523 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3524 | |
| 3525 | { } |
| 3526 | }; |
| 3527 | |
| 3528 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3529 | /* change to EAPD mode */ |
| 3530 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3531 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3532 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3533 | /* Headphone output */ |
| 3534 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3535 | /* Front output*/ |
| 3536 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3537 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3538 | |
| 3539 | /* Line In pin widget for input */ |
| 3540 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3541 | /* CD pin widget for input */ |
| 3542 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3543 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3544 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3545 | |
| 3546 | /* change to EAPD mode */ |
| 3547 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3548 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3549 | |
| 3550 | { } |
| 3551 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3552 | |
| 3553 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3554 | * LG m1 express dual |
| 3555 | * |
| 3556 | * Pin assignment: |
| 3557 | * Rear Line-In/Out (blue): 0x14 |
| 3558 | * Build-in Mic-In: 0x15 |
| 3559 | * Speaker-out: 0x17 |
| 3560 | * HP-Out (green): 0x1b |
| 3561 | * Mic-In/Out (red): 0x19 |
| 3562 | * SPDIF-Out: 0x1e |
| 3563 | */ |
| 3564 | |
| 3565 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3566 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3567 | 0x05, 0x02, 0x03 |
| 3568 | }; |
| 3569 | |
| 3570 | /* seems analog CD is not working */ |
| 3571 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3572 | .num_items = 3, |
| 3573 | .items = { |
| 3574 | { "Mic", 0x1 }, |
| 3575 | { "Line", 0x5 }, |
| 3576 | { "Internal Mic", 0x6 }, |
| 3577 | }, |
| 3578 | }; |
| 3579 | |
| 3580 | /* 2,4,6 channel modes */ |
| 3581 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3582 | /* set line-in and mic-in to input */ |
| 3583 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3584 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3585 | { } |
| 3586 | }; |
| 3587 | |
| 3588 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3589 | /* set line-in to out and mic-in to input */ |
| 3590 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3591 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3592 | { } |
| 3593 | }; |
| 3594 | |
| 3595 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3596 | /* set line-in and mic-in to output */ |
| 3597 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3598 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3599 | { } |
| 3600 | }; |
| 3601 | |
| 3602 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3603 | { 2, alc880_lg_ch2_init }, |
| 3604 | { 4, alc880_lg_ch4_init }, |
| 3605 | { 6, alc880_lg_ch6_init }, |
| 3606 | }; |
| 3607 | |
| 3608 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3610 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3611 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3612 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3613 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3614 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3615 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3616 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3618 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3620 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3621 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3622 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3623 | { |
| 3624 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3625 | .name = "Channel Mode", |
| 3626 | .info = alc_ch_mode_info, |
| 3627 | .get = alc_ch_mode_get, |
| 3628 | .put = alc_ch_mode_put, |
| 3629 | }, |
| 3630 | { } /* end */ |
| 3631 | }; |
| 3632 | |
| 3633 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3634 | /* set capture source to mic-in */ |
| 3635 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3636 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3637 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3638 | /* mute all amp mixer inputs */ |
| 3639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3642 | /* line-in to input */ |
| 3643 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3644 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3645 | /* built-in mic */ |
| 3646 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3648 | /* speaker-out */ |
| 3649 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3650 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3651 | /* mic-in to input */ |
| 3652 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3653 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3654 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3655 | /* HP-out */ |
| 3656 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3657 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3658 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3659 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3660 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3661 | { } |
| 3662 | }; |
| 3663 | |
| 3664 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3665 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3666 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3667 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3668 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3669 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3670 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3671 | } |
| 3672 | |
| 3673 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3674 | * LG LW20 |
| 3675 | * |
| 3676 | * Pin assignment: |
| 3677 | * Speaker-out: 0x14 |
| 3678 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3679 | * Built-in Mic-In: 0x19 |
| 3680 | * Line-In: 0x1b |
| 3681 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3682 | * SPDIF-Out: 0x1e |
| 3683 | */ |
| 3684 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3685 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3686 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3687 | .items = { |
| 3688 | { "Mic", 0x0 }, |
| 3689 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3690 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3691 | }, |
| 3692 | }; |
| 3693 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3694 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3695 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3696 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3698 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3699 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3700 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3701 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3702 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3703 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3704 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3705 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3706 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3709 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3710 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3711 | { |
| 3712 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3713 | .name = "Channel Mode", |
| 3714 | .info = alc_ch_mode_info, |
| 3715 | .get = alc_ch_mode_get, |
| 3716 | .put = alc_ch_mode_put, |
| 3717 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3718 | { } /* end */ |
| 3719 | }; |
| 3720 | |
| 3721 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3722 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3723 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3724 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3725 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3726 | /* set capture source to mic-in */ |
| 3727 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3728 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3729 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3730 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3731 | /* speaker-out */ |
| 3732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3734 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3735 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3736 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3737 | /* mic-in to input */ |
| 3738 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3739 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3740 | /* built-in mic */ |
| 3741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3743 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3744 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3745 | { } |
| 3746 | }; |
| 3747 | |
| 3748 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3749 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3750 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3751 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3752 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3753 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3754 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3755 | } |
| 3756 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3757 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3758 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3759 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3760 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3762 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3763 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3764 | { } /* end */ |
| 3765 | }; |
| 3766 | |
| 3767 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3768 | .num_items = 2, |
| 3769 | .items = { |
| 3770 | { "Mic", 0x0 }, |
| 3771 | { "Internal Mic", 0x1 }, |
| 3772 | }, |
| 3773 | }; |
| 3774 | |
| 3775 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3776 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3777 | |
| 3778 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3779 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3780 | |
| 3781 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3782 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3783 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3784 | /* Mic2 (as headphone out) for HP output */ |
| 3785 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3786 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3787 | /* Internal Speaker */ |
| 3788 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3789 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3790 | |
| 3791 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3792 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3793 | |
| 3794 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3795 | { } |
| 3796 | }; |
| 3797 | |
| 3798 | /* toggle speaker-output according to the hp-jack state */ |
| 3799 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3800 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3801 | struct alc_spec *spec = codec->spec; |
| 3802 | alc_automute_amp(codec); |
| 3803 | /* toggle EAPD */ |
| 3804 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3805 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3806 | else |
| 3807 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3808 | } |
| 3809 | |
| 3810 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3811 | unsigned int res) |
| 3812 | { |
| 3813 | /* Looks like the unsol event is incompatible with the standard |
| 3814 | * definition. 4bit tag is placed at 28 bit! |
| 3815 | */ |
| 3816 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3817 | alc880_medion_rim_automute(codec); |
| 3818 | } |
| 3819 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3820 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3821 | { |
| 3822 | struct alc_spec *spec = codec->spec; |
| 3823 | |
| 3824 | spec->autocfg.hp_pins[0] = 0x14; |
| 3825 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3826 | } |
| 3827 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3828 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3829 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3830 | { 0x0b, HDA_INPUT, 0 }, |
| 3831 | { 0x0b, HDA_INPUT, 1 }, |
| 3832 | { 0x0b, HDA_INPUT, 2 }, |
| 3833 | { 0x0b, HDA_INPUT, 3 }, |
| 3834 | { 0x0b, HDA_INPUT, 4 }, |
| 3835 | { } /* end */ |
| 3836 | }; |
| 3837 | |
| 3838 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3839 | { 0x0b, HDA_INPUT, 1 }, |
| 3840 | { 0x0b, HDA_INPUT, 6 }, |
| 3841 | { 0x0b, HDA_INPUT, 7 }, |
| 3842 | { } /* end */ |
| 3843 | }; |
| 3844 | #endif |
| 3845 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3846 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3847 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3848 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3850 | static int alc_init(struct hda_codec *codec) |
| 3851 | { |
| 3852 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3853 | unsigned int i; |
| 3854 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3855 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3856 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3857 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3858 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3859 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3860 | |
| 3861 | if (spec->init_hook) |
| 3862 | spec->init_hook(codec); |
| 3863 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3864 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3865 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3866 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3867 | return 0; |
| 3868 | } |
| 3869 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3870 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3871 | { |
| 3872 | struct alc_spec *spec = codec->spec; |
| 3873 | |
| 3874 | if (spec->unsol_event) |
| 3875 | spec->unsol_event(codec, res); |
| 3876 | } |
| 3877 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3878 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3879 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3880 | { |
| 3881 | struct alc_spec *spec = codec->spec; |
| 3882 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3883 | } |
| 3884 | #endif |
| 3885 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3886 | /* |
| 3887 | * Analog playback callbacks |
| 3888 | */ |
| 3889 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3890 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3891 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3892 | { |
| 3893 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3894 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3895 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3896 | } |
| 3897 | |
| 3898 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3899 | struct hda_codec *codec, |
| 3900 | unsigned int stream_tag, |
| 3901 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3902 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3903 | { |
| 3904 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3905 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3906 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3907 | } |
| 3908 | |
| 3909 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3910 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3911 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3912 | { |
| 3913 | struct alc_spec *spec = codec->spec; |
| 3914 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3915 | } |
| 3916 | |
| 3917 | /* |
| 3918 | * Digital out |
| 3919 | */ |
| 3920 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3921 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3922 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3923 | { |
| 3924 | struct alc_spec *spec = codec->spec; |
| 3925 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3926 | } |
| 3927 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3928 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3929 | struct hda_codec *codec, |
| 3930 | unsigned int stream_tag, |
| 3931 | unsigned int format, |
| 3932 | struct snd_pcm_substream *substream) |
| 3933 | { |
| 3934 | struct alc_spec *spec = codec->spec; |
| 3935 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3936 | stream_tag, format, substream); |
| 3937 | } |
| 3938 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3939 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3940 | struct hda_codec *codec, |
| 3941 | struct snd_pcm_substream *substream) |
| 3942 | { |
| 3943 | struct alc_spec *spec = codec->spec; |
| 3944 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3945 | } |
| 3946 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3947 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3948 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3949 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3950 | { |
| 3951 | struct alc_spec *spec = codec->spec; |
| 3952 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3953 | } |
| 3954 | |
| 3955 | /* |
| 3956 | * Analog capture |
| 3957 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3958 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3959 | struct hda_codec *codec, |
| 3960 | unsigned int stream_tag, |
| 3961 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3962 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3963 | { |
| 3964 | struct alc_spec *spec = codec->spec; |
| 3965 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3966 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3967 | stream_tag, 0, format); |
| 3968 | return 0; |
| 3969 | } |
| 3970 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3971 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3972 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3973 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3974 | { |
| 3975 | struct alc_spec *spec = codec->spec; |
| 3976 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3977 | snd_hda_codec_cleanup_stream(codec, |
| 3978 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3979 | return 0; |
| 3980 | } |
| 3981 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3982 | /* analog capture with dynamic dual-adc changes */ |
| 3983 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3984 | struct hda_codec *codec, |
| 3985 | unsigned int stream_tag, |
| 3986 | unsigned int format, |
| 3987 | struct snd_pcm_substream *substream) |
| 3988 | { |
| 3989 | struct alc_spec *spec = codec->spec; |
| 3990 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3991 | spec->cur_adc_stream_tag = stream_tag; |
| 3992 | spec->cur_adc_format = format; |
| 3993 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3994 | return 0; |
| 3995 | } |
| 3996 | |
| 3997 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3998 | struct hda_codec *codec, |
| 3999 | struct snd_pcm_substream *substream) |
| 4000 | { |
| 4001 | struct alc_spec *spec = codec->spec; |
| 4002 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4003 | spec->cur_adc = 0; |
| 4004 | return 0; |
| 4005 | } |
| 4006 | |
| 4007 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4008 | .substreams = 1, |
| 4009 | .channels_min = 2, |
| 4010 | .channels_max = 2, |
| 4011 | .nid = 0, /* fill later */ |
| 4012 | .ops = { |
| 4013 | .prepare = dualmic_capture_pcm_prepare, |
| 4014 | .cleanup = dualmic_capture_pcm_cleanup |
| 4015 | }, |
| 4016 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4017 | |
| 4018 | /* |
| 4019 | */ |
| 4020 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4021 | .substreams = 1, |
| 4022 | .channels_min = 2, |
| 4023 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4024 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4025 | .ops = { |
| 4026 | .open = alc880_playback_pcm_open, |
| 4027 | .prepare = alc880_playback_pcm_prepare, |
| 4028 | .cleanup = alc880_playback_pcm_cleanup |
| 4029 | }, |
| 4030 | }; |
| 4031 | |
| 4032 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4033 | .substreams = 1, |
| 4034 | .channels_min = 2, |
| 4035 | .channels_max = 2, |
| 4036 | /* NID is set in alc_build_pcms */ |
| 4037 | }; |
| 4038 | |
| 4039 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4040 | .substreams = 1, |
| 4041 | .channels_min = 2, |
| 4042 | .channels_max = 2, |
| 4043 | /* NID is set in alc_build_pcms */ |
| 4044 | }; |
| 4045 | |
| 4046 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4047 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4048 | .channels_min = 2, |
| 4049 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4050 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4051 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4052 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4053 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4054 | }, |
| 4055 | }; |
| 4056 | |
| 4057 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4058 | .substreams = 1, |
| 4059 | .channels_min = 2, |
| 4060 | .channels_max = 2, |
| 4061 | /* NID is set in alc_build_pcms */ |
| 4062 | .ops = { |
| 4063 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4064 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4065 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4066 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4067 | }, |
| 4068 | }; |
| 4069 | |
| 4070 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4071 | .substreams = 1, |
| 4072 | .channels_min = 2, |
| 4073 | .channels_max = 2, |
| 4074 | /* NID is set in alc_build_pcms */ |
| 4075 | }; |
| 4076 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4077 | /* 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] | 4078 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4079 | .substreams = 0, |
| 4080 | .channels_min = 0, |
| 4081 | .channels_max = 0, |
| 4082 | }; |
| 4083 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4084 | static int alc_build_pcms(struct hda_codec *codec) |
| 4085 | { |
| 4086 | struct alc_spec *spec = codec->spec; |
| 4087 | struct hda_pcm *info = spec->pcm_rec; |
| 4088 | int i; |
| 4089 | |
| 4090 | codec->num_pcms = 1; |
| 4091 | codec->pcm_info = info; |
| 4092 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4093 | if (spec->no_analog) |
| 4094 | goto skip_analog; |
| 4095 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4096 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4097 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4098 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4099 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4100 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4101 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4102 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4103 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4104 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4105 | } |
| 4106 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4107 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4108 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4109 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4110 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4111 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4112 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4113 | if (spec->channel_mode) { |
| 4114 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4115 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4116 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4117 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4118 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4119 | } |
| 4120 | } |
| 4121 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4122 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4123 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4124 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4125 | snprintf(spec->stream_name_digital, |
| 4126 | sizeof(spec->stream_name_digital), |
| 4127 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4128 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4129 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4130 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4131 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4132 | if (spec->dig_out_type) |
| 4133 | info->pcm_type = spec->dig_out_type; |
| 4134 | else |
| 4135 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4136 | if (spec->multiout.dig_out_nid && |
| 4137 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4138 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4139 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4140 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4141 | if (spec->dig_in_nid && |
| 4142 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4143 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4144 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4145 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4146 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4147 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4148 | } |
| 4149 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4150 | if (spec->no_analog) |
| 4151 | return 0; |
| 4152 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4153 | /* If the use of more than one ADC is requested for the current |
| 4154 | * model, configure a second analog capture-only PCM. |
| 4155 | */ |
| 4156 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4157 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4158 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4159 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4160 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4161 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4162 | if (spec->alt_dac_nid) { |
| 4163 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4164 | *spec->stream_analog_alt_playback; |
| 4165 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4166 | spec->alt_dac_nid; |
| 4167 | } else { |
| 4168 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4169 | alc_pcm_null_stream; |
| 4170 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4171 | } |
| 4172 | if (spec->num_adc_nids > 1) { |
| 4173 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4174 | *spec->stream_analog_alt_capture; |
| 4175 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4176 | spec->adc_nids[1]; |
| 4177 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4178 | spec->num_adc_nids - 1; |
| 4179 | } else { |
| 4180 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4181 | alc_pcm_null_stream; |
| 4182 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4183 | } |
| 4184 | } |
| 4185 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4186 | return 0; |
| 4187 | } |
| 4188 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4189 | static inline void alc_shutup(struct hda_codec *codec) |
| 4190 | { |
| 4191 | snd_hda_shutup_pins(codec); |
| 4192 | } |
| 4193 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4194 | static void alc_free_kctls(struct hda_codec *codec) |
| 4195 | { |
| 4196 | struct alc_spec *spec = codec->spec; |
| 4197 | |
| 4198 | if (spec->kctls.list) { |
| 4199 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4200 | int i; |
| 4201 | for (i = 0; i < spec->kctls.used; i++) |
| 4202 | kfree(kctl[i].name); |
| 4203 | } |
| 4204 | snd_array_free(&spec->kctls); |
| 4205 | } |
| 4206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4207 | static void alc_free(struct hda_codec *codec) |
| 4208 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4209 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4210 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4211 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4212 | return; |
| 4213 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4214 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4215 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4216 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4217 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4218 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4219 | } |
| 4220 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4221 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4222 | static void alc_power_eapd(struct hda_codec *codec) |
| 4223 | { |
| 4224 | /* We currently only handle front, HP */ |
| 4225 | switch (codec->vendor_id) { |
| 4226 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4227 | set_eapd(codec, 0x0f, 0); |
| 4228 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4229 | break; |
| 4230 | case 0x10ec0262: |
| 4231 | case 0x10ec0267: |
| 4232 | case 0x10ec0268: |
| 4233 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4234 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4235 | case 0x10ec0272: |
| 4236 | case 0x10ec0660: |
| 4237 | case 0x10ec0662: |
| 4238 | case 0x10ec0663: |
| 4239 | case 0x10ec0862: |
| 4240 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 4241 | set_eapd(codec, 0x14, 0); |
| 4242 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4243 | break; |
| 4244 | } |
| 4245 | } |
| 4246 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4247 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4248 | { |
| 4249 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4250 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4251 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4252 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4253 | return 0; |
| 4254 | } |
| 4255 | #endif |
| 4256 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4257 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4258 | static int alc_resume(struct hda_codec *codec) |
| 4259 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4260 | codec->patch_ops.init(codec); |
| 4261 | snd_hda_codec_resume_amp(codec); |
| 4262 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4263 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4264 | return 0; |
| 4265 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4266 | #endif |
| 4267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4268 | /* |
| 4269 | */ |
| 4270 | static struct hda_codec_ops alc_patch_ops = { |
| 4271 | .build_controls = alc_build_controls, |
| 4272 | .build_pcms = alc_build_pcms, |
| 4273 | .init = alc_init, |
| 4274 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4275 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4276 | #ifdef SND_HDA_NEEDS_RESUME |
| 4277 | .resume = alc_resume, |
| 4278 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4279 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4280 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4281 | .check_power_status = alc_check_power_status, |
| 4282 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4283 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4284 | }; |
| 4285 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4286 | /* replace the codec chip_name with the given string */ |
| 4287 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4288 | { |
| 4289 | kfree(codec->chip_name); |
| 4290 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4291 | if (!codec->chip_name) { |
| 4292 | alc_free(codec); |
| 4293 | return -ENOMEM; |
| 4294 | } |
| 4295 | return 0; |
| 4296 | } |
| 4297 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4298 | /* |
| 4299 | * Test configuration for debugging |
| 4300 | * |
| 4301 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4302 | * enum controls. |
| 4303 | */ |
| 4304 | #ifdef CONFIG_SND_DEBUG |
| 4305 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4306 | 0x02, 0x03, 0x04, 0x05 |
| 4307 | }; |
| 4308 | |
| 4309 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4310 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4311 | .items = { |
| 4312 | { "In-1", 0x0 }, |
| 4313 | { "In-2", 0x1 }, |
| 4314 | { "In-3", 0x2 }, |
| 4315 | { "In-4", 0x3 }, |
| 4316 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4317 | { "Front", 0x5 }, |
| 4318 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4319 | }, |
| 4320 | }; |
| 4321 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4322 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4323 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4324 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4325 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4326 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4327 | }; |
| 4328 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4329 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4330 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4331 | { |
| 4332 | static char *texts[] = { |
| 4333 | "N/A", "Line Out", "HP Out", |
| 4334 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4335 | }; |
| 4336 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4337 | uinfo->count = 1; |
| 4338 | uinfo->value.enumerated.items = 8; |
| 4339 | if (uinfo->value.enumerated.item >= 8) |
| 4340 | uinfo->value.enumerated.item = 7; |
| 4341 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4342 | return 0; |
| 4343 | } |
| 4344 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4345 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4346 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4347 | { |
| 4348 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4349 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4350 | unsigned int pin_ctl, item = 0; |
| 4351 | |
| 4352 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4353 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4354 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4355 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4356 | item = 2; |
| 4357 | else |
| 4358 | item = 1; |
| 4359 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4360 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4361 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4362 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4363 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4364 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4365 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4366 | } |
| 4367 | } |
| 4368 | ucontrol->value.enumerated.item[0] = item; |
| 4369 | return 0; |
| 4370 | } |
| 4371 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4372 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4373 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4374 | { |
| 4375 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4376 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4377 | static unsigned int ctls[] = { |
| 4378 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4379 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4380 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4381 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4382 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4383 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4384 | }; |
| 4385 | unsigned int old_ctl, new_ctl; |
| 4386 | |
| 4387 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4388 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4389 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4390 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4391 | int val; |
| 4392 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4393 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4394 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4395 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4396 | HDA_AMP_MUTE : 0; |
| 4397 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4398 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4399 | return 1; |
| 4400 | } |
| 4401 | return 0; |
| 4402 | } |
| 4403 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4404 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4405 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4406 | { |
| 4407 | static char *texts[] = { |
| 4408 | "Front", "Surround", "CLFE", "Side" |
| 4409 | }; |
| 4410 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4411 | uinfo->count = 1; |
| 4412 | uinfo->value.enumerated.items = 4; |
| 4413 | if (uinfo->value.enumerated.item >= 4) |
| 4414 | uinfo->value.enumerated.item = 3; |
| 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_src_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 sel; |
| 4425 | |
| 4426 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4427 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4428 | return 0; |
| 4429 | } |
| 4430 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4431 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4432 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4433 | { |
| 4434 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4435 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4436 | unsigned int sel; |
| 4437 | |
| 4438 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4439 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4440 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4441 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4442 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4443 | return 1; |
| 4444 | } |
| 4445 | return 0; |
| 4446 | } |
| 4447 | |
| 4448 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4449 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4450 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4451 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4452 | .info = alc_test_pin_ctl_info, \ |
| 4453 | .get = alc_test_pin_ctl_get, \ |
| 4454 | .put = alc_test_pin_ctl_put, \ |
| 4455 | .private_value = nid \ |
| 4456 | } |
| 4457 | |
| 4458 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4459 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4460 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4461 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4462 | .info = alc_test_pin_src_info, \ |
| 4463 | .get = alc_test_pin_src_get, \ |
| 4464 | .put = alc_test_pin_src_put, \ |
| 4465 | .private_value = nid \ |
| 4466 | } |
| 4467 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4468 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4469 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4470 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4471 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4472 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4473 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4474 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4475 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4476 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4477 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4478 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4479 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4480 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4481 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4482 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4483 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4484 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4485 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4486 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4487 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4488 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4489 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4490 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4491 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4492 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4493 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4494 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4495 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4496 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4497 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4498 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4499 | { |
| 4500 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4501 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4502 | .info = alc_ch_mode_info, |
| 4503 | .get = alc_ch_mode_get, |
| 4504 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4505 | }, |
| 4506 | { } /* end */ |
| 4507 | }; |
| 4508 | |
| 4509 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4510 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4511 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4513 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4514 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4515 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4516 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4517 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4518 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4519 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4520 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4523 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4524 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4525 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4526 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4527 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4528 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4529 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4530 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4531 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4532 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4533 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4534 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4535 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4536 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4537 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4538 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4539 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4540 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4541 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4542 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4543 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4544 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4545 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4547 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4548 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4549 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4551 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4552 | /* Analog input/passthru */ |
| 4553 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4554 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4555 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4556 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4557 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4558 | { } |
| 4559 | }; |
| 4560 | #endif |
| 4561 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4562 | /* |
| 4563 | */ |
| 4564 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4565 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4566 | [ALC880_3ST] = "3stack", |
| 4567 | [ALC880_TCL_S700] = "tcl", |
| 4568 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4569 | [ALC880_CLEVO] = "clevo", |
| 4570 | [ALC880_5ST] = "5stack", |
| 4571 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4572 | [ALC880_W810] = "w810", |
| 4573 | [ALC880_Z71V] = "z71v", |
| 4574 | [ALC880_6ST] = "6stack", |
| 4575 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4576 | [ALC880_ASUS] = "asus", |
| 4577 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4578 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4579 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4580 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4581 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4582 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4583 | [ALC880_F1734] = "F1734", |
| 4584 | [ALC880_LG] = "lg", |
| 4585 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4586 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4587 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4588 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4589 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4590 | [ALC880_AUTO] = "auto", |
| 4591 | }; |
| 4592 | |
| 4593 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4594 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4595 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4596 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4597 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4598 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4599 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4600 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4601 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4602 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4603 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4604 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4605 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4606 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4607 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4608 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4609 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4610 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4611 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4612 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4613 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4614 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4615 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4616 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4617 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4618 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4619 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4620 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4621 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4622 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4623 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4624 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4625 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4626 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4627 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4628 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4629 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4630 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4631 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4632 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4633 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4634 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4635 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4636 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4637 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4638 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4639 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4640 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4641 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4642 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4643 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4644 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4645 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4646 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4647 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4648 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4649 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4650 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4651 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4652 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4653 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4654 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4655 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4656 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4657 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4658 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4659 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4660 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4661 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4662 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4663 | /* default Intel */ |
| 4664 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4665 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4666 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4667 | {} |
| 4668 | }; |
| 4669 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4670 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4671 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4672 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4673 | static struct alc_config_preset alc880_presets[] = { |
| 4674 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4675 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4676 | .init_verbs = { alc880_volume_init_verbs, |
| 4677 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4678 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4679 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4680 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4681 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4682 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4683 | .input_mux = &alc880_capture_source, |
| 4684 | }, |
| 4685 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4686 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4687 | .init_verbs = { alc880_volume_init_verbs, |
| 4688 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4689 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4690 | .dac_nids = alc880_dac_nids, |
| 4691 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4692 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4693 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4694 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4695 | .input_mux = &alc880_capture_source, |
| 4696 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4697 | [ALC880_TCL_S700] = { |
| 4698 | .mixers = { alc880_tcl_s700_mixer }, |
| 4699 | .init_verbs = { alc880_volume_init_verbs, |
| 4700 | alc880_pin_tcl_S700_init_verbs, |
| 4701 | alc880_gpio2_init_verbs }, |
| 4702 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4703 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4704 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4705 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4706 | .hp_nid = 0x03, |
| 4707 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4708 | .channel_mode = alc880_2_jack_modes, |
| 4709 | .input_mux = &alc880_capture_source, |
| 4710 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4711 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4712 | .mixers = { alc880_three_stack_mixer, |
| 4713 | alc880_five_stack_mixer}, |
| 4714 | .init_verbs = { alc880_volume_init_verbs, |
| 4715 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4716 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4717 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4718 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4719 | .channel_mode = alc880_fivestack_modes, |
| 4720 | .input_mux = &alc880_capture_source, |
| 4721 | }, |
| 4722 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4723 | .mixers = { alc880_three_stack_mixer, |
| 4724 | alc880_five_stack_mixer }, |
| 4725 | .init_verbs = { alc880_volume_init_verbs, |
| 4726 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4727 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4728 | .dac_nids = alc880_dac_nids, |
| 4729 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4730 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4731 | .channel_mode = alc880_fivestack_modes, |
| 4732 | .input_mux = &alc880_capture_source, |
| 4733 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4734 | [ALC880_6ST] = { |
| 4735 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4736 | .init_verbs = { alc880_volume_init_verbs, |
| 4737 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4738 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4739 | .dac_nids = alc880_6st_dac_nids, |
| 4740 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4741 | .channel_mode = alc880_sixstack_modes, |
| 4742 | .input_mux = &alc880_6stack_capture_source, |
| 4743 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4744 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4745 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4746 | .init_verbs = { alc880_volume_init_verbs, |
| 4747 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4748 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4749 | .dac_nids = alc880_6st_dac_nids, |
| 4750 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4751 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4752 | .channel_mode = alc880_sixstack_modes, |
| 4753 | .input_mux = &alc880_6stack_capture_source, |
| 4754 | }, |
| 4755 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4756 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4757 | .init_verbs = { alc880_volume_init_verbs, |
| 4758 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4759 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4760 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4761 | .dac_nids = alc880_w810_dac_nids, |
| 4762 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4763 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4764 | .channel_mode = alc880_w810_modes, |
| 4765 | .input_mux = &alc880_capture_source, |
| 4766 | }, |
| 4767 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4768 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4769 | .init_verbs = { alc880_volume_init_verbs, |
| 4770 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4771 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4772 | .dac_nids = alc880_z71v_dac_nids, |
| 4773 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4774 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4775 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4776 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4777 | .input_mux = &alc880_capture_source, |
| 4778 | }, |
| 4779 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4780 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4781 | .init_verbs = { alc880_volume_init_verbs, |
| 4782 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4783 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4784 | .dac_nids = alc880_f1734_dac_nids, |
| 4785 | .hp_nid = 0x02, |
| 4786 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4787 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4788 | .input_mux = &alc880_f1734_capture_source, |
| 4789 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4790 | .setup = alc880_uniwill_p53_setup, |
| 4791 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4792 | }, |
| 4793 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4794 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4795 | .init_verbs = { alc880_volume_init_verbs, |
| 4796 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4797 | alc880_gpio1_init_verbs }, |
| 4798 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4799 | .dac_nids = alc880_asus_dac_nids, |
| 4800 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4801 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4802 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4803 | .input_mux = &alc880_capture_source, |
| 4804 | }, |
| 4805 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4806 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4807 | .init_verbs = { alc880_volume_init_verbs, |
| 4808 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4809 | alc880_gpio1_init_verbs }, |
| 4810 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4811 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4812 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4813 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4814 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4815 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4816 | .input_mux = &alc880_capture_source, |
| 4817 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4818 | [ALC880_ASUS_DIG2] = { |
| 4819 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4820 | .init_verbs = { alc880_volume_init_verbs, |
| 4821 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4822 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4823 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4824 | .dac_nids = alc880_asus_dac_nids, |
| 4825 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4826 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4827 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4828 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4829 | .input_mux = &alc880_capture_source, |
| 4830 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4831 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4832 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4833 | .init_verbs = { alc880_volume_init_verbs, |
| 4834 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4835 | alc880_gpio1_init_verbs }, |
| 4836 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4837 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4838 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4839 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4840 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4841 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4842 | .input_mux = &alc880_capture_source, |
| 4843 | }, |
| 4844 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4845 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4846 | .init_verbs = { alc880_volume_init_verbs, |
| 4847 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4848 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4849 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4850 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4851 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4852 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4853 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4854 | .input_mux = &alc880_capture_source, |
| 4855 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4856 | [ALC880_UNIWILL] = { |
| 4857 | .mixers = { alc880_uniwill_mixer }, |
| 4858 | .init_verbs = { alc880_volume_init_verbs, |
| 4859 | alc880_uniwill_init_verbs }, |
| 4860 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4861 | .dac_nids = alc880_asus_dac_nids, |
| 4862 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4863 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4864 | .channel_mode = alc880_threestack_modes, |
| 4865 | .need_dac_fix = 1, |
| 4866 | .input_mux = &alc880_capture_source, |
| 4867 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4868 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4869 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4870 | }, |
| 4871 | [ALC880_UNIWILL_P53] = { |
| 4872 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4873 | .init_verbs = { alc880_volume_init_verbs, |
| 4874 | alc880_uniwill_p53_init_verbs }, |
| 4875 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4876 | .dac_nids = alc880_asus_dac_nids, |
| 4877 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4878 | .channel_mode = alc880_threestack_modes, |
| 4879 | .input_mux = &alc880_capture_source, |
| 4880 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4881 | .setup = alc880_uniwill_p53_setup, |
| 4882 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4883 | }, |
| 4884 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4885 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4886 | .init_verbs = { alc880_volume_init_verbs, |
| 4887 | alc880_uniwill_p53_init_verbs, |
| 4888 | alc880_beep_init_verbs }, |
| 4889 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4890 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4891 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4892 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4893 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4894 | .input_mux = &alc880_capture_source, |
| 4895 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4896 | .setup = alc880_uniwill_p53_setup, |
| 4897 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4898 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4899 | [ALC880_CLEVO] = { |
| 4900 | .mixers = { alc880_three_stack_mixer }, |
| 4901 | .init_verbs = { alc880_volume_init_verbs, |
| 4902 | alc880_pin_clevo_init_verbs }, |
| 4903 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4904 | .dac_nids = alc880_dac_nids, |
| 4905 | .hp_nid = 0x03, |
| 4906 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4907 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4908 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4909 | .input_mux = &alc880_capture_source, |
| 4910 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4911 | [ALC880_LG] = { |
| 4912 | .mixers = { alc880_lg_mixer }, |
| 4913 | .init_verbs = { alc880_volume_init_verbs, |
| 4914 | alc880_lg_init_verbs }, |
| 4915 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4916 | .dac_nids = alc880_lg_dac_nids, |
| 4917 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4918 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4919 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4920 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4921 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4922 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4923 | .setup = alc880_lg_setup, |
| 4924 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4925 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4926 | .loopbacks = alc880_lg_loopbacks, |
| 4927 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4928 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4929 | [ALC880_LG_LW] = { |
| 4930 | .mixers = { alc880_lg_lw_mixer }, |
| 4931 | .init_verbs = { alc880_volume_init_verbs, |
| 4932 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4933 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4934 | .dac_nids = alc880_dac_nids, |
| 4935 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4936 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4937 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4938 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4939 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4940 | .setup = alc880_lg_lw_setup, |
| 4941 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4942 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4943 | [ALC880_MEDION_RIM] = { |
| 4944 | .mixers = { alc880_medion_rim_mixer }, |
| 4945 | .init_verbs = { alc880_volume_init_verbs, |
| 4946 | alc880_medion_rim_init_verbs, |
| 4947 | alc_gpio2_init_verbs }, |
| 4948 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4949 | .dac_nids = alc880_dac_nids, |
| 4950 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4951 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4952 | .channel_mode = alc880_2_jack_modes, |
| 4953 | .input_mux = &alc880_medion_rim_capture_source, |
| 4954 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4955 | .setup = alc880_medion_rim_setup, |
| 4956 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4957 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4958 | #ifdef CONFIG_SND_DEBUG |
| 4959 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4960 | .mixers = { alc880_test_mixer }, |
| 4961 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4962 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4963 | .dac_nids = alc880_test_dac_nids, |
| 4964 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4965 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4966 | .channel_mode = alc880_test_modes, |
| 4967 | .input_mux = &alc880_test_capture_source, |
| 4968 | }, |
| 4969 | #endif |
| 4970 | }; |
| 4971 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4972 | /* |
| 4973 | * Automatic parse of I/O pins from the BIOS configuration |
| 4974 | */ |
| 4975 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4976 | enum { |
| 4977 | ALC_CTL_WIDGET_VOL, |
| 4978 | ALC_CTL_WIDGET_MUTE, |
| 4979 | ALC_CTL_BIND_MUTE, |
| 4980 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4981 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4982 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4983 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4984 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4985 | }; |
| 4986 | |
| 4987 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4988 | 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] | 4989 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4990 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4991 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4992 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4993 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4994 | knew = snd_array_new(&spec->kctls); |
| 4995 | if (!knew) |
| 4996 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4997 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4998 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4999 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5000 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5001 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5002 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5003 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5004 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5005 | return 0; |
| 5006 | } |
| 5007 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5008 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5009 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5010 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5011 | { |
| 5012 | char name[32]; |
| 5013 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5014 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5015 | } |
| 5016 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5017 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5018 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5019 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5020 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5021 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5022 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5023 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5024 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5025 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5026 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5027 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5028 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5029 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5030 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5031 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5032 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5033 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5034 | #define ALC880_PIN_CD_NID 0x1c |
| 5035 | |
| 5036 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5037 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5038 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5039 | { |
| 5040 | hda_nid_t nid; |
| 5041 | int assigned[4]; |
| 5042 | int i, j; |
| 5043 | |
| 5044 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5045 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5046 | |
| 5047 | /* check the pins hardwired to audio widget */ |
| 5048 | for (i = 0; i < cfg->line_outs; i++) { |
| 5049 | nid = cfg->line_out_pins[i]; |
| 5050 | if (alc880_is_fixed_pin(nid)) { |
| 5051 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5052 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5053 | assigned[idx] = 1; |
| 5054 | } |
| 5055 | } |
| 5056 | /* left pins can be connect to any audio widget */ |
| 5057 | for (i = 0; i < cfg->line_outs; i++) { |
| 5058 | nid = cfg->line_out_pins[i]; |
| 5059 | if (alc880_is_fixed_pin(nid)) |
| 5060 | continue; |
| 5061 | /* search for an empty channel */ |
| 5062 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5063 | if (!assigned[j]) { |
| 5064 | spec->multiout.dac_nids[i] = |
| 5065 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5066 | assigned[j] = 1; |
| 5067 | break; |
| 5068 | } |
| 5069 | } |
| 5070 | } |
| 5071 | spec->multiout.num_dacs = cfg->line_outs; |
| 5072 | return 0; |
| 5073 | } |
| 5074 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5075 | static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, |
| 5076 | bool can_be_master) |
| 5077 | { |
| 5078 | if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
| 5079 | return "Master"; |
| 5080 | |
| 5081 | switch (cfg->line_out_type) { |
| 5082 | case AUTO_PIN_SPEAKER_OUT: |
| 5083 | return "Speaker"; |
| 5084 | case AUTO_PIN_HP_OUT: |
| 5085 | return "Headphone"; |
| 5086 | default: |
| 5087 | if (cfg->line_outs == 1) |
| 5088 | return "PCM"; |
| 5089 | break; |
| 5090 | } |
| 5091 | return NULL; |
| 5092 | } |
| 5093 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5094 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5095 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5096 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5097 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5098 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5099 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5100 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5101 | const char *pfx = alc_get_line_out_pfx(cfg, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5102 | hda_nid_t nid; |
| 5103 | int i, err; |
| 5104 | |
| 5105 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5106 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5107 | continue; |
| 5108 | 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] | 5109 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5110 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5111 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5112 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5113 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5114 | HDA_OUTPUT)); |
| 5115 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5116 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5117 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5118 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5119 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5120 | HDA_OUTPUT)); |
| 5121 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5122 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5123 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5124 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5125 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5126 | HDA_INPUT)); |
| 5127 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5128 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5129 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5130 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5131 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5132 | HDA_INPUT)); |
| 5133 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5134 | return err; |
| 5135 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5136 | const char *name = pfx; |
| 5137 | if (!name) |
| 5138 | name = chname[i]; |
| 5139 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5140 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5141 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5142 | HDA_OUTPUT)); |
| 5143 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5144 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5145 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5146 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5147 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5148 | HDA_INPUT)); |
| 5149 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5150 | return err; |
| 5151 | } |
| 5152 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5153 | return 0; |
| 5154 | } |
| 5155 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5156 | /* add playback controls for speaker and HP outputs */ |
| 5157 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5158 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5159 | { |
| 5160 | hda_nid_t nid; |
| 5161 | int err; |
| 5162 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5163 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5164 | return 0; |
| 5165 | |
| 5166 | if (alc880_is_fixed_pin(pin)) { |
| 5167 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5168 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5169 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5170 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5171 | else |
| 5172 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5173 | /* control HP volume/switch on the output mixer amp */ |
| 5174 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5175 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5176 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5177 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5178 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5179 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5180 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5181 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5182 | return err; |
| 5183 | } else if (alc880_is_multi_pin(pin)) { |
| 5184 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5185 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5186 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5187 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5188 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5189 | return err; |
| 5190 | } |
| 5191 | return 0; |
| 5192 | } |
| 5193 | |
| 5194 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5195 | 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] | 5196 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5197 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5198 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5199 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5200 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5201 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5202 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5203 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5204 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5205 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5206 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5207 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5208 | return err; |
| 5209 | return 0; |
| 5210 | } |
| 5211 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5212 | 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] | 5213 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5214 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5215 | return (pincap & AC_PINCAP_IN) != 0; |
| 5216 | } |
| 5217 | |
| 5218 | /* create playback/capture controls for input pins */ |
| 5219 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5220 | const struct auto_pin_cfg *cfg, |
| 5221 | hda_nid_t mixer, |
| 5222 | hda_nid_t cap1, hda_nid_t cap2) |
| 5223 | { |
| 5224 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5225 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5226 | int i, err, idx, type_idx = 0; |
| 5227 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5228 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5229 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5230 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5231 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5232 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5233 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5234 | if (!alc_is_input_pin(codec, pin)) |
| 5235 | continue; |
| 5236 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5237 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5238 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5239 | type_idx++; |
| 5240 | else |
| 5241 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5242 | prev_label = label; |
| 5243 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5244 | if (mixer) { |
| 5245 | idx = get_connection_index(codec, mixer, pin); |
| 5246 | if (idx >= 0) { |
| 5247 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5248 | label, type_idx, |
| 5249 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5250 | if (err < 0) |
| 5251 | return err; |
| 5252 | } |
| 5253 | } |
| 5254 | |
| 5255 | if (!cap1) |
| 5256 | continue; |
| 5257 | idx = get_connection_index(codec, cap1, pin); |
| 5258 | if (idx < 0 && cap2) |
| 5259 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5260 | if (idx >= 0) |
| 5261 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5262 | } |
| 5263 | return 0; |
| 5264 | } |
| 5265 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5266 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5267 | const struct auto_pin_cfg *cfg) |
| 5268 | { |
| 5269 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5270 | } |
| 5271 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5272 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5273 | unsigned int pin_type) |
| 5274 | { |
| 5275 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5276 | pin_type); |
| 5277 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5278 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5279 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5280 | } |
| 5281 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5282 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5283 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5284 | int dac_idx) |
| 5285 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5286 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5287 | /* need the manual connection? */ |
| 5288 | if (alc880_is_multi_pin(nid)) { |
| 5289 | struct alc_spec *spec = codec->spec; |
| 5290 | int idx = alc880_multi_pin_idx(nid); |
| 5291 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5292 | AC_VERB_SET_CONNECT_SEL, |
| 5293 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5294 | } |
| 5295 | } |
| 5296 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5297 | static int get_pin_type(int line_out_type) |
| 5298 | { |
| 5299 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5300 | return PIN_HP; |
| 5301 | else |
| 5302 | return PIN_OUT; |
| 5303 | } |
| 5304 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5305 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5306 | { |
| 5307 | struct alc_spec *spec = codec->spec; |
| 5308 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5309 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5310 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5311 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5312 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5313 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5314 | } |
| 5315 | } |
| 5316 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5317 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5318 | { |
| 5319 | struct alc_spec *spec = codec->spec; |
| 5320 | hda_nid_t pin; |
| 5321 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5322 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5323 | if (pin) /* connect to front */ |
| 5324 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5325 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5326 | if (pin) /* connect to front */ |
| 5327 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5328 | } |
| 5329 | |
| 5330 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5331 | { |
| 5332 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5333 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5334 | int i; |
| 5335 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5336 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5337 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5338 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5339 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5340 | if (nid != ALC880_PIN_CD_NID && |
| 5341 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5342 | snd_hda_codec_write(codec, nid, 0, |
| 5343 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5344 | AMP_OUT_MUTE); |
| 5345 | } |
| 5346 | } |
| 5347 | } |
| 5348 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5349 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5350 | { |
| 5351 | struct alc_spec *spec = codec->spec; |
| 5352 | int c; |
| 5353 | |
| 5354 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5355 | unsigned int mux_idx; |
| 5356 | const struct hda_input_mux *imux; |
| 5357 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5358 | imux = &spec->input_mux[mux_idx]; |
| 5359 | if (!imux->num_items && mux_idx > 0) |
| 5360 | imux = &spec->input_mux[0]; |
| 5361 | if (imux) |
| 5362 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5363 | AC_VERB_SET_CONNECT_SEL, |
| 5364 | imux->items[0].index); |
| 5365 | } |
| 5366 | } |
| 5367 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5368 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5369 | /* return 1 if successful, 0 if the proper config is not found, |
| 5370 | * or a negative error code |
| 5371 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5372 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5373 | { |
| 5374 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5375 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5376 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5377 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5378 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5379 | alc880_ignore); |
| 5380 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5381 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5382 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5383 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5384 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5385 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5386 | if (err < 0) |
| 5387 | return err; |
| 5388 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5389 | if (err < 0) |
| 5390 | return err; |
| 5391 | err = alc880_auto_create_extra_out(spec, |
| 5392 | spec->autocfg.speaker_pins[0], |
| 5393 | "Speaker"); |
| 5394 | if (err < 0) |
| 5395 | return err; |
| 5396 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5397 | "Headphone"); |
| 5398 | if (err < 0) |
| 5399 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5400 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5401 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5402 | return err; |
| 5403 | |
| 5404 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5405 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5406 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5407 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5408 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5409 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5410 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5411 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5412 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5413 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5414 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5415 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5416 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5417 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5418 | return 1; |
| 5419 | } |
| 5420 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5421 | /* additional initialization for auto-configuration model */ |
| 5422 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5423 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5424 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5425 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5426 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5427 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5428 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5429 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5430 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5431 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5432 | } |
| 5433 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5434 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5435 | * one of two digital mic pins, e.g. on ALC272 |
| 5436 | */ |
| 5437 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5438 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5439 | struct alc_spec *spec = codec->spec; |
| 5440 | int i; |
| 5441 | |
| 5442 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5443 | hda_nid_t cap = spec->capsrc_nids ? |
| 5444 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5445 | int iidx, eidx; |
| 5446 | |
| 5447 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5448 | if (iidx < 0) |
| 5449 | continue; |
| 5450 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5451 | if (eidx < 0) |
| 5452 | continue; |
| 5453 | spec->int_mic.mux_idx = iidx; |
| 5454 | spec->ext_mic.mux_idx = eidx; |
| 5455 | if (spec->capsrc_nids) |
| 5456 | spec->capsrc_nids += i; |
| 5457 | spec->adc_nids += i; |
| 5458 | spec->num_adc_nids = 1; |
| 5459 | return; |
| 5460 | } |
| 5461 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5462 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5463 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5464 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5465 | } |
| 5466 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5467 | /* select or unmute the given capsrc route */ |
| 5468 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5469 | int idx) |
| 5470 | { |
| 5471 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5472 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5473 | HDA_AMP_MUTE, 0); |
| 5474 | } else { |
| 5475 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5476 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5477 | } |
| 5478 | } |
| 5479 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5480 | /* set the default connection to that pin */ |
| 5481 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5482 | { |
| 5483 | struct alc_spec *spec = codec->spec; |
| 5484 | int i; |
| 5485 | |
| 5486 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5487 | hda_nid_t cap = spec->capsrc_nids ? |
| 5488 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5489 | int idx; |
| 5490 | |
| 5491 | idx = get_connection_index(codec, cap, pin); |
| 5492 | if (idx < 0) |
| 5493 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5494 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5495 | return i; /* return the found index */ |
| 5496 | } |
| 5497 | return -1; /* not found */ |
| 5498 | } |
| 5499 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5500 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5501 | static void fixup_single_adc(struct hda_codec *codec) |
| 5502 | { |
| 5503 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5504 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5505 | int i; |
| 5506 | |
| 5507 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5508 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5509 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5510 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5511 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5512 | /* use only this ADC */ |
| 5513 | if (spec->capsrc_nids) |
| 5514 | spec->capsrc_nids += i; |
| 5515 | spec->adc_nids += i; |
| 5516 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5517 | } |
| 5518 | } |
| 5519 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5520 | /* initialize dual adcs */ |
| 5521 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5522 | { |
| 5523 | struct alc_spec *spec = codec->spec; |
| 5524 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5525 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5526 | } |
| 5527 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5528 | static void set_capture_mixer(struct hda_codec *codec) |
| 5529 | { |
| 5530 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5531 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5532 | { alc_capture_mixer_nosrc1, |
| 5533 | alc_capture_mixer_nosrc2, |
| 5534 | alc_capture_mixer_nosrc3 }, |
| 5535 | { alc_capture_mixer1, |
| 5536 | alc_capture_mixer2, |
| 5537 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5538 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5539 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5540 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5541 | int num_adcs = spec->num_adc_nids; |
| 5542 | if (spec->dual_adc_switch) |
| 5543 | fixup_dual_adc_switch(codec); |
| 5544 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5545 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5546 | else if (spec->input_mux) { |
| 5547 | if (spec->input_mux->num_items > 1) |
| 5548 | mux = 1; |
| 5549 | else if (spec->input_mux->num_items == 1) |
| 5550 | fixup_single_adc(codec); |
| 5551 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5552 | if (spec->dual_adc_switch) |
| 5553 | num_adcs = 1; |
| 5554 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5555 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5556 | } |
| 5557 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5558 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5559 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5560 | int num_nids) |
| 5561 | { |
| 5562 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5563 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5564 | int n; |
| 5565 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5566 | |
| 5567 | for (n = 0; n < num_nids; n++) { |
| 5568 | hda_nid_t adc, cap; |
| 5569 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5570 | int nconns, i, j; |
| 5571 | |
| 5572 | adc = nids[n]; |
| 5573 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5574 | continue; |
| 5575 | cap = adc; |
| 5576 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5577 | ARRAY_SIZE(conn)); |
| 5578 | if (nconns == 1) { |
| 5579 | cap = conn[0]; |
| 5580 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5581 | ARRAY_SIZE(conn)); |
| 5582 | } |
| 5583 | if (nconns <= 0) |
| 5584 | continue; |
| 5585 | if (!fallback_adc) { |
| 5586 | fallback_adc = adc; |
| 5587 | fallback_cap = cap; |
| 5588 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5589 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5590 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5591 | for (j = 0; j < nconns; j++) { |
| 5592 | if (conn[j] == nid) |
| 5593 | break; |
| 5594 | } |
| 5595 | if (j >= nconns) |
| 5596 | break; |
| 5597 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5598 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5599 | int num_adcs = spec->num_adc_nids; |
| 5600 | spec->private_adc_nids[num_adcs] = adc; |
| 5601 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5602 | spec->num_adc_nids++; |
| 5603 | spec->adc_nids = spec->private_adc_nids; |
| 5604 | if (adc != cap) |
| 5605 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5606 | } |
| 5607 | } |
| 5608 | if (!spec->num_adc_nids) { |
| 5609 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5610 | " using fallback 0x%x\n", |
| 5611 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5612 | spec->private_adc_nids[0] = fallback_adc; |
| 5613 | spec->adc_nids = spec->private_adc_nids; |
| 5614 | if (fallback_adc != fallback_cap) { |
| 5615 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5616 | spec->capsrc_nids = spec->private_adc_nids; |
| 5617 | } |
| 5618 | } |
| 5619 | } |
| 5620 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5621 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5622 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5623 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5624 | |
| 5625 | static struct snd_pci_quirk beep_white_list[] = { |
| 5626 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5627 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5628 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5629 | {} |
| 5630 | }; |
| 5631 | |
| 5632 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5633 | { |
| 5634 | struct alc_spec *spec = codec->spec; |
| 5635 | const struct snd_pci_quirk *q; |
| 5636 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5637 | if (q) |
| 5638 | return q->value; |
| 5639 | return spec->cdefine.enable_pcbeep; |
| 5640 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5641 | #else |
| 5642 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5643 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5644 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5645 | |
| 5646 | /* |
| 5647 | * OK, here we have finally the patch for ALC880 |
| 5648 | */ |
| 5649 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5650 | static int patch_alc880(struct hda_codec *codec) |
| 5651 | { |
| 5652 | struct alc_spec *spec; |
| 5653 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5654 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5655 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5656 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5657 | if (spec == NULL) |
| 5658 | return -ENOMEM; |
| 5659 | |
| 5660 | codec->spec = spec; |
| 5661 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5662 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5663 | alc880_models, |
| 5664 | alc880_cfg_tbl); |
| 5665 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5666 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5667 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5668 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5669 | } |
| 5670 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5671 | if (board_config == ALC880_AUTO) { |
| 5672 | /* automatic parse from the BIOS config */ |
| 5673 | err = alc880_parse_auto_config(codec); |
| 5674 | if (err < 0) { |
| 5675 | alc_free(codec); |
| 5676 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5677 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5678 | printk(KERN_INFO |
| 5679 | "hda_codec: Cannot set up configuration " |
| 5680 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5681 | board_config = ALC880_3ST; |
| 5682 | } |
| 5683 | } |
| 5684 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5685 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5686 | if (err < 0) { |
| 5687 | alc_free(codec); |
| 5688 | return err; |
| 5689 | } |
| 5690 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5691 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5692 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5693 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5694 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5695 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5696 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5697 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5698 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5699 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5700 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5701 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5702 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5703 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5704 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5705 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5706 | if (wcap != AC_WID_AUD_IN) { |
| 5707 | spec->adc_nids = alc880_adc_nids_alt; |
| 5708 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5709 | } else { |
| 5710 | spec->adc_nids = alc880_adc_nids; |
| 5711 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5712 | } |
| 5713 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5714 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5715 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5716 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5717 | spec->vmaster_nid = 0x0c; |
| 5718 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5719 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5720 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5721 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5722 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5723 | if (!spec->loopback.amplist) |
| 5724 | spec->loopback.amplist = alc880_loopbacks; |
| 5725 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5726 | |
| 5727 | return 0; |
| 5728 | } |
| 5729 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5730 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5731 | /* |
| 5732 | * ALC260 support |
| 5733 | */ |
| 5734 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5735 | static hda_nid_t alc260_dac_nids[1] = { |
| 5736 | /* front */ |
| 5737 | 0x02, |
| 5738 | }; |
| 5739 | |
| 5740 | static hda_nid_t alc260_adc_nids[1] = { |
| 5741 | /* ADC0 */ |
| 5742 | 0x04, |
| 5743 | }; |
| 5744 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5745 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5746 | /* ADC1 */ |
| 5747 | 0x05, |
| 5748 | }; |
| 5749 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5750 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5751 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5752 | */ |
| 5753 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5754 | /* ADC0, ADC1 */ |
| 5755 | 0x04, 0x05 |
| 5756 | }; |
| 5757 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5758 | #define ALC260_DIGOUT_NID 0x03 |
| 5759 | #define ALC260_DIGIN_NID 0x06 |
| 5760 | |
| 5761 | static struct hda_input_mux alc260_capture_source = { |
| 5762 | .num_items = 4, |
| 5763 | .items = { |
| 5764 | { "Mic", 0x0 }, |
| 5765 | { "Front Mic", 0x1 }, |
| 5766 | { "Line", 0x2 }, |
| 5767 | { "CD", 0x4 }, |
| 5768 | }, |
| 5769 | }; |
| 5770 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5771 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5772 | * headphone jack and the internal CD lines since these are the only pins at |
| 5773 | * which audio can appear. For flexibility, also allow the option of |
| 5774 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5775 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5776 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5777 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5778 | { |
| 5779 | .num_items = 3, |
| 5780 | .items = { |
| 5781 | { "Mic/Line", 0x0 }, |
| 5782 | { "CD", 0x4 }, |
| 5783 | { "Headphone", 0x2 }, |
| 5784 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5785 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5786 | { |
| 5787 | .num_items = 4, |
| 5788 | .items = { |
| 5789 | { "Mic/Line", 0x0 }, |
| 5790 | { "CD", 0x4 }, |
| 5791 | { "Headphone", 0x2 }, |
| 5792 | { "Mixer", 0x5 }, |
| 5793 | }, |
| 5794 | }, |
| 5795 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5796 | }; |
| 5797 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5798 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5799 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5800 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5801 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5802 | { |
| 5803 | .num_items = 4, |
| 5804 | .items = { |
| 5805 | { "Mic", 0x0 }, |
| 5806 | { "Line", 0x2 }, |
| 5807 | { "CD", 0x4 }, |
| 5808 | { "Headphone", 0x5 }, |
| 5809 | }, |
| 5810 | }, |
| 5811 | { |
| 5812 | .num_items = 5, |
| 5813 | .items = { |
| 5814 | { "Mic", 0x0 }, |
| 5815 | { "Line", 0x2 }, |
| 5816 | { "CD", 0x4 }, |
| 5817 | { "Headphone", 0x6 }, |
| 5818 | { "Mixer", 0x5 }, |
| 5819 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5820 | }, |
| 5821 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5822 | |
| 5823 | /* Maxdata Favorit 100XS */ |
| 5824 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5825 | { |
| 5826 | .num_items = 2, |
| 5827 | .items = { |
| 5828 | { "Line/Mic", 0x0 }, |
| 5829 | { "CD", 0x4 }, |
| 5830 | }, |
| 5831 | }, |
| 5832 | { |
| 5833 | .num_items = 3, |
| 5834 | .items = { |
| 5835 | { "Line/Mic", 0x0 }, |
| 5836 | { "CD", 0x4 }, |
| 5837 | { "Mixer", 0x5 }, |
| 5838 | }, |
| 5839 | }, |
| 5840 | }; |
| 5841 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5842 | /* |
| 5843 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5844 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5845 | * element which allows changing the channel mode, so the verb list is |
| 5846 | * never used. |
| 5847 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5848 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5849 | { 2, NULL }, |
| 5850 | }; |
| 5851 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5852 | |
| 5853 | /* Mixer combinations |
| 5854 | * |
| 5855 | * basic: base_output + input + pc_beep + capture |
| 5856 | * HP: base_output + input + capture_alt |
| 5857 | * HP_3013: hp_3013 + input + capture |
| 5858 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5859 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5860 | */ |
| 5861 | |
| 5862 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5864 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5865 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5866 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5867 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5868 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5869 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5870 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5871 | |
| 5872 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5873 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5874 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5875 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5876 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5877 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5878 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5879 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5880 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5881 | { } /* end */ |
| 5882 | }; |
| 5883 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5884 | /* update HP, line and mono out pins according to the master switch */ |
| 5885 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5886 | hda_nid_t hp, hda_nid_t line, |
| 5887 | hda_nid_t mono) |
| 5888 | { |
| 5889 | struct alc_spec *spec = codec->spec; |
| 5890 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5891 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5892 | 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] | 5893 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5894 | 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] | 5895 | val); |
| 5896 | /* mono (speaker) depending on the HP jack sense */ |
| 5897 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5898 | 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] | 5899 | val); |
| 5900 | } |
| 5901 | |
| 5902 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5903 | struct snd_ctl_elem_value *ucontrol) |
| 5904 | { |
| 5905 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5906 | struct alc_spec *spec = codec->spec; |
| 5907 | *ucontrol->value.integer.value = spec->master_sw; |
| 5908 | return 0; |
| 5909 | } |
| 5910 | |
| 5911 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5912 | struct snd_ctl_elem_value *ucontrol) |
| 5913 | { |
| 5914 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5915 | struct alc_spec *spec = codec->spec; |
| 5916 | int val = !!*ucontrol->value.integer.value; |
| 5917 | hda_nid_t hp, line, mono; |
| 5918 | |
| 5919 | if (val == spec->master_sw) |
| 5920 | return 0; |
| 5921 | spec->master_sw = val; |
| 5922 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5923 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5924 | mono = kcontrol->private_value & 0xff; |
| 5925 | alc260_hp_master_update(codec, hp, line, mono); |
| 5926 | return 1; |
| 5927 | } |
| 5928 | |
| 5929 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5930 | { |
| 5931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5932 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5933 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5934 | .info = snd_ctl_boolean_mono_info, |
| 5935 | .get = alc260_hp_master_sw_get, |
| 5936 | .put = alc260_hp_master_sw_put, |
| 5937 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5938 | }, |
| 5939 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5940 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5941 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5942 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5943 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5944 | HDA_OUTPUT), |
| 5945 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5946 | { } /* end */ |
| 5947 | }; |
| 5948 | |
| 5949 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5950 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5951 | {}, |
| 5952 | }; |
| 5953 | |
| 5954 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5955 | { |
| 5956 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5957 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5958 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5959 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5960 | } |
| 5961 | |
| 5962 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5963 | { |
| 5964 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5965 | alc260_hp_automute(codec); |
| 5966 | } |
| 5967 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5968 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5969 | { |
| 5970 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5971 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5972 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5973 | .info = snd_ctl_boolean_mono_info, |
| 5974 | .get = alc260_hp_master_sw_get, |
| 5975 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5976 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5977 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5979 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5980 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5981 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5982 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5984 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5985 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5986 | { } /* end */ |
| 5987 | }; |
| 5988 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5989 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5990 | .ops = &snd_hda_bind_vol, |
| 5991 | .values = { |
| 5992 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5993 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5994 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5995 | 0 |
| 5996 | }, |
| 5997 | }; |
| 5998 | |
| 5999 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6000 | .ops = &snd_hda_bind_sw, |
| 6001 | .values = { |
| 6002 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6003 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6004 | 0 |
| 6005 | }, |
| 6006 | }; |
| 6007 | |
| 6008 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6009 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6010 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6011 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6013 | { } /* end */ |
| 6014 | }; |
| 6015 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6016 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6017 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6018 | {}, |
| 6019 | }; |
| 6020 | |
| 6021 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 6022 | { |
| 6023 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6024 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6025 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 6026 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6027 | } |
| 6028 | |
| 6029 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 6030 | unsigned int res) |
| 6031 | { |
| 6032 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6033 | alc260_hp_3013_automute(codec); |
| 6034 | } |
| 6035 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6036 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 6037 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6038 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6039 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6040 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6041 | bits); |
| 6042 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6043 | bits); |
| 6044 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6045 | bits); |
| 6046 | } |
| 6047 | |
| 6048 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 6049 | unsigned int res) |
| 6050 | { |
| 6051 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6052 | alc260_hp_3012_automute(codec); |
| 6053 | } |
| 6054 | |
| 6055 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6056 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6057 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6058 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6059 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6060 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6061 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6062 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6063 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6064 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6065 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6066 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6067 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6068 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6069 | { } /* end */ |
| 6070 | }; |
| 6071 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6072 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6073 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6074 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6075 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6076 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6077 | * revisions available in early 2006. Therefore for now allow the |
| 6078 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6079 | * that the lack of mic bias for this NID is intentional we could change the |
| 6080 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6081 | * |
| 6082 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6083 | * don't appear to make the mic bias available from the "line" jack, even |
| 6084 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6085 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6086 | * and the output jack. If this turns out to be the case for all such |
| 6087 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6088 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6089 | * |
| 6090 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6091 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6092 | * controls for such models. On models without a "mono speaker" the control |
| 6093 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6094 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6095 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6096 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6097 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6098 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6099 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6100 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6101 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6102 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6104 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6107 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6108 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6109 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6110 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6111 | { } /* end */ |
| 6112 | }; |
| 6113 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6114 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6115 | */ |
| 6116 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6117 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6118 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6119 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6120 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6121 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6122 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6123 | { } /* end */ |
| 6124 | }; |
| 6125 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6126 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6127 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6128 | */ |
| 6129 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6130 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6131 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6132 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6133 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6134 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6135 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6136 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6137 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6138 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6139 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6140 | { } /* end */ |
| 6141 | }; |
| 6142 | |
| 6143 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6144 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6145 | */ |
| 6146 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6147 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6148 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6151 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6152 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6153 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6154 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6155 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6156 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6157 | { } /* end */ |
| 6158 | }; |
| 6159 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6160 | /* |
| 6161 | * initialization verbs |
| 6162 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6163 | static struct hda_verb alc260_init_verbs[] = { |
| 6164 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6165 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6166 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6167 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6168 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6169 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6170 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6171 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6172 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6173 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6174 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6175 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6176 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6177 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6178 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6179 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6180 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6181 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6182 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6183 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6184 | /* set connection select to line in (default select for this ADC) */ |
| 6185 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6186 | /* mute capture amp left and right */ |
| 6187 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6188 | /* set connection select to line in (default select for this ADC) */ |
| 6189 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6190 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6192 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6193 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6194 | /* set vol=0 HP mixer amp left and right */ |
| 6195 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6196 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6197 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6198 | /* set vol=0 Mono mixer amp left and right */ |
| 6199 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6200 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6201 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6202 | /* unmute LINE-2 out pin */ |
| 6203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6204 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6205 | * Line In 2 = 0x03 |
| 6206 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6207 | /* mute analog inputs */ |
| 6208 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6210 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6211 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6212 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6213 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6214 | /* mute Front out path */ |
| 6215 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6216 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6217 | /* mute Headphone out path */ |
| 6218 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6219 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6220 | /* mute Mono out path */ |
| 6221 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6222 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6223 | { } |
| 6224 | }; |
| 6225 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6226 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6227 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6228 | /* Headphone and output */ |
| 6229 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6230 | /* mono output */ |
| 6231 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6232 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6233 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6234 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6235 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6236 | /* Line In pin widget for input */ |
| 6237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6238 | /* Line-2 pin widget for output */ |
| 6239 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6240 | /* CD pin widget for input */ |
| 6241 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6242 | /* unmute amp left and right */ |
| 6243 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6244 | /* set connection select to line in (default select for this ADC) */ |
| 6245 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6246 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6247 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6248 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6250 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6251 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6252 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6253 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6254 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6255 | * Line In 2 = 0x03 |
| 6256 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6257 | /* mute analog inputs */ |
| 6258 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6259 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6260 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6261 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6262 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6263 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6264 | /* Unmute Front out path */ |
| 6265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6266 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6267 | /* Unmute Headphone out path */ |
| 6268 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6270 | /* Unmute Mono out path */ |
| 6271 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6272 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6273 | { } |
| 6274 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6275 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6276 | |
| 6277 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6278 | /* Line out and output */ |
| 6279 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6280 | /* mono output */ |
| 6281 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6282 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6283 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6284 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6285 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6286 | /* Line In pin widget for input */ |
| 6287 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6288 | /* Headphone pin widget for output */ |
| 6289 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6290 | /* CD pin widget for input */ |
| 6291 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6292 | /* unmute amp left and right */ |
| 6293 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6294 | /* set connection select to line in (default select for this ADC) */ |
| 6295 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6296 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6297 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6298 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6299 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6300 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6301 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6302 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6303 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6304 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6305 | * Line In 2 = 0x03 |
| 6306 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6307 | /* mute analog inputs */ |
| 6308 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6313 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6314 | /* Unmute Front out path */ |
| 6315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6316 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6317 | /* Unmute Headphone out path */ |
| 6318 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6320 | /* Unmute Mono out path */ |
| 6321 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6322 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6323 | { } |
| 6324 | }; |
| 6325 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6326 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6327 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6328 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6329 | */ |
| 6330 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6331 | /* Disable all GPIOs */ |
| 6332 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6333 | /* Internal speaker is connected to headphone pin */ |
| 6334 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6335 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6336 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6337 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6338 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6339 | /* Ensure all other unused pins are disabled and muted. */ |
| 6340 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6341 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6342 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6343 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6344 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6345 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6346 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6347 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6348 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6349 | /* Disable digital (SPDIF) pins */ |
| 6350 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6351 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6352 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6353 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6354 | * when acting as an output. |
| 6355 | */ |
| 6356 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6357 | |
| 6358 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6359 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6360 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6361 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6362 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6363 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6364 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6365 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6366 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6367 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6368 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6369 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6370 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6371 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6372 | * If the pin mode is changed by the user the pin mode control will |
| 6373 | * take care of enabling the pin's input/output buffers as needed. |
| 6374 | * Therefore there's no need to enable the input buffer at this |
| 6375 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6376 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6377 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6378 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6379 | * mixer ctrl) |
| 6380 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6381 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6382 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6383 | /* Mute capture amp left and right */ |
| 6384 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6385 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6386 | * in (on mic1 pin) |
| 6387 | */ |
| 6388 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6389 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6390 | /* Do the same for the second ADC: mute capture input amp and |
| 6391 | * set ADC connection to line in (on mic1 pin) |
| 6392 | */ |
| 6393 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6394 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6395 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6396 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6404 | {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] | 6405 | |
| 6406 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6407 | }; |
| 6408 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6409 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6410 | * similar laptops (adapted from Fujitsu init verbs). |
| 6411 | */ |
| 6412 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6413 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6414 | * the headphone jack. Turn this on and rely on the standard mute |
| 6415 | * methods whenever the user wants to turn these outputs off. |
| 6416 | */ |
| 6417 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6418 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6419 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6420 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6421 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6422 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6423 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6424 | /* Line In jack is connected to Line1 pin */ |
| 6425 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6426 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6427 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6428 | /* Ensure all other unused pins are disabled and muted. */ |
| 6429 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6430 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6431 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6432 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6433 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6434 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6435 | /* Disable digital (SPDIF) pins */ |
| 6436 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6437 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6438 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6439 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6440 | * bus when acting as outputs. |
| 6441 | */ |
| 6442 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6443 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6444 | |
| 6445 | /* Start with output sum widgets muted and their output gains at min */ |
| 6446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6447 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6448 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6449 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6450 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6451 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6452 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6453 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6454 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6455 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6456 | /* Unmute Line-out pin widget amp left and right |
| 6457 | * (no equiv mixer ctrl) |
| 6458 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6459 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6460 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6461 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6462 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6463 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6464 | * will take care of enabling the pin's input/output buffers as needed. |
| 6465 | * Therefore there's no need to enable the input buffer at this |
| 6466 | * stage. |
| 6467 | */ |
| 6468 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6469 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6470 | |
| 6471 | /* Mute capture amp left and right */ |
| 6472 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6473 | /* Set ADC connection select to match default mixer setting - mic |
| 6474 | * (on mic1 pin) |
| 6475 | */ |
| 6476 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6477 | |
| 6478 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6479 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6480 | */ |
| 6481 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6482 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6483 | |
| 6484 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6490 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6491 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6492 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6493 | |
| 6494 | { } |
| 6495 | }; |
| 6496 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6497 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6498 | * (adapted from Acer init verbs). |
| 6499 | */ |
| 6500 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6501 | /* GPIO 0 enables the output jack. |
| 6502 | * Turn this on and rely on the standard mute |
| 6503 | * methods whenever the user wants to turn these outputs off. |
| 6504 | */ |
| 6505 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6506 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6507 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6508 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6509 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6510 | /* Ensure all other unused pins are disabled and muted. */ |
| 6511 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6512 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6513 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6514 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6515 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6516 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6517 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6518 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6521 | /* Disable digital (SPDIF) pins */ |
| 6522 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6523 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6524 | |
| 6525 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6526 | * bus when acting as outputs. |
| 6527 | */ |
| 6528 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6529 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6530 | |
| 6531 | /* Start with output sum widgets muted and their output gains at min */ |
| 6532 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6533 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6534 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6535 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6536 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6537 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6538 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6539 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6540 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6541 | |
| 6542 | /* Unmute Line-out pin widget amp left and right |
| 6543 | * (no equiv mixer ctrl) |
| 6544 | */ |
| 6545 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6546 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6547 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6548 | * will take care of enabling the pin's input/output buffers as needed. |
| 6549 | * Therefore there's no need to enable the input buffer at this |
| 6550 | * stage. |
| 6551 | */ |
| 6552 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6553 | |
| 6554 | /* Mute capture amp left and right */ |
| 6555 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6556 | /* Set ADC connection select to match default mixer setting - mic |
| 6557 | * (on mic1 pin) |
| 6558 | */ |
| 6559 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6560 | |
| 6561 | /* Do similar with the second ADC: mute capture input amp and |
| 6562 | * set ADC connection to mic to match ALSA's default state. |
| 6563 | */ |
| 6564 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6565 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6566 | |
| 6567 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6568 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6569 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6571 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6572 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6576 | |
| 6577 | { } |
| 6578 | }; |
| 6579 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6580 | static struct hda_verb alc260_will_verbs[] = { |
| 6581 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6582 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6583 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6584 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6585 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6586 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6587 | {} |
| 6588 | }; |
| 6589 | |
| 6590 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6591 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6592 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6593 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6594 | |
| 6595 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6596 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6597 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6598 | |
| 6599 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6600 | {} |
| 6601 | }; |
| 6602 | |
| 6603 | /* toggle speaker-output according to the hp-jack state */ |
| 6604 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6605 | { |
| 6606 | unsigned int present; |
| 6607 | |
| 6608 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6609 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6610 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6611 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6612 | AC_VERB_SET_GPIO_DATA, 1); |
| 6613 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6614 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6615 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6616 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6617 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6618 | AC_VERB_SET_GPIO_DATA, 0); |
| 6619 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6620 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6621 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6622 | } |
| 6623 | } |
| 6624 | |
| 6625 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6626 | unsigned int res) |
| 6627 | { |
| 6628 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6629 | alc260_replacer_672v_automute(codec); |
| 6630 | } |
| 6631 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6632 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6633 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6634 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6635 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6636 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6637 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6638 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6639 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6640 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6641 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6642 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6643 | {} |
| 6644 | }; |
| 6645 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6646 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6647 | * configuration. |
| 6648 | */ |
| 6649 | #ifdef CONFIG_SND_DEBUG |
| 6650 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6651 | 0x02, |
| 6652 | }; |
| 6653 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6654 | 0x04, 0x05, |
| 6655 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6656 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6657 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6658 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6659 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6660 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6661 | { |
| 6662 | .num_items = 7, |
| 6663 | .items = { |
| 6664 | { "MIC1 pin", 0x0 }, |
| 6665 | { "MIC2 pin", 0x1 }, |
| 6666 | { "LINE1 pin", 0x2 }, |
| 6667 | { "LINE2 pin", 0x3 }, |
| 6668 | { "CD pin", 0x4 }, |
| 6669 | { "LINE-OUT pin", 0x5 }, |
| 6670 | { "HP-OUT pin", 0x6 }, |
| 6671 | }, |
| 6672 | }, |
| 6673 | { |
| 6674 | .num_items = 8, |
| 6675 | .items = { |
| 6676 | { "MIC1 pin", 0x0 }, |
| 6677 | { "MIC2 pin", 0x1 }, |
| 6678 | { "LINE1 pin", 0x2 }, |
| 6679 | { "LINE2 pin", 0x3 }, |
| 6680 | { "CD pin", 0x4 }, |
| 6681 | { "Mixer", 0x5 }, |
| 6682 | { "LINE-OUT pin", 0x6 }, |
| 6683 | { "HP-OUT pin", 0x7 }, |
| 6684 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6685 | }, |
| 6686 | }; |
| 6687 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6688 | /* Output driver widgets */ |
| 6689 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6690 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6691 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6692 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6693 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6694 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6695 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6696 | /* Modes for retasking pin widgets |
| 6697 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6698 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6699 | * mention this restriction. At this stage it's not clear whether |
| 6700 | * this behaviour is intentional or is a hardware bug in chip |
| 6701 | * revisions available at least up until early 2006. Therefore for |
| 6702 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6703 | * choices, but if it turns out that the lack of mic bias for these |
| 6704 | * NIDs is intentional we could change their modes from |
| 6705 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6706 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6707 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6708 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6709 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6710 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6711 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6712 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6713 | |
| 6714 | /* Loopback mixer controls */ |
| 6715 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6716 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6717 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6718 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6719 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6720 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6721 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6722 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6724 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6725 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6726 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6727 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6728 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6729 | |
| 6730 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6731 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6732 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6733 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6734 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6735 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6736 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6737 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6738 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6739 | */ |
| 6740 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6741 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6742 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6743 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6744 | * this output to turn on an external amplifier. |
| 6745 | */ |
| 6746 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6747 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6748 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6749 | { } /* end */ |
| 6750 | }; |
| 6751 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6752 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6753 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6754 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6755 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6756 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6757 | /* Enable retasking pins as output, initially without power amp */ |
| 6758 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6759 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6760 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6761 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6762 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6763 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6764 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6765 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6766 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6767 | * payload also sets the generation to 0, output to be in "consumer" |
| 6768 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6769 | * control. |
| 6770 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6771 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6772 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6773 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6774 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6775 | * OUT1 sum bus when acting as an output. |
| 6776 | */ |
| 6777 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6778 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6779 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6780 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6781 | |
| 6782 | /* Start with output sum widgets muted and their output gains at min */ |
| 6783 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6784 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6785 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6786 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6787 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6788 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6789 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6790 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6791 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6792 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6793 | /* Unmute retasking pin widget output buffers since the default |
| 6794 | * state appears to be output. As the pin mode is changed by the |
| 6795 | * user the pin mode control will take care of enabling the pin's |
| 6796 | * input/output buffers as needed. |
| 6797 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6798 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6799 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6800 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6801 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6802 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6803 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6804 | /* Also unmute the mono-out pin widget */ |
| 6805 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6806 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6807 | /* Mute capture amp left and right */ |
| 6808 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6809 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6810 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6811 | */ |
| 6812 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6813 | |
| 6814 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6815 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6816 | */ |
| 6817 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6818 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6819 | |
| 6820 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6821 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6822 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6823 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6824 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6826 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6827 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6828 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6829 | |
| 6830 | { } |
| 6831 | }; |
| 6832 | #endif |
| 6833 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6834 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6835 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6836 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6837 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6838 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6839 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6840 | /* |
| 6841 | * for BIOS auto-configuration |
| 6842 | */ |
| 6843 | |
| 6844 | 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] | 6845 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6846 | { |
| 6847 | hda_nid_t nid_vol; |
| 6848 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6849 | int err; |
| 6850 | |
| 6851 | if (nid >= 0x0f && nid < 0x11) { |
| 6852 | nid_vol = nid - 0x7; |
| 6853 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6854 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6855 | } else if (nid == 0x11) { |
| 6856 | nid_vol = nid - 0x7; |
| 6857 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6858 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6859 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6860 | nid_vol = 0x08; |
| 6861 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6862 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6863 | } else |
| 6864 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6865 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6866 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6867 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6868 | 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] | 6869 | if (err < 0) |
| 6870 | return err; |
| 6871 | *vol_bits |= (1 << nid_vol); |
| 6872 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6873 | 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] | 6874 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6875 | return err; |
| 6876 | return 1; |
| 6877 | } |
| 6878 | |
| 6879 | /* add playback controls from the parsed DAC table */ |
| 6880 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6881 | const struct auto_pin_cfg *cfg) |
| 6882 | { |
| 6883 | hda_nid_t nid; |
| 6884 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6885 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6886 | |
| 6887 | spec->multiout.num_dacs = 1; |
| 6888 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6889 | spec->multiout.dac_nids[0] = 0x02; |
| 6890 | |
| 6891 | nid = cfg->line_out_pins[0]; |
| 6892 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6893 | const char *pfx; |
| 6894 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6895 | pfx = "Master"; |
| 6896 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6897 | pfx = "Speaker"; |
| 6898 | else |
| 6899 | pfx = "Front"; |
| 6900 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6901 | if (err < 0) |
| 6902 | return err; |
| 6903 | } |
| 6904 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6905 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6906 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6907 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6908 | if (err < 0) |
| 6909 | return err; |
| 6910 | } |
| 6911 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6912 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6913 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6914 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6915 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6916 | if (err < 0) |
| 6917 | return err; |
| 6918 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6919 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6920 | } |
| 6921 | |
| 6922 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6923 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6924 | const struct auto_pin_cfg *cfg) |
| 6925 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6926 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6927 | } |
| 6928 | |
| 6929 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6930 | hda_nid_t nid, int pin_type, |
| 6931 | int sel_idx) |
| 6932 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6933 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6934 | /* need the manual connection? */ |
| 6935 | if (nid >= 0x12) { |
| 6936 | int idx = nid - 0x12; |
| 6937 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6938 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6939 | } |
| 6940 | } |
| 6941 | |
| 6942 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6943 | { |
| 6944 | struct alc_spec *spec = codec->spec; |
| 6945 | hda_nid_t nid; |
| 6946 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6947 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6948 | if (nid) { |
| 6949 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6950 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6951 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6952 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6953 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6954 | if (nid) |
| 6955 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6956 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6957 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6958 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6959 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6960 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6961 | |
| 6962 | #define ALC260_PIN_CD_NID 0x16 |
| 6963 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6964 | { |
| 6965 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6966 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6967 | int i; |
| 6968 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6969 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6970 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6971 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 6972 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6973 | if (nid != ALC260_PIN_CD_NID && |
| 6974 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6975 | snd_hda_codec_write(codec, nid, 0, |
| 6976 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6977 | AMP_OUT_MUTE); |
| 6978 | } |
| 6979 | } |
| 6980 | } |
| 6981 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6982 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6983 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6984 | /* |
| 6985 | * generic initialization of ADC, input mixers and output mixers |
| 6986 | */ |
| 6987 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6988 | /* |
| 6989 | * Unmute ADC0-1 and set the default input to mic-in |
| 6990 | */ |
| 6991 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6992 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6993 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6994 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6995 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6996 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6997 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6998 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6999 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7000 | */ |
| 7001 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7002 | /* mute analog inputs */ |
| 7003 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7005 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7006 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7007 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7008 | |
| 7009 | /* |
| 7010 | * Set up output mixers (0x08 - 0x0a) |
| 7011 | */ |
| 7012 | /* set vol=0 to output mixers */ |
| 7013 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7014 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7015 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7016 | /* set up input amps for analog loopback */ |
| 7017 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7018 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7019 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7020 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7021 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7022 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7023 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7024 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7025 | { } |
| 7026 | }; |
| 7027 | |
| 7028 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7029 | { |
| 7030 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7031 | int err; |
| 7032 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7033 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7034 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7035 | alc260_ignore); |
| 7036 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7037 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7038 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7039 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7040 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7041 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7042 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7043 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7044 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7045 | return err; |
| 7046 | |
| 7047 | spec->multiout.max_channels = 2; |
| 7048 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7049 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7050 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7051 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7052 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7053 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7054 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7055 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7056 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7057 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7058 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7059 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7060 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7061 | return 1; |
| 7062 | } |
| 7063 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7064 | /* additional initialization for auto-configuration model */ |
| 7065 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7066 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7067 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7068 | alc260_auto_init_multi_out(codec); |
| 7069 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7070 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7071 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7072 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7073 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7074 | } |
| 7075 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7076 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7077 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7078 | { 0x07, HDA_INPUT, 0 }, |
| 7079 | { 0x07, HDA_INPUT, 1 }, |
| 7080 | { 0x07, HDA_INPUT, 2 }, |
| 7081 | { 0x07, HDA_INPUT, 3 }, |
| 7082 | { 0x07, HDA_INPUT, 4 }, |
| 7083 | { } /* end */ |
| 7084 | }; |
| 7085 | #endif |
| 7086 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7087 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7088 | * Pin config fixes |
| 7089 | */ |
| 7090 | enum { |
| 7091 | PINFIX_HP_DC5750, |
| 7092 | }; |
| 7093 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7094 | static const struct alc_fixup alc260_fixups[] = { |
| 7095 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7096 | .type = ALC_FIXUP_PINS, |
| 7097 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7098 | { 0x11, 0x90130110 }, /* speaker */ |
| 7099 | { } |
| 7100 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7101 | }, |
| 7102 | }; |
| 7103 | |
| 7104 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7105 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7106 | {} |
| 7107 | }; |
| 7108 | |
| 7109 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7110 | * ALC260 configurations |
| 7111 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7112 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7113 | [ALC260_BASIC] = "basic", |
| 7114 | [ALC260_HP] = "hp", |
| 7115 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7116 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7117 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7118 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7119 | [ALC260_WILL] = "will", |
| 7120 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7121 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7122 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7123 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7124 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7125 | [ALC260_AUTO] = "auto", |
| 7126 | }; |
| 7127 | |
| 7128 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7129 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7130 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7131 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7132 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7133 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7134 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7135 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7136 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7137 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7138 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7139 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7140 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7141 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7142 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7143 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7144 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7145 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7146 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7147 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7148 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7149 | {} |
| 7150 | }; |
| 7151 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7152 | static struct alc_config_preset alc260_presets[] = { |
| 7153 | [ALC260_BASIC] = { |
| 7154 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7155 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7156 | .init_verbs = { alc260_init_verbs }, |
| 7157 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7158 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7159 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7160 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7161 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7162 | .channel_mode = alc260_modes, |
| 7163 | .input_mux = &alc260_capture_source, |
| 7164 | }, |
| 7165 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7166 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7167 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7168 | .init_verbs = { alc260_init_verbs, |
| 7169 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7170 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7171 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7172 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7173 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7174 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7175 | .channel_mode = alc260_modes, |
| 7176 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7177 | .unsol_event = alc260_hp_unsol_event, |
| 7178 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7179 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7180 | [ALC260_HP_DC7600] = { |
| 7181 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7182 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7183 | .init_verbs = { alc260_init_verbs, |
| 7184 | alc260_hp_dc7600_verbs }, |
| 7185 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7186 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7187 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7188 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7189 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7190 | .channel_mode = alc260_modes, |
| 7191 | .input_mux = &alc260_capture_source, |
| 7192 | .unsol_event = alc260_hp_3012_unsol_event, |
| 7193 | .init_hook = alc260_hp_3012_automute, |
| 7194 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7195 | [ALC260_HP_3013] = { |
| 7196 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7197 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7198 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7199 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7200 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7201 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7202 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7203 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7204 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7205 | .channel_mode = alc260_modes, |
| 7206 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7207 | .unsol_event = alc260_hp_3013_unsol_event, |
| 7208 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7209 | }, |
| 7210 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7211 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7212 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7213 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7214 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7215 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7216 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7217 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7218 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7219 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7220 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7221 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7222 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7223 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7224 | .init_verbs = { alc260_acer_init_verbs }, |
| 7225 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7226 | .dac_nids = alc260_dac_nids, |
| 7227 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7228 | .adc_nids = alc260_dual_adc_nids, |
| 7229 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7230 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7231 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7232 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7233 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7234 | [ALC260_FAVORIT100] = { |
| 7235 | .mixers = { alc260_favorit100_mixer }, |
| 7236 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7237 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7238 | .dac_nids = alc260_dac_nids, |
| 7239 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7240 | .adc_nids = alc260_dual_adc_nids, |
| 7241 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7242 | .channel_mode = alc260_modes, |
| 7243 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7244 | .input_mux = alc260_favorit100_capture_sources, |
| 7245 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7246 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7247 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7248 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7249 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7250 | .dac_nids = alc260_dac_nids, |
| 7251 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7252 | .adc_nids = alc260_adc_nids, |
| 7253 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7254 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7255 | .channel_mode = alc260_modes, |
| 7256 | .input_mux = &alc260_capture_source, |
| 7257 | }, |
| 7258 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7259 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7260 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7261 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7262 | .dac_nids = alc260_dac_nids, |
| 7263 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7264 | .adc_nids = alc260_adc_nids, |
| 7265 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7266 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7267 | .channel_mode = alc260_modes, |
| 7268 | .input_mux = &alc260_capture_source, |
| 7269 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7270 | .init_hook = alc260_replacer_672v_automute, |
| 7271 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7272 | #ifdef CONFIG_SND_DEBUG |
| 7273 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7274 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7275 | .init_verbs = { alc260_test_init_verbs }, |
| 7276 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7277 | .dac_nids = alc260_test_dac_nids, |
| 7278 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7279 | .adc_nids = alc260_test_adc_nids, |
| 7280 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7281 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7282 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7283 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7284 | }, |
| 7285 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7286 | }; |
| 7287 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7288 | static int patch_alc260(struct hda_codec *codec) |
| 7289 | { |
| 7290 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7291 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7292 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7293 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7294 | if (spec == NULL) |
| 7295 | return -ENOMEM; |
| 7296 | |
| 7297 | codec->spec = spec; |
| 7298 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7299 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7300 | alc260_models, |
| 7301 | alc260_cfg_tbl); |
| 7302 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7303 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7304 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7305 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7306 | } |
| 7307 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7308 | if (board_config == ALC260_AUTO) { |
| 7309 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7310 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7311 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7312 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7313 | if (board_config == ALC260_AUTO) { |
| 7314 | /* automatic parse from the BIOS config */ |
| 7315 | err = alc260_parse_auto_config(codec); |
| 7316 | if (err < 0) { |
| 7317 | alc_free(codec); |
| 7318 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7319 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7320 | printk(KERN_INFO |
| 7321 | "hda_codec: Cannot set up configuration " |
| 7322 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7323 | board_config = ALC260_BASIC; |
| 7324 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7325 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7326 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7327 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7328 | if (err < 0) { |
| 7329 | alc_free(codec); |
| 7330 | return err; |
| 7331 | } |
| 7332 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7333 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7334 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7335 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7336 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7337 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7338 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7339 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7340 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7341 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7342 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7343 | if (!spec->adc_nids && spec->input_mux) { |
| 7344 | /* check whether NID 0x04 is valid */ |
| 7345 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7346 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7347 | /* get type */ |
| 7348 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7349 | spec->adc_nids = alc260_adc_nids_alt; |
| 7350 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7351 | } else { |
| 7352 | spec->adc_nids = alc260_adc_nids; |
| 7353 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7354 | } |
| 7355 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7356 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7357 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7358 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7359 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7360 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7361 | spec->vmaster_nid = 0x08; |
| 7362 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7363 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7364 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7365 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7366 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7367 | if (!spec->loopback.amplist) |
| 7368 | spec->loopback.amplist = alc260_loopbacks; |
| 7369 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7370 | |
| 7371 | return 0; |
| 7372 | } |
| 7373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7374 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7375 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7376 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7377 | * |
| 7378 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7379 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7380 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7381 | * 6-channel independent captures. |
| 7382 | * |
| 7383 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7384 | * driver yet). |
| 7385 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7386 | #define ALC882_DIGOUT_NID 0x06 |
| 7387 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7388 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7389 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7390 | #define ALC1200_DIGOUT_NID 0x10 |
| 7391 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7392 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7393 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7394 | { 8, NULL } |
| 7395 | }; |
| 7396 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7397 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7398 | static hda_nid_t alc882_dac_nids[4] = { |
| 7399 | /* front, rear, clfe, rear_surr */ |
| 7400 | 0x02, 0x03, 0x04, 0x05 |
| 7401 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7402 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7403 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7404 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7405 | #define alc882_adc_nids alc880_adc_nids |
| 7406 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7407 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7408 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7409 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7410 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7411 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7412 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7413 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7414 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7415 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7416 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7417 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7418 | /* input MUX */ |
| 7419 | /* FIXME: should be a matrix-type input source selection */ |
| 7420 | |
| 7421 | static struct hda_input_mux alc882_capture_source = { |
| 7422 | .num_items = 4, |
| 7423 | .items = { |
| 7424 | { "Mic", 0x0 }, |
| 7425 | { "Front Mic", 0x1 }, |
| 7426 | { "Line", 0x2 }, |
| 7427 | { "CD", 0x4 }, |
| 7428 | }, |
| 7429 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7430 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7431 | #define alc883_capture_source alc882_capture_source |
| 7432 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7433 | static struct hda_input_mux alc889_capture_source = { |
| 7434 | .num_items = 3, |
| 7435 | .items = { |
| 7436 | { "Front Mic", 0x0 }, |
| 7437 | { "Mic", 0x3 }, |
| 7438 | { "Line", 0x2 }, |
| 7439 | }, |
| 7440 | }; |
| 7441 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7442 | static struct hda_input_mux mb5_capture_source = { |
| 7443 | .num_items = 3, |
| 7444 | .items = { |
| 7445 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7446 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7447 | { "CD", 0x4 }, |
| 7448 | }, |
| 7449 | }; |
| 7450 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7451 | static struct hda_input_mux macmini3_capture_source = { |
| 7452 | .num_items = 2, |
| 7453 | .items = { |
| 7454 | { "Line", 0x2 }, |
| 7455 | { "CD", 0x4 }, |
| 7456 | }, |
| 7457 | }; |
| 7458 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7459 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7460 | .num_items = 4, |
| 7461 | .items = { |
| 7462 | { "Mic", 0x1 }, |
| 7463 | { "Front Mic", 0x0 }, |
| 7464 | { "Line", 0x2 }, |
| 7465 | { "CD", 0x4 }, |
| 7466 | }, |
| 7467 | }; |
| 7468 | |
| 7469 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7470 | .num_items = 2, |
| 7471 | .items = { |
| 7472 | { "Mic", 0x1 }, |
| 7473 | { "Line", 0x2 }, |
| 7474 | }, |
| 7475 | }; |
| 7476 | |
| 7477 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7478 | .num_items = 4, |
| 7479 | .items = { |
| 7480 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7481 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7482 | { "Line", 0x2 }, |
| 7483 | { "CD", 0x4 }, |
| 7484 | }, |
| 7485 | }; |
| 7486 | |
| 7487 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7488 | .num_items = 2, |
| 7489 | .items = { |
| 7490 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7491 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7492 | }, |
| 7493 | }; |
| 7494 | |
| 7495 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7496 | .num_items = 3, |
| 7497 | .items = { |
| 7498 | { "Mic", 0x0 }, |
| 7499 | { "Front Mic", 0x1 }, |
| 7500 | { "Line", 0x4 }, |
| 7501 | }, |
| 7502 | }; |
| 7503 | |
| 7504 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7505 | .num_items = 2, |
| 7506 | .items = { |
| 7507 | { "Mic", 0x0 }, |
| 7508 | { "Line", 0x2 }, |
| 7509 | }, |
| 7510 | }; |
| 7511 | |
| 7512 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7513 | .num_items = 2, |
| 7514 | .items = { |
| 7515 | { "Mic", 0x0 }, |
| 7516 | /* Front Mic (0x01) unused */ |
| 7517 | { "Line", 0x2 }, |
| 7518 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7519 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7520 | }, |
| 7521 | }; |
| 7522 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7523 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7524 | .num_items = 2, |
| 7525 | .items = { |
| 7526 | { "Mic", 0x01 }, |
| 7527 | { "Line", 0x2 }, /* Not sure! */ |
| 7528 | }, |
| 7529 | }; |
| 7530 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7531 | /* |
| 7532 | * 2ch mode |
| 7533 | */ |
| 7534 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7535 | { 2, NULL } |
| 7536 | }; |
| 7537 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7538 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7539 | * 2ch mode |
| 7540 | */ |
| 7541 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7542 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7543 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7544 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7545 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7546 | { } /* end */ |
| 7547 | }; |
| 7548 | |
| 7549 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7550 | * 4ch mode |
| 7551 | */ |
| 7552 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7553 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7554 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7555 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7556 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7557 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7558 | { } /* end */ |
| 7559 | }; |
| 7560 | |
| 7561 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7562 | * 6ch mode |
| 7563 | */ |
| 7564 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7565 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7566 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7567 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7568 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7569 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7570 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7571 | { } /* end */ |
| 7572 | }; |
| 7573 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7574 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7575 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7576 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7577 | { 6, alc882_3ST_ch6_init }, |
| 7578 | }; |
| 7579 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7580 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7581 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7582 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7583 | * 2ch mode |
| 7584 | */ |
| 7585 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7586 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7587 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7588 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7589 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7590 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7591 | { } /* end */ |
| 7592 | }; |
| 7593 | |
| 7594 | /* |
| 7595 | * 4ch mode |
| 7596 | */ |
| 7597 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7598 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7599 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7600 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7601 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7602 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7603 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7604 | { } /* end */ |
| 7605 | }; |
| 7606 | |
| 7607 | /* |
| 7608 | * 6ch mode |
| 7609 | */ |
| 7610 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7611 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7612 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7613 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7614 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7615 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7616 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7617 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7618 | { } /* end */ |
| 7619 | }; |
| 7620 | |
| 7621 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7622 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7623 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7624 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7625 | }; |
| 7626 | |
| 7627 | |
| 7628 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7629 | * 6ch mode |
| 7630 | */ |
| 7631 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7632 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7633 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7634 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7635 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7636 | { } /* end */ |
| 7637 | }; |
| 7638 | |
| 7639 | /* |
| 7640 | * 8ch mode |
| 7641 | */ |
| 7642 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7643 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7644 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7645 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7646 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7647 | { } /* end */ |
| 7648 | }; |
| 7649 | |
| 7650 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7651 | { 6, alc882_sixstack_ch6_init }, |
| 7652 | { 8, alc882_sixstack_ch8_init }, |
| 7653 | }; |
| 7654 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7655 | |
| 7656 | /* Macbook Air 2,1 */ |
| 7657 | |
| 7658 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7659 | { 2, NULL }, |
| 7660 | }; |
| 7661 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7662 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7663 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7664 | */ |
| 7665 | |
| 7666 | /* |
| 7667 | * 2ch mode |
| 7668 | */ |
| 7669 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7670 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7671 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7672 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7673 | { } /* end */ |
| 7674 | }; |
| 7675 | |
| 7676 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7677 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7678 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7679 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7680 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7681 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7682 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7683 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7684 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7685 | { } /* end */ |
| 7686 | }; |
| 7687 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7688 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7689 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7690 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7691 | }; |
| 7692 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7693 | /* |
| 7694 | * 2ch |
| 7695 | * Speakers/Woofer/HP = Front |
| 7696 | * LineIn = Input |
| 7697 | */ |
| 7698 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7699 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7700 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7701 | { } /* end */ |
| 7702 | }; |
| 7703 | |
| 7704 | /* |
| 7705 | * 6ch mode |
| 7706 | * Speakers/HP = Front |
| 7707 | * Woofer = LFE |
| 7708 | * LineIn = Surround |
| 7709 | */ |
| 7710 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7713 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7714 | { } /* end */ |
| 7715 | }; |
| 7716 | |
| 7717 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7718 | { 2, alc885_mb5_ch2_init }, |
| 7719 | { 6, alc885_mb5_ch6_init }, |
| 7720 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7721 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7722 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7723 | |
| 7724 | /* |
| 7725 | * 2ch mode |
| 7726 | */ |
| 7727 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7728 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7729 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7730 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7731 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7732 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7733 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7734 | { } /* end */ |
| 7735 | }; |
| 7736 | |
| 7737 | /* |
| 7738 | * 4ch mode |
| 7739 | */ |
| 7740 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7741 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7742 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7743 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7744 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7745 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7746 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7747 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7748 | { } /* end */ |
| 7749 | }; |
| 7750 | |
| 7751 | /* |
| 7752 | * 6ch mode |
| 7753 | */ |
| 7754 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7755 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7756 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7757 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7758 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7759 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7760 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7761 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7762 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7763 | { } /* end */ |
| 7764 | }; |
| 7765 | |
| 7766 | /* |
| 7767 | * 8ch mode |
| 7768 | */ |
| 7769 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7770 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7771 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7772 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7773 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7774 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7775 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7776 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7777 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7778 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7779 | { } /* end */ |
| 7780 | }; |
| 7781 | |
| 7782 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7783 | { 2, alc883_4ST_ch2_init }, |
| 7784 | { 4, alc883_4ST_ch4_init }, |
| 7785 | { 6, alc883_4ST_ch6_init }, |
| 7786 | { 8, alc883_4ST_ch8_init }, |
| 7787 | }; |
| 7788 | |
| 7789 | |
| 7790 | /* |
| 7791 | * 2ch mode |
| 7792 | */ |
| 7793 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7794 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7795 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7796 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7797 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7798 | { } /* end */ |
| 7799 | }; |
| 7800 | |
| 7801 | /* |
| 7802 | * 4ch mode |
| 7803 | */ |
| 7804 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7805 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7806 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7807 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7808 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7809 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7810 | { } /* end */ |
| 7811 | }; |
| 7812 | |
| 7813 | /* |
| 7814 | * 6ch mode |
| 7815 | */ |
| 7816 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7817 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7818 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7819 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7820 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7821 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7822 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7823 | { } /* end */ |
| 7824 | }; |
| 7825 | |
| 7826 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7827 | { 2, alc883_3ST_ch2_intel_init }, |
| 7828 | { 4, alc883_3ST_ch4_intel_init }, |
| 7829 | { 6, alc883_3ST_ch6_intel_init }, |
| 7830 | }; |
| 7831 | |
| 7832 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7833 | * 2ch mode |
| 7834 | */ |
| 7835 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7836 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7837 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7838 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7839 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7840 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7841 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7842 | { } /* end */ |
| 7843 | }; |
| 7844 | |
| 7845 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7846 | * 6ch mode |
| 7847 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7848 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7849 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7850 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7851 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7852 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7853 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7854 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7855 | { } /* end */ |
| 7856 | }; |
| 7857 | |
| 7858 | /* |
| 7859 | * 8ch mode |
| 7860 | */ |
| 7861 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7862 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7863 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7864 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7865 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7866 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7867 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7868 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7869 | { } /* end */ |
| 7870 | }; |
| 7871 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7872 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7873 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7874 | { 6, alc889_ch6_intel_init }, |
| 7875 | { 8, alc889_ch8_intel_init }, |
| 7876 | }; |
| 7877 | |
| 7878 | /* |
| 7879 | * 6ch mode |
| 7880 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7881 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7882 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7883 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7884 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7885 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7886 | { } /* end */ |
| 7887 | }; |
| 7888 | |
| 7889 | /* |
| 7890 | * 8ch mode |
| 7891 | */ |
| 7892 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7893 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7894 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7895 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7896 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7897 | { } /* end */ |
| 7898 | }; |
| 7899 | |
| 7900 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7901 | { 6, alc883_sixstack_ch6_init }, |
| 7902 | { 8, alc883_sixstack_ch8_init }, |
| 7903 | }; |
| 7904 | |
| 7905 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7906 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7907 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7908 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7909 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7910 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7911 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7912 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7913 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7914 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7915 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7916 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7917 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7918 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7919 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7920 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7921 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7922 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7923 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7924 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7925 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7926 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7928 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7929 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7930 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7931 | { } /* end */ |
| 7932 | }; |
| 7933 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7934 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7935 | |
| 7936 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7937 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7938 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7939 | { } |
| 7940 | }; |
| 7941 | |
| 7942 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7943 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7944 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7945 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7946 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7947 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7948 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7950 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7952 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7953 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 7954 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7955 | { } /* end */ |
| 7956 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7957 | |
| 7958 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7960 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7961 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7962 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7963 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7964 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7965 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7966 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7968 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7970 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7971 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 7972 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7973 | { } /* end */ |
| 7974 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7975 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7976 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7977 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7978 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7980 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7982 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7983 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7984 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7985 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7986 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 7987 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7988 | { } /* end */ |
| 7989 | }; |
| 7990 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7991 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7992 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7993 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7994 | { } /* end */ |
| 7995 | }; |
| 7996 | |
| 7997 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7998 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7999 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8000 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8001 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8002 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8003 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8004 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8005 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8006 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8007 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8008 | { } /* end */ |
| 8009 | }; |
| 8010 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8011 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8013 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8015 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8016 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8017 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8018 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8021 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8022 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8023 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8024 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8025 | { } /* end */ |
| 8026 | }; |
| 8027 | |
| 8028 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8029 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8030 | */ |
| 8031 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8032 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8033 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8034 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8035 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8036 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8037 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8039 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8040 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8043 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8044 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8045 | { } /* end */ |
| 8046 | }; |
| 8047 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8048 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8049 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8050 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8051 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8052 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8053 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8054 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8055 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8056 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8057 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8059 | { } /* end */ |
| 8060 | }; |
| 8061 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8062 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8063 | { |
| 8064 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8065 | .name = "Channel Mode", |
| 8066 | .info = alc_ch_mode_info, |
| 8067 | .get = alc_ch_mode_get, |
| 8068 | .put = alc_ch_mode_put, |
| 8069 | }, |
| 8070 | { } /* end */ |
| 8071 | }; |
| 8072 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8073 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8074 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8076 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8077 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8078 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8079 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8080 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8081 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8082 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8083 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8084 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8085 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8086 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8087 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8088 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8089 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8090 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8091 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8092 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8093 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8094 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8095 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8096 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8097 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8098 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8099 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8100 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8101 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8102 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8103 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8104 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8105 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8106 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8107 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8108 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8109 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8110 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8111 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8112 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8113 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8114 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8115 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8116 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8117 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8118 | |
| 8119 | /* FIXME: use matrix-type input source selection */ |
| 8120 | /* 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] | 8121 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8122 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8123 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8124 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8125 | /* ADC2: mute amp left and right */ |
| 8126 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8127 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8128 | /* ADC3: mute amp left and right */ |
| 8129 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8130 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8131 | |
| 8132 | { } |
| 8133 | }; |
| 8134 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8135 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8136 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8137 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8138 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8139 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8140 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8141 | /* ADC1: mute amp left and right */ |
| 8142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8143 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8144 | { } |
| 8145 | }; |
| 8146 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8147 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8148 | /* change to EAPD mode */ |
| 8149 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8150 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8151 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8152 | }; |
| 8153 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8154 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8155 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8156 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8157 | { } |
| 8158 | }; |
| 8159 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8160 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8161 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8162 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8163 | {} |
| 8164 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8165 | |
| 8166 | static struct hda_verb alc885_init_verbs[] = { |
| 8167 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8168 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8169 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8170 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8171 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8172 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8173 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8174 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8175 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8176 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8177 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8178 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8179 | |
| 8180 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8182 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8183 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8184 | /* Front Pin: output 0 (0x0c) */ |
| 8185 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8186 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8187 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8188 | /* Rear Pin: output 1 (0x0d) */ |
| 8189 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8190 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8191 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8192 | /* CLFE Pin: output 2 (0x0e) */ |
| 8193 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8194 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8195 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8196 | /* Side Pin: output 3 (0x0f) */ |
| 8197 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8198 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8199 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8200 | /* Mic (rear) pin: input vref at 80% */ |
| 8201 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8202 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8203 | /* Front Mic pin: input vref at 80% */ |
| 8204 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8205 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8206 | /* Line In pin: input */ |
| 8207 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8208 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8209 | |
| 8210 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8211 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8212 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8213 | /* Input mixer2 */ |
| 8214 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8215 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8216 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8217 | /* ADC2: mute amp left and right */ |
| 8218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8219 | /* ADC3: mute amp left and right */ |
| 8220 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8221 | |
| 8222 | { } |
| 8223 | }; |
| 8224 | |
| 8225 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8226 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8227 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8228 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8229 | { } |
| 8230 | }; |
| 8231 | |
| 8232 | |
| 8233 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8234 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8235 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8236 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8237 | { } |
| 8238 | }; |
| 8239 | |
| 8240 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8241 | #define alc883_init_verbs alc882_base_init_verbs |
| 8242 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8243 | /* Mac Pro test */ |
| 8244 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8245 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8246 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8248 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8249 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8250 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8251 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8252 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8253 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8254 | { } /* end */ |
| 8255 | }; |
| 8256 | |
| 8257 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8258 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8259 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8260 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8261 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8262 | /* Front Pin: output 0 (0x0c) */ |
| 8263 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8264 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8265 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8266 | /* Front Mic pin: input vref at 80% */ |
| 8267 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8268 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8269 | /* Speaker: output */ |
| 8270 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8271 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8272 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8273 | /* Headphone output (output 0 - 0x0c) */ |
| 8274 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8275 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8276 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8277 | |
| 8278 | /* FIXME: use matrix-type input source selection */ |
| 8279 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8280 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8281 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8282 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8283 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8284 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8285 | /* Input mixer2 */ |
| 8286 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8287 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8288 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8289 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8290 | /* Input mixer3 */ |
| 8291 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8292 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8293 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8294 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8295 | /* ADC1: mute amp left and right */ |
| 8296 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8297 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8298 | /* ADC2: mute amp left and right */ |
| 8299 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8300 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8301 | /* ADC3: mute amp left and right */ |
| 8302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8303 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8304 | |
| 8305 | { } |
| 8306 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8307 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8308 | /* Macbook 5,1 */ |
| 8309 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8310 | /* DACs */ |
| 8311 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8312 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8313 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8314 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8315 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8319 | /* Surround mixer */ |
| 8320 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8321 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8322 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8323 | /* LFE mixer */ |
| 8324 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8325 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8326 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8327 | /* HP mixer */ |
| 8328 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8329 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8330 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8331 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8332 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8333 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8334 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8335 | /* LFE Pin (0x0e) */ |
| 8336 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8337 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8338 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8339 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8340 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8341 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8342 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8343 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8344 | /* Front Mic pin: input vref at 80% */ |
| 8345 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8346 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8347 | /* Line In pin */ |
| 8348 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8349 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8350 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8354 | { } |
| 8355 | }; |
| 8356 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8357 | /* Macmini 3,1 */ |
| 8358 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8359 | /* DACs */ |
| 8360 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8361 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8362 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8363 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8364 | /* Front mixer */ |
| 8365 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8368 | /* Surround mixer */ |
| 8369 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8370 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8372 | /* LFE mixer */ |
| 8373 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8375 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8376 | /* HP mixer */ |
| 8377 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8378 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8379 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8380 | /* Front Pin (0x0c) */ |
| 8381 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8382 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8383 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8384 | /* LFE Pin (0x0e) */ |
| 8385 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8386 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8387 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8388 | /* HP Pin (0x0f) */ |
| 8389 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8390 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8391 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8392 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8393 | /* Line In pin */ |
| 8394 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8395 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8396 | |
| 8397 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8398 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8399 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8400 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8401 | { } |
| 8402 | }; |
| 8403 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8404 | |
| 8405 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8406 | /*Internal and HP Speaker Mixer*/ |
| 8407 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8408 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8410 | /*Internal Speaker Pin (0x0c)*/ |
| 8411 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8412 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8413 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8414 | /* HP Pin: output 0 (0x0e) */ |
| 8415 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8416 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8417 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8418 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8419 | /* Line in (is hp when jack connected)*/ |
| 8420 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8421 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8422 | |
| 8423 | { } |
| 8424 | }; |
| 8425 | |
| 8426 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8427 | /* Macbook Pro rev3 */ |
| 8428 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8429 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8433 | /* Rear mixer */ |
| 8434 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8435 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8436 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8437 | /* HP mixer */ |
| 8438 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8439 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8441 | /* Front Pin: output 0 (0x0c) */ |
| 8442 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8443 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8444 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8445 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8446 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8447 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8448 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8449 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8450 | /* Mic (rear) pin: input vref at 80% */ |
| 8451 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8452 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8453 | /* Front Mic pin: input vref at 80% */ |
| 8454 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8455 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8456 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8457 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8458 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8459 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8460 | |
| 8461 | /* FIXME: use matrix-type input source selection */ |
| 8462 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8463 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8464 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8465 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8466 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8467 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8468 | /* Input mixer2 */ |
| 8469 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8470 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8471 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8472 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8473 | /* Input mixer3 */ |
| 8474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8475 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8476 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8477 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8478 | /* ADC1: mute amp left and right */ |
| 8479 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8480 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8481 | /* ADC2: mute amp left and right */ |
| 8482 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8483 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8484 | /* ADC3: mute amp left and right */ |
| 8485 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8486 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8487 | |
| 8488 | { } |
| 8489 | }; |
| 8490 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8491 | /* iMac 9,1 */ |
| 8492 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8493 | /* Internal Speaker Pin (0x0c) */ |
| 8494 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8495 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8496 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8497 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8498 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8499 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8500 | /* HP Pin: Rear */ |
| 8501 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8502 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8503 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8504 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8505 | /* Line in Rear */ |
| 8506 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8507 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8508 | /* Front Mic pin: input vref at 80% */ |
| 8509 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8510 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8511 | /* Rear mixer */ |
| 8512 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8513 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8514 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8515 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8519 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8520 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8521 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8522 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8523 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8524 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8525 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8526 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8527 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8528 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8529 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8530 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8531 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8532 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8533 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8534 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8535 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8536 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8537 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8538 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8539 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8540 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8541 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8542 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8543 | { } |
| 8544 | }; |
| 8545 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8546 | /* iMac 24 mixer. */ |
| 8547 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8548 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8549 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8550 | { } /* end */ |
| 8551 | }; |
| 8552 | |
| 8553 | /* iMac 24 init verbs. */ |
| 8554 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8555 | /* Internal speakers: output 0 (0x0c) */ |
| 8556 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8557 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8558 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8559 | /* Internal speakers: output 0 (0x0c) */ |
| 8560 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8561 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8562 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8563 | /* Headphone: output 0 (0x0c) */ |
| 8564 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8565 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8566 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8567 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8568 | /* Front Mic: input vref at 80% */ |
| 8569 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8570 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8571 | { } |
| 8572 | }; |
| 8573 | |
| 8574 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8575 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8576 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8577 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8578 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8579 | spec->autocfg.hp_pins[0] = 0x14; |
| 8580 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8581 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8582 | } |
| 8583 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8584 | #define alc885_mb5_setup alc885_imac24_setup |
| 8585 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8586 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8587 | /* Macbook Air 2,1 */ |
| 8588 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8589 | { |
| 8590 | struct alc_spec *spec = codec->spec; |
| 8591 | |
| 8592 | spec->autocfg.hp_pins[0] = 0x14; |
| 8593 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8594 | } |
| 8595 | |
| 8596 | |
| 8597 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8598 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8599 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8600 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8601 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8602 | spec->autocfg.hp_pins[0] = 0x15; |
| 8603 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8604 | } |
| 8605 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8606 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8607 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8608 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8609 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8610 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8611 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8612 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8613 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8614 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8615 | static struct hda_verb alc882_targa_verbs[] = { |
| 8616 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8618 | |
| 8619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8620 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8621 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8622 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8623 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8624 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8625 | |
| 8626 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8627 | { } /* end */ |
| 8628 | }; |
| 8629 | |
| 8630 | /* toggle speaker-output according to the hp-jack state */ |
| 8631 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8632 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8633 | struct alc_spec *spec = codec->spec; |
| 8634 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8635 | 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] | 8636 | spec->jack_present ? 1 : 3); |
| 8637 | } |
| 8638 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8639 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8640 | { |
| 8641 | struct alc_spec *spec = codec->spec; |
| 8642 | |
| 8643 | spec->autocfg.hp_pins[0] = 0x14; |
| 8644 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8645 | } |
| 8646 | |
| 8647 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8648 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8649 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8650 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8651 | } |
| 8652 | |
| 8653 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8656 | |
| 8657 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8658 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8659 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8660 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8661 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8662 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8663 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8664 | |
| 8665 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8666 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8667 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8668 | { } /* end */ |
| 8669 | }; |
| 8670 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8671 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8672 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8673 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8674 | |
| 8675 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8676 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8677 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8678 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8679 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8680 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8681 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8682 | |
| 8683 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8684 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8685 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8686 | { } /* end */ |
| 8687 | }; |
| 8688 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8689 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8690 | { |
| 8691 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8692 | |
| 8693 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8694 | AC_VERB_GET_GPIO_DATA, 0); |
| 8695 | |
| 8696 | if (!muted) |
| 8697 | gpiostate |= (1 << pin); |
| 8698 | else |
| 8699 | gpiostate &= ~(1 << pin); |
| 8700 | |
| 8701 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8702 | AC_VERB_GET_GPIO_MASK, 0); |
| 8703 | gpiomask |= (1 << pin); |
| 8704 | |
| 8705 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8706 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8707 | gpiodir |= (1 << pin); |
| 8708 | |
| 8709 | |
| 8710 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8711 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8712 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8713 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8714 | |
| 8715 | msleep(1); |
| 8716 | |
| 8717 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8718 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8719 | } |
| 8720 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8721 | /* set up GPIO at initialization */ |
| 8722 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8723 | { |
| 8724 | alc882_gpio_mute(codec, 0, 0); |
| 8725 | alc882_gpio_mute(codec, 1, 0); |
| 8726 | } |
| 8727 | |
| 8728 | /* set up GPIO and update auto-muting at initialization */ |
| 8729 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8730 | { |
| 8731 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8732 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8733 | } |
| 8734 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8735 | /* |
| 8736 | * generic initialization of ADC, input mixers and output mixers |
| 8737 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8738 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8739 | /* |
| 8740 | * Unmute ADC0-2 and set the default input to mic-in |
| 8741 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8742 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8743 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8744 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8745 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8746 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8747 | /* |
| 8748 | * Set up output mixers (0x0c - 0x0f) |
| 8749 | */ |
| 8750 | /* set vol=0 to output mixers */ |
| 8751 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8752 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8753 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8754 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8755 | /* set up input amps for analog loopback */ |
| 8756 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8757 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8758 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8759 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8760 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8761 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8762 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8763 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8764 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8765 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8766 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8767 | |
| 8768 | /* FIXME: use matrix-type input source selection */ |
| 8769 | /* 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] | 8770 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8771 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8772 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8774 | { } |
| 8775 | }; |
| 8776 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8777 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8778 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8779 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8780 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8781 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8782 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8783 | { } /* end */ |
| 8784 | }; |
| 8785 | |
| 8786 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8787 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8788 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8789 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8790 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8791 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8792 | { } /* end */ |
| 8793 | }; |
| 8794 | |
| 8795 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8796 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8797 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8798 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8799 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8800 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8801 | { } /* end */ |
| 8802 | }; |
| 8803 | |
| 8804 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8805 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8807 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8808 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8809 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8810 | { } /* end */ |
| 8811 | }; |
| 8812 | |
| 8813 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8814 | { 2, alc889A_mb31_ch2_init }, |
| 8815 | { 4, alc889A_mb31_ch4_init }, |
| 8816 | { 5, alc889A_mb31_ch5_init }, |
| 8817 | { 6, alc889A_mb31_ch6_init }, |
| 8818 | }; |
| 8819 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8820 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8821 | /* eanable EAPD on medion laptop */ |
| 8822 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8823 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8824 | { } |
| 8825 | }; |
| 8826 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8827 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8828 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8829 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8830 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8831 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8832 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8833 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8834 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8835 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8838 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8840 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8841 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8842 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8843 | { } /* end */ |
| 8844 | }; |
| 8845 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8846 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8847 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8848 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8849 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8850 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8851 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8852 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8854 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8855 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8856 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8857 | { } /* end */ |
| 8858 | }; |
| 8859 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8860 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8861 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8862 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8863 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8864 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8865 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8866 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8867 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8868 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8869 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8870 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8871 | { } /* end */ |
| 8872 | }; |
| 8873 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8874 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8875 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8876 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8878 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8879 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8880 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8881 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8883 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8884 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8885 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8886 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8887 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8888 | { } /* end */ |
| 8889 | }; |
| 8890 | |
| 8891 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8892 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8893 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8894 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8895 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8896 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8897 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8898 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8899 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8900 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8901 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8902 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8903 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8904 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8905 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8906 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8907 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8908 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8909 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8910 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8911 | { } /* end */ |
| 8912 | }; |
| 8913 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8914 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8915 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8916 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8917 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8918 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8919 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8920 | HDA_OUTPUT), |
| 8921 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8922 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8923 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8924 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8925 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8926 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8927 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8928 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8930 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8931 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8932 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8933 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8934 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8935 | { } /* end */ |
| 8936 | }; |
| 8937 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8938 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8939 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8940 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8941 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8942 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8943 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8944 | HDA_OUTPUT), |
| 8945 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8946 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8947 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8948 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8949 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8950 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8951 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8952 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8953 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8954 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8956 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8957 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8958 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8959 | { } /* end */ |
| 8960 | }; |
| 8961 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8962 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8963 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8964 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8965 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8966 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8967 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8968 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8969 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8970 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8971 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8977 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8979 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8980 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8981 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8982 | { } /* end */ |
| 8983 | }; |
| 8984 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8985 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8986 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8987 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8988 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8989 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8990 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8991 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8992 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8993 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8994 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8995 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8996 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8997 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9001 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9003 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9004 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9005 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9006 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9007 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9008 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9010 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9011 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9012 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9014 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9016 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9017 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9018 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9019 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9020 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9021 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9022 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9023 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9024 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9025 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9026 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9027 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9028 | { } /* end */ |
| 9029 | }; |
| 9030 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9031 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9032 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9033 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9034 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9035 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9036 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9038 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9039 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9040 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9041 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9042 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9043 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9044 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9045 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9046 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9047 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9048 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9049 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9051 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9052 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9053 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9054 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9055 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9056 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9057 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9058 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9059 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9061 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9062 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9063 | { } /* end */ |
| 9064 | }; |
| 9065 | |
| 9066 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9067 | /* Unmute front mixer */ |
| 9068 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9069 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9070 | |
| 9071 | /* Set speaker pin to front mixer */ |
| 9072 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9073 | |
| 9074 | /* Init headphone pin */ |
| 9075 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9076 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9077 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9078 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9079 | |
| 9080 | { } /* end */ |
| 9081 | }; |
| 9082 | |
| 9083 | /* toggle speaker-output according to the hp-jack state */ |
| 9084 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9085 | { |
| 9086 | struct alc_spec *spec = codec->spec; |
| 9087 | |
| 9088 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9089 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9090 | } |
| 9091 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9092 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9093 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9094 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9095 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9096 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9097 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9098 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9099 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9100 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9101 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9102 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9103 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9104 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9105 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9106 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9107 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9108 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9109 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9110 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, 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), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9114 | { } /* end */ |
| 9115 | }; |
| 9116 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9117 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9118 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9119 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9120 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9121 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9122 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9123 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9124 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9125 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9126 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9127 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9128 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9129 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9130 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9131 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9132 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9133 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9134 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9135 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9136 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9137 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9138 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9139 | { } /* end */ |
| 9140 | }; |
| 9141 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9142 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9143 | /* Output mixers */ |
| 9144 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9145 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9146 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9147 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9148 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9149 | HDA_OUTPUT), |
| 9150 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9152 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9153 | /* Output switches */ |
| 9154 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9155 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9156 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9157 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9158 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9159 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9160 | /* Input mixers */ |
| 9161 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9162 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9163 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9164 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9165 | { } /* end */ |
| 9166 | }; |
| 9167 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9168 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9169 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9170 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9171 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9172 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9173 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9174 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9175 | { } /* end */ |
| 9176 | }; |
| 9177 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9178 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9179 | .ops = &snd_hda_bind_vol, |
| 9180 | .values = { |
| 9181 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9182 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9183 | 0 |
| 9184 | }, |
| 9185 | }; |
| 9186 | |
| 9187 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9188 | .ops = &snd_hda_bind_sw, |
| 9189 | .values = { |
| 9190 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9191 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9192 | 0 |
| 9193 | }, |
| 9194 | }; |
| 9195 | |
| 9196 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9197 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9198 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9199 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9200 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9201 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9202 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9203 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9204 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9205 | { } /* end */ |
| 9206 | }; |
| 9207 | |
| 9208 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9209 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9210 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9211 | { |
| 9212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9213 | /* .name = "Capture Source", */ |
| 9214 | .name = "Input Source", |
| 9215 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9216 | .info = alc_mux_enum_info, |
| 9217 | .get = alc_mux_enum_get, |
| 9218 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9219 | }, |
| 9220 | { } /* end */ |
| 9221 | }; |
| 9222 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9223 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9224 | { |
| 9225 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9226 | .name = "Channel Mode", |
| 9227 | .info = alc_ch_mode_info, |
| 9228 | .get = alc_ch_mode_get, |
| 9229 | .put = alc_ch_mode_put, |
| 9230 | }, |
| 9231 | { } /* end */ |
| 9232 | }; |
| 9233 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9234 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9235 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9236 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9237 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9238 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9239 | spec->autocfg.hp_pins[0] = 0x15; |
| 9240 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9241 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9242 | } |
| 9243 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9244 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9245 | /* HP */ |
| 9246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9248 | /* Subwoofer */ |
| 9249 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9250 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9251 | |
| 9252 | /* enable unsolicited event */ |
| 9253 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9254 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9255 | |
| 9256 | { } /* end */ |
| 9257 | }; |
| 9258 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9259 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9260 | /* HP */ |
| 9261 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9262 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9263 | /* Int speaker */ |
| 9264 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9265 | |
| 9266 | /* enable unsolicited event */ |
| 9267 | /* |
| 9268 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9269 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9270 | */ |
| 9271 | |
| 9272 | { } /* end */ |
| 9273 | }; |
| 9274 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9275 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9276 | /* HP */ |
| 9277 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9278 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9279 | /* Int speaker */ |
| 9280 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9281 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9282 | |
| 9283 | /* enable unsolicited event */ |
| 9284 | {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] | 9285 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9286 | |
| 9287 | { } /* end */ |
| 9288 | }; |
| 9289 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9290 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9291 | /* HP */ |
| 9292 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9293 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9294 | /* Subwoofer */ |
| 9295 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9297 | |
| 9298 | /* enable unsolicited event */ |
| 9299 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9300 | |
| 9301 | { } /* end */ |
| 9302 | }; |
| 9303 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9304 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9307 | |
| 9308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9309 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9310 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9311 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9312 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9313 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9314 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9315 | /* Connect Mic jack to CLFE */ |
| 9316 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9317 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9318 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9319 | /* Connect Line-in jack to Surround */ |
| 9320 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9321 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9322 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9323 | /* Connect HP out jack to Front */ |
| 9324 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9325 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9326 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9327 | |
| 9328 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9329 | |
| 9330 | { } /* end */ |
| 9331 | }; |
| 9332 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9333 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9334 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9335 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9336 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9337 | { } /* end */ |
| 9338 | }; |
| 9339 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9340 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9341 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9343 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9344 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9345 | { } /* end */ |
| 9346 | }; |
| 9347 | |
| 9348 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9349 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9350 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9352 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9353 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9354 | { } /* end */ |
| 9355 | }; |
| 9356 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9357 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9358 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9359 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9360 | |
| 9361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9362 | |
| 9363 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9364 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9365 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9366 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9367 | { } /* end */ |
| 9368 | }; |
| 9369 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9370 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9371 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9372 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9373 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9375 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9376 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9377 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9378 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9379 | { } /* end */ |
| 9380 | }; |
| 9381 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9382 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9383 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9384 | { } |
| 9385 | }; |
| 9386 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9387 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9388 | /* HP */ |
| 9389 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9390 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9391 | |
| 9392 | /* enable unsolicited event */ |
| 9393 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9394 | |
| 9395 | { } /* end */ |
| 9396 | }; |
| 9397 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9398 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9399 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9400 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9401 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9402 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9403 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9404 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9405 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9406 | } |
| 9407 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9408 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9409 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9410 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9411 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9412 | {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] | 9413 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9414 | }; |
| 9415 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9416 | /* |
| 9417 | * 2ch mode |
| 9418 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9419 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9420 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9421 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9422 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9423 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9424 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9425 | }; |
| 9426 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9427 | /* |
| 9428 | * 4ch mode |
| 9429 | */ |
| 9430 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9431 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9432 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9433 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9434 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9435 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9436 | { } /* end */ |
| 9437 | }; |
| 9438 | |
| 9439 | /* |
| 9440 | * 6ch mode |
| 9441 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9442 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9443 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9444 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9445 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9446 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9447 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9448 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9449 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9450 | }; |
| 9451 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9452 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9453 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9454 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9455 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9456 | }; |
| 9457 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9458 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9459 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9460 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9461 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9462 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9463 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9464 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9465 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9466 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9467 | } |
| 9468 | |
| 9469 | /* toggle RCA according to the front-jack state */ |
| 9470 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9471 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9472 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9473 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9474 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9475 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9476 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9477 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9478 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9479 | unsigned int res) |
| 9480 | { |
| 9481 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9482 | alc888_lenovo_ms7195_front_automute(codec); |
| 9483 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9484 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9485 | } |
| 9486 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9487 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9488 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9489 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9490 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9491 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9492 | spec->autocfg.hp_pins[0] = 0x14; |
| 9493 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9494 | } |
| 9495 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9496 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9497 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9498 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9499 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9500 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9501 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9502 | struct alc_spec *spec = codec->spec; |
| 9503 | |
| 9504 | spec->autocfg.hp_pins[0] = 0x15; |
| 9505 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9506 | } |
| 9507 | |
| 9508 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9509 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9510 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9511 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9512 | } |
| 9513 | |
| 9514 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9515 | unsigned int res) |
| 9516 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9517 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9518 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9519 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9520 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9521 | default: |
| 9522 | alc_automute_amp_unsol_event(codec, res); |
| 9523 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9524 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9525 | } |
| 9526 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9527 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9528 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9529 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9530 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9531 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9532 | spec->autocfg.hp_pins[0] = 0x14; |
| 9533 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9534 | } |
| 9535 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9536 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9537 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9538 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9539 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9540 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9541 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9542 | } |
| 9543 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9544 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9545 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9546 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +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, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9550 | } |
| 9551 | |
| 9552 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9553 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9554 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9555 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9556 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9557 | HDA_AMP_MUTE, bits); |
| 9558 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9559 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9560 | } |
| 9561 | |
| 9562 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9563 | unsigned int res) |
| 9564 | { |
| 9565 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9566 | alc883_lenovo_101e_all_automute(codec); |
| 9567 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9568 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9569 | } |
| 9570 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9571 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9572 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9573 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9574 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9575 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9576 | spec->autocfg.hp_pins[0] = 0x14; |
| 9577 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9578 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9579 | } |
| 9580 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9581 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9582 | /* HP Pin: output 0 (0x0c) */ |
| 9583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9584 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9585 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9586 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9587 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9588 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9589 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9590 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9591 | /* eanable EAPD on medion laptop */ |
| 9592 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9593 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9594 | /* enable unsolicited event */ |
| 9595 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9596 | { } |
| 9597 | }; |
| 9598 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9599 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9600 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9601 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9602 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9603 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9604 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9605 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9606 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9607 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9608 | } |
| 9609 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9610 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9611 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9612 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +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; |
| 9616 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9617 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9618 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9619 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9620 | } |
| 9621 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9622 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9623 | { |
| 9624 | struct alc_spec *spec = codec->spec; |
| 9625 | |
| 9626 | spec->autocfg.hp_pins[0] = 0x15; |
| 9627 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9628 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9629 | } |
| 9630 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9631 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9632 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9635 | /* enable unsolicited event */ |
| 9636 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9637 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9638 | { } /* end */ |
| 9639 | }; |
| 9640 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9641 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9642 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9643 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9644 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9645 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9646 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9647 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9648 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9649 | spec->ext_mic.pin = 0x18; |
| 9650 | spec->int_mic.pin = 0x19; |
| 9651 | spec->ext_mic.mux_idx = 0; |
| 9652 | spec->int_mic.mux_idx = 1; |
| 9653 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9654 | } |
| 9655 | |
| 9656 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9657 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9658 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9659 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9660 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9661 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9662 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9663 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9664 | /* enable unsolicited event */ |
| 9665 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9666 | { } /* end */ |
| 9667 | }; |
| 9668 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9669 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9670 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9671 | struct alc_spec *spec = codec->spec; |
| 9672 | |
| 9673 | spec->autocfg.hp_pins[0] = 0x14; |
| 9674 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9675 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9676 | } |
| 9677 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9678 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9679 | /* Init rear pin (used as headphone output) */ |
| 9680 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9681 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9682 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9683 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9684 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9685 | /* Init line 2 pin (used as headphone out by default) */ |
| 9686 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9687 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9688 | { } /* end */ |
| 9689 | }; |
| 9690 | |
| 9691 | /* Mute speakers according to the headphone jack state */ |
| 9692 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9693 | { |
| 9694 | unsigned int present; |
| 9695 | |
| 9696 | /* Mute only in 2ch or 4ch mode */ |
| 9697 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9698 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9699 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9700 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9701 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9702 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9703 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9704 | } |
| 9705 | } |
| 9706 | |
| 9707 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9708 | { |
| 9709 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9710 | alc889A_mb31_automute(codec); |
| 9711 | } |
| 9712 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9713 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9714 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9715 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9716 | #endif |
| 9717 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9718 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9719 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9720 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9721 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9722 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9723 | |
| 9724 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9725 | ALC1200_DIGOUT_NID, 0, |
| 9726 | }; |
| 9727 | |
| 9728 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9729 | ALC883_DIGOUT_NID, 0, |
| 9730 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9731 | |
| 9732 | /* |
| 9733 | * configuration and preset |
| 9734 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9735 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9736 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9737 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9738 | [ALC882_ARIMA] = "arima", |
| 9739 | [ALC882_W2JC] = "w2jc", |
| 9740 | [ALC882_TARGA] = "targa", |
| 9741 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9742 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9743 | [ALC885_MACPRO] = "macpro", |
| 9744 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9745 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9746 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9747 | [ALC885_MBP3] = "mbp3", |
| 9748 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9749 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9750 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9751 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9752 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9753 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9754 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9755 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9756 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9757 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9758 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9759 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9760 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9761 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9762 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9763 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9764 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9765 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9766 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9767 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9768 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9769 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9770 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9771 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9772 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9773 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9774 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9775 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9776 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9777 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9778 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9779 | [ALC889A_INTEL] = "intel-alc889a", |
| 9780 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9781 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9782 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9783 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9784 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9785 | }; |
| 9786 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9787 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9788 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9789 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9790 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9791 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9792 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9793 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9794 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9795 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9796 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9797 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9798 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9799 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9800 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9801 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9802 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9803 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9804 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9805 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9806 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9807 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9808 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9809 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9810 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9811 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9812 | /* default Acer -- disabled as it causes more problems. |
| 9813 | * model=auto should work fine now |
| 9814 | */ |
| 9815 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9816 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9817 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9818 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9819 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9820 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9821 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9822 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9823 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9824 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9825 | |
| 9826 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9827 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9828 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9829 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9830 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9831 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9832 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9833 | 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] | 9834 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9835 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9836 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9837 | |
| 9838 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9839 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9840 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9841 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9842 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9843 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9844 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9845 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9846 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9847 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9848 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9849 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9850 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9851 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9852 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9853 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9854 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9855 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9856 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9857 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9858 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9859 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9860 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9861 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9862 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9863 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9864 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9865 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9866 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9867 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9868 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9869 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9870 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9871 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9872 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9873 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9874 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9875 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9876 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9877 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9878 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9879 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9880 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9881 | 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] | 9882 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9883 | 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] | 9884 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9885 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9886 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9887 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9888 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9889 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9890 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9891 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9892 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9893 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9894 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9895 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9896 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9897 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9898 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9899 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9901 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9902 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9903 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9904 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9905 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9906 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9907 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9908 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9909 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9910 | {} |
| 9911 | }; |
| 9912 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9913 | /* codec SSID table for Intel Mac */ |
| 9914 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9915 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9916 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9917 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9918 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9919 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9920 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9921 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9922 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9923 | 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] | 9924 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9926 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9927 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9928 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9929 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9930 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9931 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9932 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9933 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9934 | */ |
| 9935 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9936 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9937 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9938 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9939 | }; |
| 9940 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9941 | static struct alc_config_preset alc882_presets[] = { |
| 9942 | [ALC882_3ST_DIG] = { |
| 9943 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9944 | .init_verbs = { alc882_base_init_verbs, |
| 9945 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9946 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9947 | .dac_nids = alc882_dac_nids, |
| 9948 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9949 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9950 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9951 | .channel_mode = alc882_ch_modes, |
| 9952 | .need_dac_fix = 1, |
| 9953 | .input_mux = &alc882_capture_source, |
| 9954 | }, |
| 9955 | [ALC882_6ST_DIG] = { |
| 9956 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9957 | .init_verbs = { alc882_base_init_verbs, |
| 9958 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9959 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9960 | .dac_nids = alc882_dac_nids, |
| 9961 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9962 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9963 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9964 | .channel_mode = alc882_sixstack_modes, |
| 9965 | .input_mux = &alc882_capture_source, |
| 9966 | }, |
| 9967 | [ALC882_ARIMA] = { |
| 9968 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9969 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9970 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9971 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9972 | .dac_nids = alc882_dac_nids, |
| 9973 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9974 | .channel_mode = alc882_sixstack_modes, |
| 9975 | .input_mux = &alc882_capture_source, |
| 9976 | }, |
| 9977 | [ALC882_W2JC] = { |
| 9978 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9979 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9980 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9981 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9982 | .dac_nids = alc882_dac_nids, |
| 9983 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9984 | .channel_mode = alc880_threestack_modes, |
| 9985 | .need_dac_fix = 1, |
| 9986 | .input_mux = &alc882_capture_source, |
| 9987 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9988 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9989 | [ALC885_MBA21] = { |
| 9990 | .mixers = { alc885_mba21_mixer }, |
| 9991 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9992 | .num_dacs = 2, |
| 9993 | .dac_nids = alc882_dac_nids, |
| 9994 | .channel_mode = alc885_mba21_ch_modes, |
| 9995 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9996 | .input_mux = &alc882_capture_source, |
| 9997 | .unsol_event = alc_automute_amp_unsol_event, |
| 9998 | .setup = alc885_mba21_setup, |
| 9999 | .init_hook = alc_automute_amp, |
| 10000 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10001 | [ALC885_MBP3] = { |
| 10002 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10003 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10004 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10005 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10006 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10007 | .hp_nid = 0x04, |
| 10008 | .channel_mode = alc885_mbp_4ch_modes, |
| 10009 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10010 | .input_mux = &alc882_capture_source, |
| 10011 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10012 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10013 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10014 | .setup = alc885_mbp3_setup, |
| 10015 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10016 | }, |
| 10017 | [ALC885_MB5] = { |
| 10018 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10019 | .init_verbs = { alc885_mb5_init_verbs, |
| 10020 | alc880_gpio1_init_verbs }, |
| 10021 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10022 | .dac_nids = alc882_dac_nids, |
| 10023 | .channel_mode = alc885_mb5_6ch_modes, |
| 10024 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10025 | .input_mux = &mb5_capture_source, |
| 10026 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10027 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10028 | .unsol_event = alc_automute_amp_unsol_event, |
| 10029 | .setup = alc885_mb5_setup, |
| 10030 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10031 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10032 | [ALC885_MACMINI3] = { |
| 10033 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10034 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10035 | alc880_gpio1_init_verbs }, |
| 10036 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10037 | .dac_nids = alc882_dac_nids, |
| 10038 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10039 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10040 | .input_mux = &macmini3_capture_source, |
| 10041 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10042 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10043 | .unsol_event = alc_automute_amp_unsol_event, |
| 10044 | .setup = alc885_macmini3_setup, |
| 10045 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10046 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10047 | [ALC885_MACPRO] = { |
| 10048 | .mixers = { alc882_macpro_mixer }, |
| 10049 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10050 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10051 | .dac_nids = alc882_dac_nids, |
| 10052 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10053 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10054 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10055 | .channel_mode = alc882_ch_modes, |
| 10056 | .input_mux = &alc882_capture_source, |
| 10057 | .init_hook = alc885_macpro_init_hook, |
| 10058 | }, |
| 10059 | [ALC885_IMAC24] = { |
| 10060 | .mixers = { alc885_imac24_mixer }, |
| 10061 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10062 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10063 | .dac_nids = alc882_dac_nids, |
| 10064 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10065 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10066 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10067 | .channel_mode = alc882_ch_modes, |
| 10068 | .input_mux = &alc882_capture_source, |
| 10069 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10070 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10071 | .init_hook = alc885_imac24_init_hook, |
| 10072 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10073 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10074 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10075 | .init_verbs = { alc885_imac91_init_verbs, |
| 10076 | alc880_gpio1_init_verbs }, |
| 10077 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10078 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10079 | .channel_mode = alc885_mba21_ch_modes, |
| 10080 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10081 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10082 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10083 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10084 | .unsol_event = alc_automute_amp_unsol_event, |
| 10085 | .setup = alc885_imac91_setup, |
| 10086 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10087 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10088 | [ALC882_TARGA] = { |
| 10089 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10090 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10091 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10092 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10093 | .dac_nids = alc882_dac_nids, |
| 10094 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10095 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10096 | .adc_nids = alc882_adc_nids, |
| 10097 | .capsrc_nids = alc882_capsrc_nids, |
| 10098 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10099 | .channel_mode = alc882_3ST_6ch_modes, |
| 10100 | .need_dac_fix = 1, |
| 10101 | .input_mux = &alc882_capture_source, |
| 10102 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10103 | .setup = alc882_targa_setup, |
| 10104 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10105 | }, |
| 10106 | [ALC882_ASUS_A7J] = { |
| 10107 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10108 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10109 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10110 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10111 | .dac_nids = alc882_dac_nids, |
| 10112 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10113 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10114 | .adc_nids = alc882_adc_nids, |
| 10115 | .capsrc_nids = alc882_capsrc_nids, |
| 10116 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10117 | .channel_mode = alc882_3ST_6ch_modes, |
| 10118 | .need_dac_fix = 1, |
| 10119 | .input_mux = &alc882_capture_source, |
| 10120 | }, |
| 10121 | [ALC882_ASUS_A7M] = { |
| 10122 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10123 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10124 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10125 | alc882_asus_a7m_verbs }, |
| 10126 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10127 | .dac_nids = alc882_dac_nids, |
| 10128 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10129 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10130 | .channel_mode = alc880_threestack_modes, |
| 10131 | .need_dac_fix = 1, |
| 10132 | .input_mux = &alc882_capture_source, |
| 10133 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10134 | [ALC883_3ST_2ch_DIG] = { |
| 10135 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10136 | .init_verbs = { alc883_init_verbs }, |
| 10137 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10138 | .dac_nids = alc883_dac_nids, |
| 10139 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10140 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10141 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10142 | .channel_mode = alc883_3ST_2ch_modes, |
| 10143 | .input_mux = &alc883_capture_source, |
| 10144 | }, |
| 10145 | [ALC883_3ST_6ch_DIG] = { |
| 10146 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10147 | .init_verbs = { alc883_init_verbs }, |
| 10148 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10149 | .dac_nids = alc883_dac_nids, |
| 10150 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10151 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10152 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10153 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10154 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10155 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10156 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10157 | [ALC883_3ST_6ch] = { |
| 10158 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10159 | .init_verbs = { alc883_init_verbs }, |
| 10160 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10161 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10162 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10163 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10164 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10165 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10166 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10167 | [ALC883_3ST_6ch_INTEL] = { |
| 10168 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10169 | .init_verbs = { alc883_init_verbs }, |
| 10170 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10171 | .dac_nids = alc883_dac_nids, |
| 10172 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10173 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10174 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10175 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10176 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10177 | .need_dac_fix = 1, |
| 10178 | .input_mux = &alc883_3stack_6ch_intel, |
| 10179 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10180 | [ALC889A_INTEL] = { |
| 10181 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10182 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10183 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10184 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10185 | .dac_nids = alc883_dac_nids, |
| 10186 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10187 | .adc_nids = alc889_adc_nids, |
| 10188 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10189 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10190 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10191 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10192 | .channel_mode = alc889_8ch_intel_modes, |
| 10193 | .capsrc_nids = alc889_capsrc_nids, |
| 10194 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10195 | .setup = alc889_automute_setup, |
| 10196 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10197 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10198 | .need_dac_fix = 1, |
| 10199 | }, |
| 10200 | [ALC889_INTEL] = { |
| 10201 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10202 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10203 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10204 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10205 | .dac_nids = alc883_dac_nids, |
| 10206 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10207 | .adc_nids = alc889_adc_nids, |
| 10208 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10209 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10210 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10211 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10212 | .channel_mode = alc889_8ch_intel_modes, |
| 10213 | .capsrc_nids = alc889_capsrc_nids, |
| 10214 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10215 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10216 | .init_hook = alc889_intel_init_hook, |
| 10217 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10218 | .need_dac_fix = 1, |
| 10219 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10220 | [ALC883_6ST_DIG] = { |
| 10221 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10222 | .init_verbs = { alc883_init_verbs }, |
| 10223 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10224 | .dac_nids = alc883_dac_nids, |
| 10225 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10226 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10227 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10228 | .channel_mode = alc883_sixstack_modes, |
| 10229 | .input_mux = &alc883_capture_source, |
| 10230 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10231 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10232 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10233 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10234 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10235 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10236 | .dac_nids = alc883_dac_nids, |
| 10237 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10238 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10239 | .channel_mode = alc883_3ST_6ch_modes, |
| 10240 | .need_dac_fix = 1, |
| 10241 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10242 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10243 | .setup = alc882_targa_setup, |
| 10244 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10245 | }, |
| 10246 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10247 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10248 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10249 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10250 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10251 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10252 | .adc_nids = alc883_adc_nids_alt, |
| 10253 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10254 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10255 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10256 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10257 | .channel_mode = alc883_3ST_2ch_modes, |
| 10258 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10259 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10260 | .setup = alc882_targa_setup, |
| 10261 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10262 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10263 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10264 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10265 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10266 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10267 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10268 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10269 | .dac_nids = alc883_dac_nids, |
| 10270 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10271 | .adc_nids = alc883_adc_nids_rev, |
| 10272 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10273 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10274 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10275 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10276 | .channel_mode = alc883_4ST_8ch_modes, |
| 10277 | .need_dac_fix = 1, |
| 10278 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10279 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10280 | .setup = alc882_targa_setup, |
| 10281 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10282 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10283 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10284 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10285 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10286 | * and the headphone jack. Turn this on and rely on the |
| 10287 | * standard mute methods whenever the user wants to turn |
| 10288 | * these outputs off. |
| 10289 | */ |
| 10290 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10291 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10292 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10293 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10294 | .channel_mode = alc883_3ST_2ch_modes, |
| 10295 | .input_mux = &alc883_capture_source, |
| 10296 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10297 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10298 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10299 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10300 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10301 | .dac_nids = alc883_dac_nids, |
| 10302 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10303 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10304 | .channel_mode = alc883_3ST_2ch_modes, |
| 10305 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10306 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10307 | .setup = alc883_acer_aspire_setup, |
| 10308 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10309 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10310 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10311 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10312 | alc883_chmode_mixer }, |
| 10313 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10314 | alc888_acer_aspire_4930g_verbs }, |
| 10315 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10316 | .dac_nids = alc883_dac_nids, |
| 10317 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10318 | .adc_nids = alc883_adc_nids_rev, |
| 10319 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10320 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10321 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10322 | .channel_mode = alc883_3ST_6ch_modes, |
| 10323 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10324 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10325 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10326 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10327 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10328 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10329 | .setup = alc888_acer_aspire_4930g_setup, |
| 10330 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10331 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10332 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10333 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10334 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10335 | alc888_acer_aspire_6530g_verbs }, |
| 10336 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10337 | .dac_nids = alc883_dac_nids, |
| 10338 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10339 | .adc_nids = alc883_adc_nids_rev, |
| 10340 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10341 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10342 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10343 | .channel_mode = alc883_3ST_2ch_modes, |
| 10344 | .num_mux_defs = |
| 10345 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10346 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10347 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10348 | .setup = alc888_acer_aspire_6530g_setup, |
| 10349 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10350 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10351 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10352 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10353 | alc883_chmode_mixer }, |
| 10354 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10355 | alc889_acer_aspire_8930g_verbs, |
| 10356 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10357 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10358 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10359 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10360 | .adc_nids = alc889_adc_nids, |
| 10361 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10362 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10363 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10364 | .channel_mode = alc883_3ST_6ch_modes, |
| 10365 | .need_dac_fix = 1, |
| 10366 | .const_channel_count = 6, |
| 10367 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10368 | ARRAY_SIZE(alc889_capture_sources), |
| 10369 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10370 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10371 | .setup = alc889_acer_aspire_8930g_setup, |
| 10372 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10373 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10374 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10375 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10376 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10377 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10378 | .mixers = { alc883_3ST_6ch_mixer, |
| 10379 | alc883_chmode_mixer }, |
| 10380 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10381 | alc888_acer_aspire_7730G_verbs }, |
| 10382 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10383 | .dac_nids = alc883_dac_nids, |
| 10384 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10385 | .adc_nids = alc883_adc_nids_rev, |
| 10386 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10387 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10388 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10389 | .channel_mode = alc883_3ST_6ch_modes, |
| 10390 | .need_dac_fix = 1, |
| 10391 | .const_channel_count = 6, |
| 10392 | .input_mux = &alc883_capture_source, |
| 10393 | .unsol_event = alc_automute_amp_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10394 | .setup = alc888_acer_aspire_7730g_setup, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10395 | .init_hook = alc_automute_amp, |
| 10396 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10397 | [ALC883_MEDION] = { |
| 10398 | .mixers = { alc883_fivestack_mixer, |
| 10399 | alc883_chmode_mixer }, |
| 10400 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10401 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10402 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10403 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10404 | .adc_nids = alc883_adc_nids_alt, |
| 10405 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10406 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10407 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10408 | .channel_mode = alc883_sixstack_modes, |
| 10409 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10410 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10411 | [ALC883_MEDION_WIM2160] = { |
| 10412 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10413 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10414 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10415 | .dac_nids = alc883_dac_nids, |
| 10416 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10417 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10418 | .adc_nids = alc883_adc_nids, |
| 10419 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10420 | .channel_mode = alc883_3ST_2ch_modes, |
| 10421 | .input_mux = &alc883_capture_source, |
| 10422 | .unsol_event = alc_automute_amp_unsol_event, |
| 10423 | .setup = alc883_medion_wim2160_setup, |
| 10424 | .init_hook = alc_automute_amp, |
| 10425 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10426 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10427 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10428 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10429 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10430 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10431 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10432 | .channel_mode = alc883_3ST_2ch_modes, |
| 10433 | .input_mux = &alc883_capture_source, |
| 10434 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10435 | [ALC883_CLEVO_M540R] = { |
| 10436 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10437 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10438 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10439 | .dac_nids = alc883_dac_nids, |
| 10440 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10441 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10442 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10443 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10444 | .need_dac_fix = 1, |
| 10445 | .input_mux = &alc883_capture_source, |
| 10446 | /* This machine has the hardware HP auto-muting, thus |
| 10447 | * we need no software mute via unsol event |
| 10448 | */ |
| 10449 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10450 | [ALC883_CLEVO_M720] = { |
| 10451 | .mixers = { alc883_clevo_m720_mixer }, |
| 10452 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10453 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10454 | .dac_nids = alc883_dac_nids, |
| 10455 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10456 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10457 | .channel_mode = alc883_3ST_2ch_modes, |
| 10458 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10459 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10460 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10461 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10462 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10463 | [ALC883_LENOVO_101E_2ch] = { |
| 10464 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10465 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10466 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10467 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10468 | .adc_nids = alc883_adc_nids_alt, |
| 10469 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10470 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10471 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10472 | .channel_mode = alc883_3ST_2ch_modes, |
| 10473 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10474 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10475 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10476 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10477 | [ALC883_LENOVO_NB0763] = { |
| 10478 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10479 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10480 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10481 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10482 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10483 | .channel_mode = alc883_3ST_2ch_modes, |
| 10484 | .need_dac_fix = 1, |
| 10485 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10486 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10487 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10488 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10489 | }, |
| 10490 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10491 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10492 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10493 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10494 | .dac_nids = alc883_dac_nids, |
| 10495 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10496 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10497 | .channel_mode = alc883_3ST_6ch_modes, |
| 10498 | .need_dac_fix = 1, |
| 10499 | .input_mux = &alc883_capture_source, |
| 10500 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10501 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10502 | }, |
| 10503 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10504 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10505 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10506 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10507 | .dac_nids = alc883_dac_nids, |
| 10508 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10509 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10510 | .channel_mode = alc883_3ST_2ch_modes, |
| 10511 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10512 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10513 | .setup = alc883_haier_w66_setup, |
| 10514 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10515 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10516 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10517 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10518 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10519 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10520 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10521 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10522 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10523 | .need_dac_fix = 1, |
| 10524 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10525 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10526 | .setup = alc888_3st_hp_setup, |
| 10527 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10528 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10529 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10530 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10531 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10532 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10533 | .dac_nids = alc883_dac_nids, |
| 10534 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10535 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10536 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10537 | .channel_mode = alc883_sixstack_modes, |
| 10538 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10539 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10540 | .setup = alc888_6st_dell_setup, |
| 10541 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10542 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10543 | [ALC883_MITAC] = { |
| 10544 | .mixers = { alc883_mitac_mixer }, |
| 10545 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10546 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10547 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10548 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10549 | .channel_mode = alc883_3ST_2ch_modes, |
| 10550 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10551 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10552 | .setup = alc883_mitac_setup, |
| 10553 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10554 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10555 | [ALC883_FUJITSU_PI2515] = { |
| 10556 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10557 | .init_verbs = { alc883_init_verbs, |
| 10558 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10559 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10560 | .dac_nids = alc883_dac_nids, |
| 10561 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10562 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10563 | .channel_mode = alc883_3ST_2ch_modes, |
| 10564 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10565 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10566 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10567 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10568 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10569 | [ALC888_FUJITSU_XA3530] = { |
| 10570 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10571 | .init_verbs = { alc883_init_verbs, |
| 10572 | alc888_fujitsu_xa3530_verbs }, |
| 10573 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10574 | .dac_nids = alc883_dac_nids, |
| 10575 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10576 | .adc_nids = alc883_adc_nids_rev, |
| 10577 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10578 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10579 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10580 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10581 | .num_mux_defs = |
| 10582 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10583 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10584 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10585 | .setup = alc888_fujitsu_xa3530_setup, |
| 10586 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10587 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10588 | [ALC888_LENOVO_SKY] = { |
| 10589 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10590 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10591 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10592 | .dac_nids = alc883_dac_nids, |
| 10593 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10594 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10595 | .channel_mode = alc883_sixstack_modes, |
| 10596 | .need_dac_fix = 1, |
| 10597 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10598 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10599 | .setup = alc888_lenovo_sky_setup, |
| 10600 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10601 | }, |
| 10602 | [ALC888_ASUS_M90V] = { |
| 10603 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10604 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10605 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10606 | .dac_nids = alc883_dac_nids, |
| 10607 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10608 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10609 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10610 | .channel_mode = alc883_3ST_6ch_modes, |
| 10611 | .need_dac_fix = 1, |
| 10612 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10613 | .unsol_event = alc_sku_unsol_event, |
| 10614 | .setup = alc883_mode2_setup, |
| 10615 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10616 | }, |
| 10617 | [ALC888_ASUS_EEE1601] = { |
| 10618 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10619 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10620 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10621 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10622 | .dac_nids = alc883_dac_nids, |
| 10623 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10624 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10625 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10626 | .channel_mode = alc883_3ST_2ch_modes, |
| 10627 | .need_dac_fix = 1, |
| 10628 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10629 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10630 | .init_hook = alc883_eee1601_inithook, |
| 10631 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10632 | [ALC1200_ASUS_P5Q] = { |
| 10633 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10634 | .init_verbs = { alc883_init_verbs }, |
| 10635 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10636 | .dac_nids = alc883_dac_nids, |
| 10637 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10638 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10639 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10640 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10641 | .channel_mode = alc883_sixstack_modes, |
| 10642 | .input_mux = &alc883_capture_source, |
| 10643 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10644 | [ALC889A_MB31] = { |
| 10645 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10646 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10647 | alc880_gpio1_init_verbs }, |
| 10648 | .adc_nids = alc883_adc_nids, |
| 10649 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10650 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10651 | .dac_nids = alc883_dac_nids, |
| 10652 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10653 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10654 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10655 | .input_mux = &alc889A_mb31_capture_source, |
| 10656 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10657 | .unsol_event = alc889A_mb31_unsol_event, |
| 10658 | .init_hook = alc889A_mb31_automute, |
| 10659 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10660 | [ALC883_SONY_VAIO_TT] = { |
| 10661 | .mixers = { alc883_vaiott_mixer }, |
| 10662 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10663 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10664 | .dac_nids = alc883_dac_nids, |
| 10665 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10666 | .channel_mode = alc883_3ST_2ch_modes, |
| 10667 | .input_mux = &alc883_capture_source, |
| 10668 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10669 | .setup = alc883_vaiott_setup, |
| 10670 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10671 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10672 | }; |
| 10673 | |
| 10674 | |
| 10675 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10676 | * Pin config fixes |
| 10677 | */ |
| 10678 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10679 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame^] | 10680 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10681 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10682 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10683 | }; |
| 10684 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10685 | static const struct alc_fixup alc882_fixups[] = { |
| 10686 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10687 | .type = ALC_FIXUP_PINS, |
| 10688 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10689 | { 0x15, 0x01080104 }, /* side */ |
| 10690 | { 0x16, 0x01011012 }, /* rear */ |
| 10691 | { 0x17, 0x01016011 }, /* clfe */ |
| 10692 | { } |
| 10693 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10694 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame^] | 10695 | [PINFIX_LENOVO_Y530] = { |
| 10696 | .type = ALC_FIXUP_PINS, |
| 10697 | .v.pins = (const struct alc_pincfg[]) { |
| 10698 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10699 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10700 | { } |
| 10701 | } |
| 10702 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10703 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10704 | .type = ALC_FIXUP_VERBS, |
| 10705 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10706 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10707 | {} |
| 10708 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10709 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10710 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10711 | .type = ALC_FIXUP_SKU, |
| 10712 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10713 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10714 | }; |
| 10715 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10716 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10717 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame^] | 10718 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10719 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10720 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10721 | {} |
| 10722 | }; |
| 10723 | |
| 10724 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10725 | * BIOS auto configuration |
| 10726 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10727 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10728 | const struct auto_pin_cfg *cfg) |
| 10729 | { |
| 10730 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10731 | } |
| 10732 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10733 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10734 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10735 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10736 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10737 | int idx; |
| 10738 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10739 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10740 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10741 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10742 | if (dac == 0x25) |
| 10743 | idx = 4; |
| 10744 | else if (dac >= 0x02 && dac <= 0x05) |
| 10745 | idx = dac - 2; |
| 10746 | else |
| 10747 | return; |
| 10748 | 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] | 10749 | } |
| 10750 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10751 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10752 | { |
| 10753 | struct alc_spec *spec = codec->spec; |
| 10754 | int i; |
| 10755 | |
| 10756 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10757 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10758 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10759 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10760 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10761 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10762 | } |
| 10763 | } |
| 10764 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10765 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10766 | { |
| 10767 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10768 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10769 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10770 | |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10771 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10772 | pin = spec->autocfg.hp_pins[i]; |
| 10773 | if (!pin) |
| 10774 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10775 | dac = spec->multiout.hp_nid; |
| 10776 | if (!dac) |
| 10777 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10778 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10779 | } |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10780 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10781 | pin = spec->autocfg.speaker_pins[i]; |
| 10782 | if (!pin) |
| 10783 | break; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10784 | dac = spec->multiout.extra_out_nid[0]; |
| 10785 | if (!dac) |
| 10786 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10787 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10788 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10789 | } |
| 10790 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10791 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10792 | { |
| 10793 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10794 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10795 | int i; |
| 10796 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10797 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10798 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10799 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10800 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10801 | snd_hda_codec_write(codec, nid, 0, |
| 10802 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10803 | AMP_OUT_MUTE); |
| 10804 | } |
| 10805 | } |
| 10806 | |
| 10807 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10808 | { |
| 10809 | struct alc_spec *spec = codec->spec; |
| 10810 | int c; |
| 10811 | |
| 10812 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10813 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10814 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10815 | unsigned int mux_idx; |
| 10816 | const struct hda_input_mux *imux; |
| 10817 | int conns, mute, idx, item; |
| 10818 | |
| 10819 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10820 | ARRAY_SIZE(conn_list)); |
| 10821 | if (conns < 0) |
| 10822 | continue; |
| 10823 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10824 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10825 | if (!imux->num_items && mux_idx > 0) |
| 10826 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10827 | for (idx = 0; idx < conns; idx++) { |
| 10828 | /* if the current connection is the selected one, |
| 10829 | * unmute it as default - otherwise mute it |
| 10830 | */ |
| 10831 | mute = AMP_IN_MUTE(idx); |
| 10832 | for (item = 0; item < imux->num_items; item++) { |
| 10833 | if (imux->items[item].index == idx) { |
| 10834 | if (spec->cur_mux[c] == item) |
| 10835 | mute = AMP_IN_UNMUTE(idx); |
| 10836 | break; |
| 10837 | } |
| 10838 | } |
| 10839 | /* check if we have a selector or mixer |
| 10840 | * we could check for the widget type instead, but |
| 10841 | * just check for Amp-In presence (in case of mixer |
| 10842 | * without amp-in there is something wrong, this |
| 10843 | * function shouldn't be used or capsrc nid is wrong) |
| 10844 | */ |
| 10845 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10846 | snd_hda_codec_write(codec, nid, 0, |
| 10847 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10848 | mute); |
| 10849 | else if (mute != AMP_IN_MUTE(idx)) |
| 10850 | snd_hda_codec_write(codec, nid, 0, |
| 10851 | AC_VERB_SET_CONNECT_SEL, |
| 10852 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10853 | } |
| 10854 | } |
| 10855 | } |
| 10856 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10857 | /* add mic boosts if needed */ |
| 10858 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10859 | { |
| 10860 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10861 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10862 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10863 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10864 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10865 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10866 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10867 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10868 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10869 | break; |
| 10870 | nid = cfg->inputs[i].pin; |
| 10871 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10872 | const char *label; |
| 10873 | char boost_label[32]; |
| 10874 | |
| 10875 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 10876 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10877 | type_idx++; |
| 10878 | else |
| 10879 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10880 | prev_label = label; |
| 10881 | |
| 10882 | snprintf(boost_label, sizeof(boost_label), |
| 10883 | "%s Boost Volume", label); |
| 10884 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10885 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10886 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10887 | if (err < 0) |
| 10888 | return err; |
| 10889 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10890 | } |
| 10891 | return 0; |
| 10892 | } |
| 10893 | |
| 10894 | /* almost identical with ALC880 parser... */ |
| 10895 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10896 | { |
| 10897 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10898 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10899 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10900 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10901 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10902 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10903 | if (err < 0) |
| 10904 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10905 | if (!spec->autocfg.line_outs) |
| 10906 | return 0; /* can't find valid BIOS pin config */ |
| 10907 | |
| 10908 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10909 | if (err < 0) |
| 10910 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 10911 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10912 | if (err < 0) |
| 10913 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10914 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10915 | "Headphone"); |
| 10916 | if (err < 0) |
| 10917 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10918 | err = alc880_auto_create_extra_out(spec, |
| 10919 | spec->autocfg.speaker_pins[0], |
| 10920 | "Speaker"); |
| 10921 | if (err < 0) |
| 10922 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10923 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10924 | if (err < 0) |
| 10925 | return err; |
| 10926 | |
| 10927 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10928 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10929 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10930 | |
| 10931 | if (spec->kctls.list) |
| 10932 | add_mixer(spec, spec->kctls.list); |
| 10933 | |
| 10934 | add_verb(spec, alc883_auto_init_verbs); |
| 10935 | /* if ADC 0x07 is available, initialize it, too */ |
| 10936 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10937 | add_verb(spec, alc882_adc1_init_verbs); |
| 10938 | |
| 10939 | spec->num_mux_defs = 1; |
| 10940 | spec->input_mux = &spec->private_imux[0]; |
| 10941 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10942 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10943 | |
| 10944 | err = alc_auto_add_mic_boost(codec); |
| 10945 | if (err < 0) |
| 10946 | return err; |
| 10947 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10948 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10949 | } |
| 10950 | |
| 10951 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10952 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10953 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10954 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10955 | alc882_auto_init_multi_out(codec); |
| 10956 | alc882_auto_init_hp_out(codec); |
| 10957 | alc882_auto_init_analog_input(codec); |
| 10958 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10959 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10960 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10961 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10962 | } |
| 10963 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10964 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10965 | { |
| 10966 | struct alc_spec *spec; |
| 10967 | int err, board_config; |
| 10968 | |
| 10969 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10970 | if (spec == NULL) |
| 10971 | return -ENOMEM; |
| 10972 | |
| 10973 | codec->spec = spec; |
| 10974 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10975 | switch (codec->vendor_id) { |
| 10976 | case 0x10ec0882: |
| 10977 | case 0x10ec0885: |
| 10978 | break; |
| 10979 | default: |
| 10980 | /* ALC883 and variants */ |
| 10981 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10982 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10983 | } |
| 10984 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10985 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10986 | alc882_models, |
| 10987 | alc882_cfg_tbl); |
| 10988 | |
| 10989 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10990 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10991 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10992 | |
| 10993 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10994 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10995 | codec->chip_name); |
| 10996 | board_config = ALC882_AUTO; |
| 10997 | } |
| 10998 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10999 | if (board_config == ALC882_AUTO) { |
| 11000 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11001 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11002 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11003 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11004 | alc_auto_parse_customize_define(codec); |
| 11005 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11006 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11007 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11008 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11009 | if (err < 0) { |
| 11010 | alc_free(codec); |
| 11011 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11012 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11013 | printk(KERN_INFO |
| 11014 | "hda_codec: Cannot set up configuration " |
| 11015 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11016 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11017 | } |
| 11018 | } |
| 11019 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11020 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11021 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11022 | if (err < 0) { |
| 11023 | alc_free(codec); |
| 11024 | return err; |
| 11025 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11026 | } |
| 11027 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11028 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11029 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11030 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11031 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11032 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11033 | /* FIXME: setup DAC5 */ |
| 11034 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11035 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11036 | |
| 11037 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11038 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11039 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11040 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11041 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11042 | spec->num_adc_nids = 0; |
| 11043 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11044 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11045 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11046 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11047 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11048 | unsigned int wcap = get_wcaps(codec, nid); |
| 11049 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11050 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11051 | if (wcap != AC_WID_AUD_IN) |
| 11052 | continue; |
| 11053 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11054 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11055 | if (err < 0) |
| 11056 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11057 | err = snd_hda_get_connections(codec, cap, items, |
| 11058 | ARRAY_SIZE(items)); |
| 11059 | if (err < 0) |
| 11060 | continue; |
| 11061 | for (j = 0; j < imux->num_items; j++) |
| 11062 | if (imux->items[j].index >= err) |
| 11063 | break; |
| 11064 | if (j < imux->num_items) |
| 11065 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11066 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11067 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11068 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11069 | spec->adc_nids = spec->private_adc_nids; |
| 11070 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11071 | } |
| 11072 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11073 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11074 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11075 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11076 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11077 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11078 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11079 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11080 | spec->vmaster_nid = 0x0c; |
| 11081 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11082 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11083 | if (board_config == ALC882_AUTO) |
| 11084 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11085 | |
| 11086 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11087 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11088 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11089 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11090 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11091 | |
| 11092 | return 0; |
| 11093 | } |
| 11094 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11095 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11096 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11097 | * ALC262 support |
| 11098 | */ |
| 11099 | |
| 11100 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11101 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11102 | |
| 11103 | #define alc262_dac_nids alc260_dac_nids |
| 11104 | #define alc262_adc_nids alc882_adc_nids |
| 11105 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11106 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11107 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11108 | |
| 11109 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11110 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11111 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11112 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11113 | /* ADC0 */ |
| 11114 | 0x09 |
| 11115 | }; |
| 11116 | |
| 11117 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11118 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11119 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11120 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11121 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11122 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11123 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11124 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11125 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11126 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11127 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11128 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11129 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11130 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11131 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11133 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11134 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11135 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11136 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11137 | }; |
| 11138 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11139 | /* update HP, line and mono-out pins according to the master switch */ |
| 11140 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 11141 | { |
| 11142 | struct alc_spec *spec = codec->spec; |
| 11143 | int val = spec->master_sw; |
| 11144 | |
| 11145 | /* HP & line-out */ |
| 11146 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 11147 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11148 | val ? PIN_HP : 0); |
| 11149 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11150 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11151 | val ? PIN_HP : 0); |
| 11152 | /* mono (speaker) depending on the HP jack sense */ |
| 11153 | val = val && !spec->jack_present; |
| 11154 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 11155 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11156 | val ? PIN_OUT : 0); |
| 11157 | } |
| 11158 | |
| 11159 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 11160 | { |
| 11161 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11162 | |
| 11163 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11164 | alc262_hp_master_update(codec); |
| 11165 | } |
| 11166 | |
| 11167 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11168 | { |
| 11169 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11170 | return; |
| 11171 | alc262_hp_bpc_automute(codec); |
| 11172 | } |
| 11173 | |
| 11174 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 11175 | { |
| 11176 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11177 | |
| 11178 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11179 | alc262_hp_master_update(codec); |
| 11180 | } |
| 11181 | |
| 11182 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 11183 | unsigned int res) |
| 11184 | { |
| 11185 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11186 | return; |
| 11187 | alc262_hp_wildwest_automute(codec); |
| 11188 | } |
| 11189 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11190 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11191 | |
| 11192 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11193 | struct snd_ctl_elem_value *ucontrol) |
| 11194 | { |
| 11195 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11196 | struct alc_spec *spec = codec->spec; |
| 11197 | int val = !!*ucontrol->value.integer.value; |
| 11198 | |
| 11199 | if (val == spec->master_sw) |
| 11200 | return 0; |
| 11201 | spec->master_sw = val; |
| 11202 | alc262_hp_master_update(codec); |
| 11203 | return 1; |
| 11204 | } |
| 11205 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11206 | #define ALC262_HP_MASTER_SWITCH \ |
| 11207 | { \ |
| 11208 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11209 | .name = "Master Playback Switch", \ |
| 11210 | .info = snd_ctl_boolean_mono_info, \ |
| 11211 | .get = alc262_hp_master_sw_get, \ |
| 11212 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11213 | }, \ |
| 11214 | { \ |
| 11215 | .iface = NID_MAPPING, \ |
| 11216 | .name = "Master Playback Switch", \ |
| 11217 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11218 | } |
| 11219 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11220 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11221 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11222 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11223 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11224 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11225 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11226 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11227 | HDA_OUTPUT), |
| 11228 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11229 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11232 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11233 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11234 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11235 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11237 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11239 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11240 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11241 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11242 | { } /* end */ |
| 11243 | }; |
| 11244 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11245 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11246 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11247 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11248 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11249 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11250 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11251 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11252 | HDA_OUTPUT), |
| 11253 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11254 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11255 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11256 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11257 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11258 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11259 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11260 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11261 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11262 | { } /* end */ |
| 11263 | }; |
| 11264 | |
| 11265 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11266 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11267 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11268 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11269 | { } /* end */ |
| 11270 | }; |
| 11271 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11272 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11273 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11274 | { |
| 11275 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11276 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11277 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11278 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11279 | } |
| 11280 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11281 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11282 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11283 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11284 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11285 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11288 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11289 | { } /* end */ |
| 11290 | }; |
| 11291 | |
| 11292 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11293 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11294 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11295 | |
| 11296 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11297 | { } |
| 11298 | }; |
| 11299 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11300 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11301 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11302 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11303 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11304 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11305 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11306 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11307 | { } /* end */ |
| 11308 | }; |
| 11309 | |
| 11310 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11311 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11312 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11313 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11314 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11315 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11316 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11317 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11319 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11321 | {} |
| 11322 | }; |
| 11323 | |
| 11324 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11325 | .num_items = 1, |
| 11326 | .items = { |
| 11327 | { "Line", 0x1 }, |
| 11328 | }, |
| 11329 | }; |
| 11330 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11331 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11332 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11333 | { |
| 11334 | struct alc_spec *spec = codec->spec; |
| 11335 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11336 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11337 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11338 | unsigned int mute; |
| 11339 | |
| 11340 | /* HP */ |
| 11341 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11342 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11343 | HDA_AMP_MUTE, mute); |
| 11344 | /* mute internal speaker per jack sense */ |
| 11345 | if (spec->jack_present) |
| 11346 | mute = HDA_AMP_MUTE; |
| 11347 | if (line_nid) |
| 11348 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11349 | HDA_AMP_MUTE, mute); |
| 11350 | if (speaker_nid && speaker_nid != line_nid) |
| 11351 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11352 | HDA_AMP_MUTE, mute); |
| 11353 | } |
| 11354 | |
| 11355 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11356 | |
| 11357 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11358 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11359 | { |
| 11360 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11361 | struct alc_spec *spec = codec->spec; |
| 11362 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11363 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11364 | if (val == spec->master_sw) |
| 11365 | return 0; |
| 11366 | spec->master_sw = val; |
| 11367 | alc262_hippo_master_update(codec); |
| 11368 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11369 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11370 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11371 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11372 | { \ |
| 11373 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11374 | .name = "Master Playback Switch", \ |
| 11375 | .info = snd_ctl_boolean_mono_info, \ |
| 11376 | .get = alc262_hippo_master_sw_get, \ |
| 11377 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11378 | }, \ |
| 11379 | { \ |
| 11380 | .iface = NID_MAPPING, \ |
| 11381 | .name = "Master Playback Switch", \ |
| 11382 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11383 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11384 | } |
| 11385 | |
| 11386 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11387 | ALC262_HIPPO_MASTER_SWITCH, |
| 11388 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11389 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11390 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11391 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11392 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11393 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11394 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11395 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11396 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11397 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11398 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11399 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11400 | { } /* end */ |
| 11401 | }; |
| 11402 | |
| 11403 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11404 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11405 | ALC262_HIPPO_MASTER_SWITCH, |
| 11406 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11407 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11408 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11409 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11410 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11411 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11412 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11413 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11414 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11415 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11416 | { } /* end */ |
| 11417 | }; |
| 11418 | |
| 11419 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11420 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11421 | { |
| 11422 | struct alc_spec *spec = codec->spec; |
| 11423 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11424 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11425 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11426 | alc262_hippo_master_update(codec); |
| 11427 | } |
| 11428 | |
| 11429 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11430 | { |
| 11431 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11432 | return; |
| 11433 | alc262_hippo_automute(codec); |
| 11434 | } |
| 11435 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11436 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11437 | { |
| 11438 | struct alc_spec *spec = codec->spec; |
| 11439 | |
| 11440 | spec->autocfg.hp_pins[0] = 0x15; |
| 11441 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11442 | } |
| 11443 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11444 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11445 | { |
| 11446 | struct alc_spec *spec = codec->spec; |
| 11447 | |
| 11448 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11449 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11450 | } |
| 11451 | |
| 11452 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11453 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11454 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11455 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11458 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11459 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11460 | { } /* end */ |
| 11461 | }; |
| 11462 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11463 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11464 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11465 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11466 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11469 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11470 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11471 | { } /* end */ |
| 11472 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11473 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11474 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11475 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11476 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11477 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11478 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11479 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11480 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11481 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11482 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11483 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11484 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11485 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11486 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11487 | { } /* end */ |
| 11488 | }; |
| 11489 | |
| 11490 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11491 | /* Headphone automute */ |
| 11492 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11493 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11494 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11495 | |
| 11496 | /* P11 AUX_IN, white 4-pin connector */ |
| 11497 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11498 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11499 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11500 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11501 | |
| 11502 | {} |
| 11503 | }; |
| 11504 | |
| 11505 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11506 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11507 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11508 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11509 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11510 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11511 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11512 | } |
| 11513 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11515 | #define alc262_capture_mixer alc882_capture_mixer |
| 11516 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11517 | |
| 11518 | /* |
| 11519 | * generic initialization of ADC, input mixers and output mixers |
| 11520 | */ |
| 11521 | static struct hda_verb alc262_init_verbs[] = { |
| 11522 | /* |
| 11523 | * Unmute ADC0-2 and set the default input to mic-in |
| 11524 | */ |
| 11525 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11526 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11527 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11528 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11529 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11530 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11531 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11532 | /* 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] | 11533 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11534 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11535 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11536 | */ |
| 11537 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11538 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11539 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11540 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11541 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11542 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11543 | |
| 11544 | /* |
| 11545 | * Set up output mixers (0x0c - 0x0e) |
| 11546 | */ |
| 11547 | /* set vol=0 to output mixers */ |
| 11548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11549 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11550 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11551 | /* set up input amps for analog loopback */ |
| 11552 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11555 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11556 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11557 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11558 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11559 | |
| 11560 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11561 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11562 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11563 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11564 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11565 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11566 | |
| 11567 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11568 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11569 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11570 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11572 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11573 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11574 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11575 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11576 | /* FIXME: use matrix-type input source selection */ |
| 11577 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11578 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11579 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11580 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11581 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11582 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11583 | /* Input mixer2 */ |
| 11584 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11585 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11586 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11587 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11588 | /* Input mixer3 */ |
| 11589 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11590 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11591 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11592 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11593 | |
| 11594 | { } |
| 11595 | }; |
| 11596 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11597 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11598 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11599 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11600 | { } |
| 11601 | }; |
| 11602 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11603 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11604 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11605 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11606 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11607 | |
| 11608 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11609 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11610 | {} |
| 11611 | }; |
| 11612 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11613 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11614 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11615 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11616 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11617 | |
| 11618 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11619 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11620 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11621 | }; |
| 11622 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11623 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11624 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11625 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11626 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11627 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11628 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11629 | { } /* end */ |
| 11630 | }; |
| 11631 | |
| 11632 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11633 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11634 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11636 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11637 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11638 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11639 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11640 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11641 | {} |
| 11642 | }; |
| 11643 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11644 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11645 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11646 | struct alc_spec *spec = codec->spec; |
| 11647 | |
| 11648 | spec->autocfg.hp_pins[0] = 0x15; |
| 11649 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11650 | spec->ext_mic.pin = 0x18; |
| 11651 | spec->ext_mic.mux_idx = 0; |
| 11652 | spec->int_mic.pin = 0x12; |
| 11653 | spec->int_mic.mux_idx = 9; |
| 11654 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11655 | } |
| 11656 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11657 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11658 | * nec model |
| 11659 | * 0x15 = headphone |
| 11660 | * 0x16 = internal speaker |
| 11661 | * 0x18 = external mic |
| 11662 | */ |
| 11663 | |
| 11664 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11665 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11666 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11667 | |
| 11668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11670 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11671 | |
| 11672 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11673 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11674 | { } /* end */ |
| 11675 | }; |
| 11676 | |
| 11677 | static struct hda_verb alc262_nec_verbs[] = { |
| 11678 | /* Unmute Speaker */ |
| 11679 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11680 | |
| 11681 | /* Headphone */ |
| 11682 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11684 | |
| 11685 | /* External mic to headphone */ |
| 11686 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11687 | /* External mic to speaker */ |
| 11688 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11689 | {} |
| 11690 | }; |
| 11691 | |
| 11692 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11693 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11694 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11695 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11696 | */ |
| 11697 | |
| 11698 | #define ALC_HP_EVENT 0x37 |
| 11699 | |
| 11700 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11701 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11703 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11704 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11705 | {} |
| 11706 | }; |
| 11707 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11708 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11709 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11710 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11711 | {} |
| 11712 | }; |
| 11713 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11714 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11715 | /* Front Mic pin: input vref at 50% */ |
| 11716 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11717 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11718 | {} |
| 11719 | }; |
| 11720 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11721 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11722 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11723 | .items = { |
| 11724 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11725 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11726 | { "CD", 0x4 }, |
| 11727 | }, |
| 11728 | }; |
| 11729 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11730 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11731 | .num_items = 5, |
| 11732 | .items = { |
| 11733 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11734 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11735 | { "Line", 0x2 }, |
| 11736 | { "CD", 0x4 }, |
| 11737 | { "AUX IN", 0x6 }, |
| 11738 | }, |
| 11739 | }; |
| 11740 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11741 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11742 | .num_items = 4, |
| 11743 | .items = { |
| 11744 | { "Mic", 0x0 }, |
| 11745 | { "Front Mic", 0x2 }, |
| 11746 | { "Line", 0x1 }, |
| 11747 | { "CD", 0x4 }, |
| 11748 | }, |
| 11749 | }; |
| 11750 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11751 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11752 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11753 | { |
| 11754 | struct alc_spec *spec = codec->spec; |
| 11755 | unsigned int mute; |
| 11756 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11757 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11758 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11759 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11760 | spec->sense_updated = 1; |
| 11761 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11762 | /* unmute internal speaker only if both HPs are unplugged and |
| 11763 | * master switch is on |
| 11764 | */ |
| 11765 | if (spec->jack_present) |
| 11766 | mute = HDA_AMP_MUTE; |
| 11767 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11768 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11769 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11770 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11771 | } |
| 11772 | |
| 11773 | /* unsolicited event for HP jack sensing */ |
| 11774 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11775 | unsigned int res) |
| 11776 | { |
| 11777 | if ((res >> 26) != ALC_HP_EVENT) |
| 11778 | return; |
| 11779 | alc262_fujitsu_automute(codec, 1); |
| 11780 | } |
| 11781 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11782 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11783 | { |
| 11784 | alc262_fujitsu_automute(codec, 1); |
| 11785 | } |
| 11786 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11787 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11788 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11789 | .ops = &snd_hda_bind_vol, |
| 11790 | .values = { |
| 11791 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11792 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11793 | 0 |
| 11794 | }, |
| 11795 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11796 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11797 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11798 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11799 | { |
| 11800 | struct alc_spec *spec = codec->spec; |
| 11801 | unsigned int mute; |
| 11802 | |
| 11803 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11804 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11805 | spec->sense_updated = 1; |
| 11806 | } |
| 11807 | if (spec->jack_present) { |
| 11808 | /* mute internal speaker */ |
| 11809 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11810 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11811 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11812 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11813 | } else { |
| 11814 | /* unmute internal speaker if necessary */ |
| 11815 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11816 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11817 | HDA_AMP_MUTE, mute); |
| 11818 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11819 | HDA_AMP_MUTE, mute); |
| 11820 | } |
| 11821 | } |
| 11822 | |
| 11823 | /* unsolicited event for HP jack sensing */ |
| 11824 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11825 | unsigned int res) |
| 11826 | { |
| 11827 | if ((res >> 26) != ALC_HP_EVENT) |
| 11828 | return; |
| 11829 | alc262_lenovo_3000_automute(codec, 1); |
| 11830 | } |
| 11831 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11832 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11833 | int dir, int idx, long *valp) |
| 11834 | { |
| 11835 | int i, change = 0; |
| 11836 | |
| 11837 | for (i = 0; i < 2; i++, valp++) |
| 11838 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11839 | HDA_AMP_MUTE, |
| 11840 | *valp ? 0 : HDA_AMP_MUTE); |
| 11841 | return change; |
| 11842 | } |
| 11843 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11844 | /* bind hp and internal speaker mute (with plug check) */ |
| 11845 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11846 | struct snd_ctl_elem_value *ucontrol) |
| 11847 | { |
| 11848 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11849 | long *valp = ucontrol->value.integer.value; |
| 11850 | int change; |
| 11851 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11852 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11853 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11854 | if (change) |
| 11855 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11856 | return change; |
| 11857 | } |
| 11858 | |
| 11859 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11860 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11861 | { |
| 11862 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11863 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11864 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11865 | .info = snd_hda_mixer_amp_switch_info, |
| 11866 | .get = snd_hda_mixer_amp_switch_get, |
| 11867 | .put = alc262_fujitsu_master_sw_put, |
| 11868 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11869 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11870 | { |
| 11871 | .iface = NID_MAPPING, |
| 11872 | .name = "Master Playback Switch", |
| 11873 | .private_value = 0x1b, |
| 11874 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11875 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11876 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11877 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11880 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11881 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11882 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11883 | { } /* end */ |
| 11884 | }; |
| 11885 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11886 | /* bind hp and internal speaker mute (with plug check) */ |
| 11887 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11888 | struct snd_ctl_elem_value *ucontrol) |
| 11889 | { |
| 11890 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11891 | long *valp = ucontrol->value.integer.value; |
| 11892 | int change; |
| 11893 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11894 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11895 | if (change) |
| 11896 | alc262_lenovo_3000_automute(codec, 0); |
| 11897 | return change; |
| 11898 | } |
| 11899 | |
| 11900 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11901 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11902 | { |
| 11903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11904 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11905 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11906 | .info = snd_hda_mixer_amp_switch_info, |
| 11907 | .get = snd_hda_mixer_amp_switch_get, |
| 11908 | .put = alc262_lenovo_3000_master_sw_put, |
| 11909 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11910 | }, |
| 11911 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11912 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11913 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11914 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11915 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11916 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11917 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11918 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11919 | { } /* end */ |
| 11920 | }; |
| 11921 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11922 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11923 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11924 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11925 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11926 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11927 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11928 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11929 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11930 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11931 | { } /* end */ |
| 11932 | }; |
| 11933 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11934 | /* additional init verbs for Benq laptops */ |
| 11935 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11936 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11937 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11938 | {} |
| 11939 | }; |
| 11940 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11941 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11942 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11943 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11944 | |
| 11945 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11946 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11947 | {} |
| 11948 | }; |
| 11949 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11950 | /* Samsung Q1 Ultra Vista model setup */ |
| 11951 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11952 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11953 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11956 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 11957 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11958 | { } /* end */ |
| 11959 | }; |
| 11960 | |
| 11961 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11962 | /* output mixer */ |
| 11963 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11964 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11965 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11966 | /* speaker */ |
| 11967 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11969 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11970 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11971 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11972 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11976 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11977 | /* internal mic */ |
| 11978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11979 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11980 | /* ADC, choose mic */ |
| 11981 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11982 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11983 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11986 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11987 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11988 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11991 | {} |
| 11992 | }; |
| 11993 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11994 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11995 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11996 | { |
| 11997 | struct alc_spec *spec = codec->spec; |
| 11998 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11999 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12000 | mute = 0; |
| 12001 | /* auto-mute only when HP is used as HP */ |
| 12002 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12003 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12004 | if (spec->jack_present) |
| 12005 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12006 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12007 | /* mute/unmute internal speaker */ |
| 12008 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12009 | HDA_AMP_MUTE, mute); |
| 12010 | /* mute/unmute HP */ |
| 12011 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12012 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12013 | } |
| 12014 | |
| 12015 | /* unsolicited event for HP jack sensing */ |
| 12016 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12017 | unsigned int res) |
| 12018 | { |
| 12019 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12020 | return; |
| 12021 | alc262_ultra_automute(codec); |
| 12022 | } |
| 12023 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12024 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12025 | .num_items = 2, |
| 12026 | .items = { |
| 12027 | { "Mic", 0x1 }, |
| 12028 | { "Headphone", 0x7 }, |
| 12029 | }, |
| 12030 | }; |
| 12031 | |
| 12032 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12033 | struct snd_ctl_elem_value *ucontrol) |
| 12034 | { |
| 12035 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12036 | struct alc_spec *spec = codec->spec; |
| 12037 | int ret; |
| 12038 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12039 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12040 | if (!ret) |
| 12041 | return 0; |
| 12042 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12043 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12044 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12045 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12046 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12047 | return ret; |
| 12048 | } |
| 12049 | |
| 12050 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12051 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12052 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12053 | { |
| 12054 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12055 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12056 | .info = alc_mux_enum_info, |
| 12057 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12058 | .put = alc262_ultra_mux_enum_put, |
| 12059 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12060 | { |
| 12061 | .iface = NID_MAPPING, |
| 12062 | .name = "Capture Source", |
| 12063 | .private_value = 0x15, |
| 12064 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12065 | { } /* end */ |
| 12066 | }; |
| 12067 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12068 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12069 | * and thus it's bound with a different mixer. |
| 12070 | * This function returns which mixer amp should be used. |
| 12071 | */ |
| 12072 | static int alc262_check_volbit(hda_nid_t nid) |
| 12073 | { |
| 12074 | if (!nid) |
| 12075 | return 0; |
| 12076 | else if (nid == 0x16) |
| 12077 | return 2; |
| 12078 | else |
| 12079 | return 1; |
| 12080 | } |
| 12081 | |
| 12082 | 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] | 12083 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12084 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12085 | unsigned long val; |
| 12086 | int vbit; |
| 12087 | |
| 12088 | vbit = alc262_check_volbit(nid); |
| 12089 | if (!vbit) |
| 12090 | return 0; |
| 12091 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12092 | return 0; |
| 12093 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12094 | if (vbit == 2) |
| 12095 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12096 | else |
| 12097 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12098 | 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] | 12099 | } |
| 12100 | |
| 12101 | 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] | 12102 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12103 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12104 | unsigned long val; |
| 12105 | |
| 12106 | if (!nid) |
| 12107 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12108 | if (nid == 0x16) |
| 12109 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12110 | else |
| 12111 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12112 | 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] | 12113 | } |
| 12114 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12115 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12116 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12117 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12118 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12119 | const char *pfx; |
| 12120 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12121 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12122 | |
| 12123 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12124 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12125 | spec->multiout.dac_nids[0] = 2; |
| 12126 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12127 | pfx = alc_get_line_out_pfx(cfg, true); |
| 12128 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12129 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12130 | for (i = 0; i < 2; i++) { |
| 12131 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12132 | if (err < 0) |
| 12133 | return err; |
| 12134 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12135 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12136 | "Speaker", i); |
| 12137 | if (err < 0) |
| 12138 | return err; |
| 12139 | } |
| 12140 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12141 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12142 | "Headphone", i); |
| 12143 | if (err < 0) |
| 12144 | return err; |
| 12145 | } |
| 12146 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12147 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12148 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12149 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12150 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12151 | if (vbits == 1 || vbits == 2) |
| 12152 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12153 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12154 | for (i = 0; i < 2; i++) { |
| 12155 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12156 | &vbits, i); |
| 12157 | if (err < 0) |
| 12158 | return err; |
| 12159 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12160 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12161 | "Speaker", &vbits, i); |
| 12162 | if (err < 0) |
| 12163 | return err; |
| 12164 | } |
| 12165 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12166 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12167 | "Headphone", &vbits, i); |
| 12168 | if (err < 0) |
| 12169 | return err; |
| 12170 | } |
| 12171 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12172 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12173 | } |
| 12174 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12175 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12176 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12177 | |
| 12178 | /* |
| 12179 | * generic initialization of ADC, input mixers and output mixers |
| 12180 | */ |
| 12181 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12182 | /* |
| 12183 | * Unmute ADC0-2 and set the default input to mic-in |
| 12184 | */ |
| 12185 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12186 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12187 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12188 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12189 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12190 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12191 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12192 | /* 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] | 12193 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12194 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12195 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12196 | */ |
| 12197 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12198 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12200 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12203 | |
| 12204 | /* |
| 12205 | * Set up output mixers (0x0c - 0x0f) |
| 12206 | */ |
| 12207 | /* set vol=0 to output mixers */ |
| 12208 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12209 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12211 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12212 | /* set up input amps for analog loopback */ |
| 12213 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12214 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12216 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12217 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12218 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12219 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12220 | |
| 12221 | /* FIXME: use matrix-type input source selection */ |
| 12222 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12223 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12224 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12225 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12226 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12227 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12228 | /* Input mixer2 */ |
| 12229 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12230 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12231 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12232 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12233 | /* Input mixer3 */ |
| 12234 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12235 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12236 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12237 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12238 | |
| 12239 | { } |
| 12240 | }; |
| 12241 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12242 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12243 | /* |
| 12244 | * Unmute ADC0-2 and set the default input to mic-in |
| 12245 | */ |
| 12246 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12248 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12251 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12252 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12253 | /* 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] | 12254 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12255 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12256 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12257 | */ |
| 12258 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12259 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12260 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12261 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12263 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12266 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12267 | /* |
| 12268 | * Set up output mixers (0x0c - 0x0e) |
| 12269 | */ |
| 12270 | /* set vol=0 to output mixers */ |
| 12271 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12272 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12273 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12274 | |
| 12275 | /* set up input amps for analog loopback */ |
| 12276 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12277 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12279 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12281 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12282 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12283 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12284 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12285 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12286 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12287 | |
| 12288 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12289 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12290 | |
| 12291 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12292 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12293 | |
| 12294 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12295 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12296 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12297 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12298 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12299 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12300 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12301 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12302 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12303 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12304 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12305 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12306 | |
| 12307 | |
| 12308 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12309 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12310 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12311 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12312 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12313 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12314 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12315 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12317 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12320 | /* Input mixer2 */ |
| 12321 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12322 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12323 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12325 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12330 | /* Input mixer3 */ |
| 12331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12335 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12336 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12337 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12339 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12340 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12341 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12342 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12343 | { } |
| 12344 | }; |
| 12345 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12346 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12347 | /* |
| 12348 | * Unmute ADC0-2 and set the default input to mic-in |
| 12349 | */ |
| 12350 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12351 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12352 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12353 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12354 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12355 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12356 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12357 | /* 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] | 12358 | * mixer widget |
| 12359 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12360 | * panel mic (mic 2) |
| 12361 | */ |
| 12362 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12363 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12364 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12365 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12366 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12367 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12371 | /* |
| 12372 | * Set up output mixers (0x0c - 0x0e) |
| 12373 | */ |
| 12374 | /* set vol=0 to output mixers */ |
| 12375 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12376 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12377 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12378 | |
| 12379 | /* set up input amps for analog loopback */ |
| 12380 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12383 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12384 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12385 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12386 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12387 | |
| 12388 | |
| 12389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12390 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12391 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12392 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12393 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12394 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12395 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12396 | |
| 12397 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12398 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12399 | |
| 12400 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12401 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12402 | |
| 12403 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12404 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12405 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12406 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12407 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12408 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12409 | |
| 12410 | /* FIXME: use matrix-type input source selection */ |
| 12411 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12412 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12413 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12414 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12415 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12416 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12417 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12418 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12419 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12420 | /* Input mixer2 */ |
| 12421 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12422 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12423 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12424 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12425 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12426 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12427 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12428 | /* Input mixer3 */ |
| 12429 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12430 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12431 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12432 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12433 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12434 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12435 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12436 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12437 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12438 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12439 | { } |
| 12440 | }; |
| 12441 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12442 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12443 | |
| 12444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12445 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12446 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12447 | |
| 12448 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12449 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12450 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12451 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12452 | |
| 12453 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12454 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12455 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12456 | {} |
| 12457 | }; |
| 12458 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12459 | /* |
| 12460 | * Pin config fixes |
| 12461 | */ |
| 12462 | enum { |
| 12463 | PINFIX_FSC_H270, |
| 12464 | }; |
| 12465 | |
| 12466 | static const struct alc_fixup alc262_fixups[] = { |
| 12467 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12468 | .type = ALC_FIXUP_PINS, |
| 12469 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12470 | { 0x14, 0x99130110 }, /* speaker */ |
| 12471 | { 0x15, 0x0221142f }, /* front HP */ |
| 12472 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12473 | { } |
| 12474 | } |
| 12475 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12476 | }; |
| 12477 | |
| 12478 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12479 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12480 | {} |
| 12481 | }; |
| 12482 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12483 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12484 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12485 | #define alc262_loopbacks alc880_loopbacks |
| 12486 | #endif |
| 12487 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12488 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12489 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12490 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12491 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12492 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12493 | |
| 12494 | /* |
| 12495 | * BIOS auto configuration |
| 12496 | */ |
| 12497 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12498 | { |
| 12499 | struct alc_spec *spec = codec->spec; |
| 12500 | int err; |
| 12501 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12502 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12503 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12504 | alc262_ignore); |
| 12505 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12506 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12507 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12508 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12509 | spec->multiout.max_channels = 2; |
| 12510 | spec->no_analog = 1; |
| 12511 | goto dig_only; |
| 12512 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12513 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12514 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12515 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12516 | if (err < 0) |
| 12517 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12518 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12519 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12520 | return err; |
| 12521 | |
| 12522 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12523 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12524 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12525 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12526 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12527 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12528 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12529 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12530 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12531 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12532 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12533 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12534 | err = alc_auto_add_mic_boost(codec); |
| 12535 | if (err < 0) |
| 12536 | return err; |
| 12537 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12538 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12539 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12540 | return 1; |
| 12541 | } |
| 12542 | |
| 12543 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12544 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12545 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12546 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12547 | |
| 12548 | |
| 12549 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12550 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12551 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12552 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12553 | alc262_auto_init_multi_out(codec); |
| 12554 | alc262_auto_init_hp_out(codec); |
| 12555 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12556 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12557 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12558 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12559 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12560 | } |
| 12561 | |
| 12562 | /* |
| 12563 | * configuration and preset |
| 12564 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12565 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12566 | [ALC262_BASIC] = "basic", |
| 12567 | [ALC262_HIPPO] = "hippo", |
| 12568 | [ALC262_HIPPO_1] = "hippo_1", |
| 12569 | [ALC262_FUJITSU] = "fujitsu", |
| 12570 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12571 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12572 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12573 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12574 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12575 | [ALC262_BENQ_T31] = "benq-t31", |
| 12576 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12577 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12578 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12579 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12580 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12581 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12582 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12583 | [ALC262_AUTO] = "auto", |
| 12584 | }; |
| 12585 | |
| 12586 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12587 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12588 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12589 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12590 | ALC262_HP_BPC), |
| 12591 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12592 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12593 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12594 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12595 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12596 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12597 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12598 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12599 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12600 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12601 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12602 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12603 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12604 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12605 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12606 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12607 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12608 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12609 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12610 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12611 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12612 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12613 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12614 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12615 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12616 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12617 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12618 | #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] | 12619 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12620 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12621 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12622 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12623 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12624 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12625 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12626 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12627 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12628 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12629 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12630 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12631 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12632 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12633 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12634 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12635 | {} |
| 12636 | }; |
| 12637 | |
| 12638 | static struct alc_config_preset alc262_presets[] = { |
| 12639 | [ALC262_BASIC] = { |
| 12640 | .mixers = { alc262_base_mixer }, |
| 12641 | .init_verbs = { alc262_init_verbs }, |
| 12642 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12643 | .dac_nids = alc262_dac_nids, |
| 12644 | .hp_nid = 0x03, |
| 12645 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12646 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12647 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12648 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12649 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12650 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12651 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12652 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12653 | .dac_nids = alc262_dac_nids, |
| 12654 | .hp_nid = 0x03, |
| 12655 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12656 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12657 | .channel_mode = alc262_modes, |
| 12658 | .input_mux = &alc262_capture_source, |
| 12659 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12660 | .setup = alc262_hippo_setup, |
| 12661 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12662 | }, |
| 12663 | [ALC262_HIPPO_1] = { |
| 12664 | .mixers = { alc262_hippo1_mixer }, |
| 12665 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12666 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12667 | .dac_nids = alc262_dac_nids, |
| 12668 | .hp_nid = 0x02, |
| 12669 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12670 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12671 | .channel_mode = alc262_modes, |
| 12672 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12673 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12674 | .setup = alc262_hippo1_setup, |
| 12675 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12676 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12677 | [ALC262_FUJITSU] = { |
| 12678 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12679 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12680 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12681 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12682 | .dac_nids = alc262_dac_nids, |
| 12683 | .hp_nid = 0x03, |
| 12684 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12685 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12686 | .channel_mode = alc262_modes, |
| 12687 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12688 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12689 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12690 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12691 | [ALC262_HP_BPC] = { |
| 12692 | .mixers = { alc262_HP_BPC_mixer }, |
| 12693 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12694 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12695 | .dac_nids = alc262_dac_nids, |
| 12696 | .hp_nid = 0x03, |
| 12697 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12698 | .channel_mode = alc262_modes, |
| 12699 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12700 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12701 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12702 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12703 | [ALC262_HP_BPC_D7000_WF] = { |
| 12704 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12705 | .init_verbs = { alc262_HP_BPC_WildWest_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, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12711 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12712 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12713 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12714 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12715 | [ALC262_HP_BPC_D7000_WL] = { |
| 12716 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12717 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12718 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12719 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12720 | .dac_nids = alc262_dac_nids, |
| 12721 | .hp_nid = 0x03, |
| 12722 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12723 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12724 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12725 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12726 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12727 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12728 | [ALC262_HP_TC_T5735] = { |
| 12729 | .mixers = { alc262_hp_t5735_mixer }, |
| 12730 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12731 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12732 | .dac_nids = alc262_dac_nids, |
| 12733 | .hp_nid = 0x03, |
| 12734 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12735 | .channel_mode = alc262_modes, |
| 12736 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12737 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12738 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12739 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12740 | }, |
| 12741 | [ALC262_HP_RP5700] = { |
| 12742 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12743 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12744 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12745 | .dac_nids = alc262_dac_nids, |
| 12746 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12747 | .channel_mode = alc262_modes, |
| 12748 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12749 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12750 | [ALC262_BENQ_ED8] = { |
| 12751 | .mixers = { alc262_base_mixer }, |
| 12752 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12753 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12754 | .dac_nids = alc262_dac_nids, |
| 12755 | .hp_nid = 0x03, |
| 12756 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12757 | .channel_mode = alc262_modes, |
| 12758 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12759 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12760 | [ALC262_SONY_ASSAMD] = { |
| 12761 | .mixers = { alc262_sony_mixer }, |
| 12762 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12763 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12764 | .dac_nids = alc262_dac_nids, |
| 12765 | .hp_nid = 0x02, |
| 12766 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12767 | .channel_mode = alc262_modes, |
| 12768 | .input_mux = &alc262_capture_source, |
| 12769 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12770 | .setup = alc262_hippo_setup, |
| 12771 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12772 | }, |
| 12773 | [ALC262_BENQ_T31] = { |
| 12774 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12775 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12776 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12777 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12778 | .dac_nids = alc262_dac_nids, |
| 12779 | .hp_nid = 0x03, |
| 12780 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12781 | .channel_mode = alc262_modes, |
| 12782 | .input_mux = &alc262_capture_source, |
| 12783 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12784 | .setup = alc262_hippo_setup, |
| 12785 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12786 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12787 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12788 | .mixers = { alc262_ultra_mixer }, |
| 12789 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12790 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12791 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12792 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12793 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12794 | .channel_mode = alc262_modes, |
| 12795 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12796 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12797 | .capsrc_nids = alc262_capsrc_nids, |
| 12798 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12799 | .unsol_event = alc262_ultra_unsol_event, |
| 12800 | .init_hook = alc262_ultra_automute, |
| 12801 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12802 | [ALC262_LENOVO_3000] = { |
| 12803 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12804 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12805 | alc262_lenovo_3000_unsol_verbs, |
| 12806 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12807 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12808 | .dac_nids = alc262_dac_nids, |
| 12809 | .hp_nid = 0x03, |
| 12810 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12811 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12812 | .channel_mode = alc262_modes, |
| 12813 | .input_mux = &alc262_fujitsu_capture_source, |
| 12814 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12815 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12816 | [ALC262_NEC] = { |
| 12817 | .mixers = { alc262_nec_mixer }, |
| 12818 | .init_verbs = { alc262_nec_verbs }, |
| 12819 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12820 | .dac_nids = alc262_dac_nids, |
| 12821 | .hp_nid = 0x03, |
| 12822 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12823 | .channel_mode = alc262_modes, |
| 12824 | .input_mux = &alc262_capture_source, |
| 12825 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12826 | [ALC262_TOSHIBA_S06] = { |
| 12827 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12828 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12829 | alc262_eapd_verbs }, |
| 12830 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12831 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12832 | .dac_nids = alc262_dac_nids, |
| 12833 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12834 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12835 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12836 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12837 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12838 | .unsol_event = alc_sku_unsol_event, |
| 12839 | .setup = alc262_toshiba_s06_setup, |
| 12840 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12841 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12842 | [ALC262_TOSHIBA_RX1] = { |
| 12843 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12844 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12845 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12846 | .dac_nids = alc262_dac_nids, |
| 12847 | .hp_nid = 0x03, |
| 12848 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12849 | .channel_mode = alc262_modes, |
| 12850 | .input_mux = &alc262_capture_source, |
| 12851 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12852 | .setup = alc262_hippo_setup, |
| 12853 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12854 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12855 | [ALC262_TYAN] = { |
| 12856 | .mixers = { alc262_tyan_mixer }, |
| 12857 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12858 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12859 | .dac_nids = alc262_dac_nids, |
| 12860 | .hp_nid = 0x02, |
| 12861 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12862 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12863 | .channel_mode = alc262_modes, |
| 12864 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12865 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12866 | .setup = alc262_tyan_setup, |
| 12867 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12868 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12869 | }; |
| 12870 | |
| 12871 | static int patch_alc262(struct hda_codec *codec) |
| 12872 | { |
| 12873 | struct alc_spec *spec; |
| 12874 | int board_config; |
| 12875 | int err; |
| 12876 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12877 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12878 | if (spec == NULL) |
| 12879 | return -ENOMEM; |
| 12880 | |
| 12881 | codec->spec = spec; |
| 12882 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12883 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12884 | * under-run |
| 12885 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12886 | { |
| 12887 | int tmp; |
| 12888 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12889 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12890 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12891 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12892 | } |
| 12893 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12894 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12895 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12896 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12897 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12898 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12899 | alc262_models, |
| 12900 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12901 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12902 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12903 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12904 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12905 | board_config = ALC262_AUTO; |
| 12906 | } |
| 12907 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12908 | if (board_config == ALC262_AUTO) { |
| 12909 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12910 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12911 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12913 | if (board_config == ALC262_AUTO) { |
| 12914 | /* automatic parse from the BIOS config */ |
| 12915 | err = alc262_parse_auto_config(codec); |
| 12916 | if (err < 0) { |
| 12917 | alc_free(codec); |
| 12918 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12919 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12920 | printk(KERN_INFO |
| 12921 | "hda_codec: Cannot set up configuration " |
| 12922 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12923 | board_config = ALC262_BASIC; |
| 12924 | } |
| 12925 | } |
| 12926 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12927 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12928 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12929 | if (err < 0) { |
| 12930 | alc_free(codec); |
| 12931 | return err; |
| 12932 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12933 | } |
| 12934 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12935 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12936 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12937 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12938 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12939 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12940 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12941 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12942 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12943 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12944 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12945 | int i; |
| 12946 | /* check whether the digital-mic has to be supported */ |
| 12947 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12948 | if (spec->input_mux->items[i].index >= 9) |
| 12949 | break; |
| 12950 | } |
| 12951 | if (i < spec->input_mux->num_items) { |
| 12952 | /* use only ADC0 */ |
| 12953 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12954 | spec->num_adc_nids = 1; |
| 12955 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12956 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12957 | /* all analog inputs */ |
| 12958 | /* check whether NID 0x07 is valid */ |
| 12959 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12960 | |
| 12961 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12962 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12963 | if (wcap != AC_WID_AUD_IN) { |
| 12964 | spec->adc_nids = alc262_adc_nids_alt; |
| 12965 | spec->num_adc_nids = |
| 12966 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12967 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12968 | } else { |
| 12969 | spec->adc_nids = alc262_adc_nids; |
| 12970 | spec->num_adc_nids = |
| 12971 | ARRAY_SIZE(alc262_adc_nids); |
| 12972 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12973 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12974 | } |
| 12975 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12976 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12977 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12978 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12979 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12980 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12981 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12982 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12983 | spec->vmaster_nid = 0x0c; |
| 12984 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12985 | codec->patch_ops = alc_patch_ops; |
| 12986 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12987 | spec->init_hook = alc262_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 12988 | |
| 12989 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12990 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12991 | if (!spec->loopback.amplist) |
| 12992 | spec->loopback.amplist = alc262_loopbacks; |
| 12993 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12994 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12995 | return 0; |
| 12996 | } |
| 12997 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12998 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12999 | * ALC268 channel source setting (2 channel) |
| 13000 | */ |
| 13001 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13002 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13003 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13004 | static hda_nid_t alc268_dac_nids[2] = { |
| 13005 | /* front, hp */ |
| 13006 | 0x02, 0x03 |
| 13007 | }; |
| 13008 | |
| 13009 | static hda_nid_t alc268_adc_nids[2] = { |
| 13010 | /* ADC0-1 */ |
| 13011 | 0x08, 0x07 |
| 13012 | }; |
| 13013 | |
| 13014 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13015 | /* ADC0 */ |
| 13016 | 0x08 |
| 13017 | }; |
| 13018 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13019 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13020 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13021 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13022 | /* output mixer control */ |
| 13023 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13024 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13025 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13026 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13027 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13028 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13029 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13030 | { } |
| 13031 | }; |
| 13032 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13033 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13034 | /* output mixer control */ |
| 13035 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13036 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13037 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13038 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13039 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13040 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13041 | { } |
| 13042 | }; |
| 13043 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13044 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13045 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13046 | .ops = &snd_hda_bind_sw, |
| 13047 | .values = { |
| 13048 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13049 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13050 | 0 |
| 13051 | }, |
| 13052 | }; |
| 13053 | |
| 13054 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13055 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13056 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13057 | { } |
| 13058 | }; |
| 13059 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13060 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13061 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13062 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13063 | { } |
| 13064 | }; |
| 13065 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13066 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13067 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13068 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13069 | { } /* end */ |
| 13070 | }; |
| 13071 | |
| 13072 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13073 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13074 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13075 | .ops = &snd_hda_bind_vol, |
| 13076 | .values = { |
| 13077 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13078 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13079 | 0 |
| 13080 | }, |
| 13081 | }; |
| 13082 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13083 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13084 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13085 | { |
| 13086 | struct alc_spec *spec = codec->spec; |
| 13087 | unsigned int mute; |
| 13088 | |
| 13089 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13090 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13091 | spec->sense_updated = 1; |
| 13092 | } |
| 13093 | if (spec->jack_present) |
| 13094 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13095 | else /* unmute internal speaker if necessary */ |
| 13096 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13097 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13098 | HDA_AMP_MUTE, mute); |
| 13099 | } |
| 13100 | |
| 13101 | |
| 13102 | /* bind hp and internal speaker mute (with plug check) */ |
| 13103 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13104 | struct snd_ctl_elem_value *ucontrol) |
| 13105 | { |
| 13106 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13107 | long *valp = ucontrol->value.integer.value; |
| 13108 | int change; |
| 13109 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13110 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13111 | if (change) |
| 13112 | alc268_acer_automute(codec, 0); |
| 13113 | return change; |
| 13114 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13115 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13116 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13117 | /* output mixer control */ |
| 13118 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13119 | { |
| 13120 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13121 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13122 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13123 | .info = snd_hda_mixer_amp_switch_info, |
| 13124 | .get = snd_hda_mixer_amp_switch_get, |
| 13125 | .put = alc268_acer_master_sw_put, |
| 13126 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13127 | }, |
| 13128 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13129 | { } |
| 13130 | }; |
| 13131 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13132 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13133 | /* output mixer control */ |
| 13134 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13135 | { |
| 13136 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13137 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13138 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13139 | .info = snd_hda_mixer_amp_switch_info, |
| 13140 | .get = snd_hda_mixer_amp_switch_get, |
| 13141 | .put = alc268_acer_master_sw_put, |
| 13142 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13143 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13144 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13145 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13146 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13147 | { } |
| 13148 | }; |
| 13149 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13150 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13151 | /* output mixer control */ |
| 13152 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13153 | { |
| 13154 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13155 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13156 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13157 | .info = snd_hda_mixer_amp_switch_info, |
| 13158 | .get = snd_hda_mixer_amp_switch_get, |
| 13159 | .put = alc268_acer_master_sw_put, |
| 13160 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13161 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13162 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13163 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13164 | { } |
| 13165 | }; |
| 13166 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13167 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13168 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13170 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13171 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13172 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13174 | { } |
| 13175 | }; |
| 13176 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13177 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13178 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13179 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13180 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13182 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13183 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13184 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13185 | { } |
| 13186 | }; |
| 13187 | |
| 13188 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13189 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13190 | #define alc268_toshiba_setup alc262_hippo_setup |
| 13191 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13192 | |
| 13193 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13194 | unsigned int res) |
| 13195 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13196 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13197 | return; |
| 13198 | alc268_acer_automute(codec, 1); |
| 13199 | } |
| 13200 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13201 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13202 | { |
| 13203 | alc268_acer_automute(codec, 1); |
| 13204 | } |
| 13205 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13206 | /* toggle speaker-output according to the hp-jack state */ |
| 13207 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 13208 | { |
| 13209 | unsigned int present; |
| 13210 | unsigned char bits; |
| 13211 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13212 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13213 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13214 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13215 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13216 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13217 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13218 | } |
| 13219 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13220 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 13221 | unsigned int res) |
| 13222 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13223 | switch (res >> 26) { |
| 13224 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13225 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13226 | break; |
| 13227 | case ALC880_MIC_EVENT: |
| 13228 | alc_mic_automute(codec); |
| 13229 | break; |
| 13230 | } |
| 13231 | } |
| 13232 | |
| 13233 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13234 | { |
| 13235 | struct alc_spec *spec = codec->spec; |
| 13236 | spec->ext_mic.pin = 0x18; |
| 13237 | spec->ext_mic.mux_idx = 0; |
| 13238 | spec->int_mic.pin = 0x12; |
| 13239 | spec->int_mic.mux_idx = 6; |
| 13240 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13241 | } |
| 13242 | |
| 13243 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 13244 | { |
| 13245 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13246 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13247 | } |
| 13248 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13249 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13250 | /* output mixer control */ |
| 13251 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13252 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13253 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13255 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13256 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13257 | { } |
| 13258 | }; |
| 13259 | |
| 13260 | static struct hda_verb alc268_dell_verbs[] = { |
| 13261 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13262 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13263 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13264 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13265 | { } |
| 13266 | }; |
| 13267 | |
| 13268 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13269 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13270 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13271 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13272 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13273 | spec->autocfg.hp_pins[0] = 0x15; |
| 13274 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13275 | spec->ext_mic.pin = 0x18; |
| 13276 | spec->ext_mic.mux_idx = 0; |
| 13277 | spec->int_mic.pin = 0x19; |
| 13278 | spec->int_mic.mux_idx = 1; |
| 13279 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13280 | } |
| 13281 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13282 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13283 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13284 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13285 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13286 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13287 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13288 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13289 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13290 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13291 | { } |
| 13292 | }; |
| 13293 | |
| 13294 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13295 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13296 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13297 | { } |
| 13298 | }; |
| 13299 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13300 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13301 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13302 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13303 | spec->autocfg.hp_pins[0] = 0x15; |
| 13304 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13305 | spec->ext_mic.pin = 0x18; |
| 13306 | spec->ext_mic.mux_idx = 0; |
| 13307 | spec->int_mic.pin = 0x19; |
| 13308 | spec->int_mic.mux_idx = 1; |
| 13309 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13310 | } |
| 13311 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13312 | /* |
| 13313 | * generic initialization of ADC, input mixers and output mixers |
| 13314 | */ |
| 13315 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13316 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13317 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13318 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13319 | |
| 13320 | /* |
| 13321 | * Set up output mixers (0x0c - 0x0e) |
| 13322 | */ |
| 13323 | /* set vol=0 to output mixers */ |
| 13324 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13325 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13326 | |
| 13327 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13328 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13329 | |
| 13330 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13331 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13332 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13333 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13334 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13335 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13336 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13337 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13338 | |
| 13339 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13340 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13342 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13343 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13344 | |
| 13345 | /* set PCBEEP vol = 0, mute connections */ |
| 13346 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13347 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13348 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13349 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13350 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13351 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13352 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13353 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13354 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13356 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13357 | { } |
| 13358 | }; |
| 13359 | |
| 13360 | /* |
| 13361 | * generic initialization of ADC, input mixers and output mixers |
| 13362 | */ |
| 13363 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13364 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13365 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13366 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13367 | |
| 13368 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13369 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13370 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13371 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13372 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13373 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13375 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13376 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13377 | |
| 13378 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13379 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13380 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13381 | /* set PCBEEP vol = 0, mute connections */ |
| 13382 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13383 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13384 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13385 | |
| 13386 | { } |
| 13387 | }; |
| 13388 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13389 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13390 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13391 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13392 | { } /* end */ |
| 13393 | }; |
| 13394 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13395 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13396 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13397 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13398 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | { } /* end */ |
| 13400 | }; |
| 13401 | |
| 13402 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13403 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13404 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13405 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13406 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13407 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13408 | { } /* end */ |
| 13409 | }; |
| 13410 | |
| 13411 | static struct hda_input_mux alc268_capture_source = { |
| 13412 | .num_items = 4, |
| 13413 | .items = { |
| 13414 | { "Mic", 0x0 }, |
| 13415 | { "Front Mic", 0x1 }, |
| 13416 | { "Line", 0x2 }, |
| 13417 | { "CD", 0x3 }, |
| 13418 | }, |
| 13419 | }; |
| 13420 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13421 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13422 | .num_items = 3, |
| 13423 | .items = { |
| 13424 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13425 | { "Internal Mic", 0x1 }, |
| 13426 | { "Line", 0x2 }, |
| 13427 | }, |
| 13428 | }; |
| 13429 | |
| 13430 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13431 | .num_items = 3, |
| 13432 | .items = { |
| 13433 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13434 | { "Internal Mic", 0x6 }, |
| 13435 | { "Line", 0x2 }, |
| 13436 | }, |
| 13437 | }; |
| 13438 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13439 | #ifdef CONFIG_SND_DEBUG |
| 13440 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13441 | /* Volume widgets */ |
| 13442 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13443 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13444 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13445 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13446 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13447 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13448 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13449 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13450 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13451 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13452 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13453 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13454 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13455 | /* The below appears problematic on some hardwares */ |
| 13456 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13457 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13458 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13459 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13460 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13461 | |
| 13462 | /* Modes for retasking pin widgets */ |
| 13463 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13464 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13465 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13466 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13467 | |
| 13468 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13469 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13470 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13471 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13472 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13473 | |
| 13474 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13475 | * The ALC268 does not have an SPDIF input. |
| 13476 | */ |
| 13477 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13478 | |
| 13479 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13480 | * this output to turn on an external amplifier. |
| 13481 | */ |
| 13482 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13483 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13484 | |
| 13485 | { } /* end */ |
| 13486 | }; |
| 13487 | #endif |
| 13488 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13489 | /* create input playback/capture controls for the given pin */ |
| 13490 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13491 | const char *ctlname, int idx) |
| 13492 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13493 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13494 | int err; |
| 13495 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13496 | switch (nid) { |
| 13497 | case 0x14: |
| 13498 | case 0x16: |
| 13499 | dac = 0x02; |
| 13500 | break; |
| 13501 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13502 | case 0x1a: /* ALC259/269 only */ |
| 13503 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13504 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13505 | dac = 0x03; |
| 13506 | break; |
| 13507 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13508 | snd_printd(KERN_WARNING "hda_codec: " |
| 13509 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13510 | return 0; |
| 13511 | } |
| 13512 | if (spec->multiout.dac_nids[0] != dac && |
| 13513 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13514 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13515 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13516 | HDA_OUTPUT)); |
| 13517 | if (err < 0) |
| 13518 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13519 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13520 | } |
| 13521 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13522 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13523 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13524 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13525 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13526 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13527 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13528 | if (err < 0) |
| 13529 | return err; |
| 13530 | return 0; |
| 13531 | } |
| 13532 | |
| 13533 | /* add playback controls from the parsed DAC table */ |
| 13534 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13535 | const struct auto_pin_cfg *cfg) |
| 13536 | { |
| 13537 | hda_nid_t nid; |
| 13538 | int err; |
| 13539 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13540 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13541 | |
| 13542 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13543 | if (nid) { |
| 13544 | const char *name; |
| 13545 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13546 | name = "Speaker"; |
| 13547 | else |
| 13548 | name = "Front"; |
| 13549 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13550 | if (err < 0) |
| 13551 | return err; |
| 13552 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13553 | |
| 13554 | nid = cfg->speaker_pins[0]; |
| 13555 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13556 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13557 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13558 | if (err < 0) |
| 13559 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13560 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13561 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13562 | if (err < 0) |
| 13563 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13564 | } |
| 13565 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13566 | if (nid) { |
| 13567 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13568 | if (err < 0) |
| 13569 | return err; |
| 13570 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13571 | |
| 13572 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13573 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13574 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13575 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13576 | if (err < 0) |
| 13577 | return err; |
| 13578 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13579 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13580 | } |
| 13581 | |
| 13582 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13583 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13584 | const struct auto_pin_cfg *cfg) |
| 13585 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13586 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13587 | } |
| 13588 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13589 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13590 | hda_nid_t nid, int pin_type) |
| 13591 | { |
| 13592 | int idx; |
| 13593 | |
| 13594 | alc_set_pin_output(codec, nid, pin_type); |
| 13595 | if (nid == 0x14 || nid == 0x16) |
| 13596 | idx = 0; |
| 13597 | else |
| 13598 | idx = 1; |
| 13599 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13600 | } |
| 13601 | |
| 13602 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13603 | { |
| 13604 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13605 | int i; |
| 13606 | |
| 13607 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13608 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13609 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13610 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13611 | } |
| 13612 | } |
| 13613 | |
| 13614 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13615 | { |
| 13616 | struct alc_spec *spec = codec->spec; |
| 13617 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13618 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13619 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13620 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13621 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13622 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13623 | } |
| 13624 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13625 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13626 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13627 | } |
| 13628 | if (spec->autocfg.mono_out_pin) |
| 13629 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13630 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13631 | } |
| 13632 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13633 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13634 | { |
| 13635 | struct alc_spec *spec = codec->spec; |
| 13636 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13637 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13638 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13639 | unsigned int dac_vol1, dac_vol2; |
| 13640 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13641 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13642 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13643 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13644 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13645 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13646 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13647 | AMP_IN_UNMUTE(1)); |
| 13648 | snd_hda_codec_write(codec, 0x10, 0, |
| 13649 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13650 | AMP_IN_UNMUTE(1)); |
| 13651 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13652 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13653 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13654 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13655 | snd_hda_codec_write(codec, 0x10, 0, |
| 13656 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13657 | } |
| 13658 | |
| 13659 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13660 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13661 | dac_vol2 = AMP_OUT_ZERO; |
| 13662 | else if (line_nid == 0x15) |
| 13663 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13664 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13665 | dac_vol2 = AMP_OUT_ZERO; |
| 13666 | else if (hp_nid == 0x15) |
| 13667 | dac_vol1 = AMP_OUT_ZERO; |
| 13668 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13669 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13670 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13671 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13672 | |
| 13673 | snd_hda_codec_write(codec, 0x02, 0, |
| 13674 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13675 | snd_hda_codec_write(codec, 0x03, 0, |
| 13676 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13677 | } |
| 13678 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13679 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13680 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13681 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13682 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13683 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13684 | |
| 13685 | /* |
| 13686 | * BIOS auto configuration |
| 13687 | */ |
| 13688 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13689 | { |
| 13690 | struct alc_spec *spec = codec->spec; |
| 13691 | int err; |
| 13692 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13693 | |
| 13694 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13695 | alc268_ignore); |
| 13696 | if (err < 0) |
| 13697 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13698 | if (!spec->autocfg.line_outs) { |
| 13699 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13700 | spec->multiout.max_channels = 2; |
| 13701 | spec->no_analog = 1; |
| 13702 | goto dig_only; |
| 13703 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13704 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13705 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13706 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13707 | if (err < 0) |
| 13708 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13709 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13710 | if (err < 0) |
| 13711 | return err; |
| 13712 | |
| 13713 | spec->multiout.max_channels = 2; |
| 13714 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13715 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13716 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13717 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13718 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13719 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13720 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13721 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13722 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13723 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13724 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13725 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13726 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13727 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13728 | err = alc_auto_add_mic_boost(codec); |
| 13729 | if (err < 0) |
| 13730 | return err; |
| 13731 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13732 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13733 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13734 | return 1; |
| 13735 | } |
| 13736 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13737 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13738 | |
| 13739 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13740 | static void alc268_auto_init(struct hda_codec *codec) |
| 13741 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13742 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | alc268_auto_init_multi_out(codec); |
| 13744 | alc268_auto_init_hp_out(codec); |
| 13745 | alc268_auto_init_mono_speaker_out(codec); |
| 13746 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13747 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13748 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13749 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13750 | } |
| 13751 | |
| 13752 | /* |
| 13753 | * configuration and preset |
| 13754 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13755 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13756 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13757 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13758 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13759 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13760 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13761 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13762 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13763 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13764 | #ifdef CONFIG_SND_DEBUG |
| 13765 | [ALC268_TEST] = "test", |
| 13766 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13767 | [ALC268_AUTO] = "auto", |
| 13768 | }; |
| 13769 | |
| 13770 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13771 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13772 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13773 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13774 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13775 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13776 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13777 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13778 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13779 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13780 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13781 | /* almost compatible with toshiba but with optional digital outs; |
| 13782 | * auto-probing seems working fine |
| 13783 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13784 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13785 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13786 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13787 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13788 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13789 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13790 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13791 | {} |
| 13792 | }; |
| 13793 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13794 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13795 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13796 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13797 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13798 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13799 | ALC268_TOSHIBA), |
| 13800 | {} |
| 13801 | }; |
| 13802 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13803 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13804 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13805 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13806 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13807 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13808 | alc267_quanta_il1_verbs }, |
| 13809 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13810 | .dac_nids = alc268_dac_nids, |
| 13811 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13812 | .adc_nids = alc268_adc_nids_alt, |
| 13813 | .hp_nid = 0x03, |
| 13814 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13815 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13816 | .unsol_event = alc_sku_unsol_event, |
| 13817 | .setup = alc267_quanta_il1_setup, |
| 13818 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13819 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13820 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13821 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13822 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13823 | .init_verbs = { alc268_base_init_verbs }, |
| 13824 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13825 | .dac_nids = alc268_dac_nids, |
| 13826 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13827 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13828 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13829 | .hp_nid = 0x03, |
| 13830 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13831 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13832 | .channel_mode = alc268_modes, |
| 13833 | .input_mux = &alc268_capture_source, |
| 13834 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13835 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13836 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13837 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13838 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13839 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13840 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13841 | .dac_nids = alc268_dac_nids, |
| 13842 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13843 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13844 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13845 | .hp_nid = 0x03, |
| 13846 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13847 | .channel_mode = alc268_modes, |
| 13848 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13849 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13850 | .setup = alc268_toshiba_setup, |
| 13851 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13852 | }, |
| 13853 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13854 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13855 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13856 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13857 | alc268_acer_verbs }, |
| 13858 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13859 | .dac_nids = alc268_dac_nids, |
| 13860 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13861 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13862 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13863 | .hp_nid = 0x02, |
| 13864 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13865 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13866 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13867 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13868 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13869 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13870 | [ALC268_ACER_DMIC] = { |
| 13871 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13872 | alc268_beep_mixer }, |
| 13873 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13874 | alc268_acer_verbs }, |
| 13875 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13876 | .dac_nids = alc268_dac_nids, |
| 13877 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13878 | .adc_nids = alc268_adc_nids_alt, |
| 13879 | .capsrc_nids = alc268_capsrc_nids, |
| 13880 | .hp_nid = 0x02, |
| 13881 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13882 | .channel_mode = alc268_modes, |
| 13883 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13884 | .unsol_event = alc268_acer_unsol_event, |
| 13885 | .init_hook = alc268_acer_init_hook, |
| 13886 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13887 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13888 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13889 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13890 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13891 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13892 | alc268_acer_aspire_one_verbs }, |
| 13893 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13894 | .dac_nids = alc268_dac_nids, |
| 13895 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13896 | .adc_nids = alc268_adc_nids_alt, |
| 13897 | .capsrc_nids = alc268_capsrc_nids, |
| 13898 | .hp_nid = 0x03, |
| 13899 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13900 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13901 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13902 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13903 | .init_hook = alc268_acer_lc_init_hook, |
| 13904 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13905 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13906 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13907 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13908 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13909 | alc268_dell_verbs }, |
| 13910 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13911 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13912 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13913 | .adc_nids = alc268_adc_nids_alt, |
| 13914 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13915 | .hp_nid = 0x02, |
| 13916 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13917 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13918 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13919 | .setup = alc268_dell_setup, |
| 13920 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13921 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13922 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13923 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13924 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13925 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13926 | alc268_toshiba_verbs }, |
| 13927 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13928 | .dac_nids = alc268_dac_nids, |
| 13929 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13930 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13931 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13932 | .hp_nid = 0x03, |
| 13933 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13934 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13935 | .channel_mode = alc268_modes, |
| 13936 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13937 | .setup = alc268_toshiba_setup, |
| 13938 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13939 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13940 | #ifdef CONFIG_SND_DEBUG |
| 13941 | [ALC268_TEST] = { |
| 13942 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13943 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13944 | alc268_volume_init_verbs }, |
| 13945 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13946 | .dac_nids = alc268_dac_nids, |
| 13947 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13948 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13949 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13950 | .hp_nid = 0x03, |
| 13951 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13952 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13953 | .channel_mode = alc268_modes, |
| 13954 | .input_mux = &alc268_capture_source, |
| 13955 | }, |
| 13956 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13957 | }; |
| 13958 | |
| 13959 | static int patch_alc268(struct hda_codec *codec) |
| 13960 | { |
| 13961 | struct alc_spec *spec; |
| 13962 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13963 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13964 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13965 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13966 | if (spec == NULL) |
| 13967 | return -ENOMEM; |
| 13968 | |
| 13969 | codec->spec = spec; |
| 13970 | |
| 13971 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13972 | alc268_models, |
| 13973 | alc268_cfg_tbl); |
| 13974 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13975 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13976 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13977 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13978 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13979 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13980 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13981 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13982 | board_config = ALC268_AUTO; |
| 13983 | } |
| 13984 | |
| 13985 | if (board_config == ALC268_AUTO) { |
| 13986 | /* automatic parse from the BIOS config */ |
| 13987 | err = alc268_parse_auto_config(codec); |
| 13988 | if (err < 0) { |
| 13989 | alc_free(codec); |
| 13990 | return err; |
| 13991 | } else if (!err) { |
| 13992 | printk(KERN_INFO |
| 13993 | "hda_codec: Cannot set up configuration " |
| 13994 | "from BIOS. Using base mode...\n"); |
| 13995 | board_config = ALC268_3ST; |
| 13996 | } |
| 13997 | } |
| 13998 | |
| 13999 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14000 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14001 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14002 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14003 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14004 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14005 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14006 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14007 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14008 | has_beep = 0; |
| 14009 | for (i = 0; i < spec->num_mixers; i++) { |
| 14010 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14011 | has_beep = 1; |
| 14012 | break; |
| 14013 | } |
| 14014 | } |
| 14015 | |
| 14016 | if (has_beep) { |
| 14017 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14018 | if (err < 0) { |
| 14019 | alc_free(codec); |
| 14020 | return err; |
| 14021 | } |
| 14022 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14023 | /* override the amp caps for beep generator */ |
| 14024 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14025 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14026 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14027 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14028 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14029 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14030 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14031 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14032 | /* check whether NID 0x07 is valid */ |
| 14033 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14034 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14035 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14036 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14037 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14038 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14039 | if (spec->auto_mic || |
| 14040 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14041 | spec->adc_nids = alc268_adc_nids_alt; |
| 14042 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14043 | if (spec->auto_mic) |
| 14044 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14045 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14046 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14047 | else |
| 14048 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14049 | } else { |
| 14050 | spec->adc_nids = alc268_adc_nids; |
| 14051 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14052 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14053 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14054 | /* set default input source */ |
| 14055 | for (i = 0; i < spec->num_adc_nids; i++) |
| 14056 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 14057 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 14058 | i < spec->num_mux_defs ? |
| 14059 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 14060 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14061 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14062 | |
| 14063 | spec->vmaster_nid = 0x02; |
| 14064 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14065 | codec->patch_ops = alc_patch_ops; |
| 14066 | if (board_config == ALC268_AUTO) |
| 14067 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14068 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14069 | alc_init_jacks(codec); |
| 14070 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14071 | return 0; |
| 14072 | } |
| 14073 | |
| 14074 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14075 | * ALC269 channel source setting (2 channel) |
| 14076 | */ |
| 14077 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14078 | |
| 14079 | #define alc269_dac_nids alc260_dac_nids |
| 14080 | |
| 14081 | static hda_nid_t alc269_adc_nids[1] = { |
| 14082 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14083 | 0x08, |
| 14084 | }; |
| 14085 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14086 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14087 | 0x23, |
| 14088 | }; |
| 14089 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14090 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14091 | /* ADC1 */ |
| 14092 | 0x09, |
| 14093 | }; |
| 14094 | |
| 14095 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14096 | 0x22, |
| 14097 | }; |
| 14098 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14099 | static hda_nid_t alc269_adc_candidates[] = { |
| 14100 | 0x08, 0x09, 0x07, |
| 14101 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14102 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14103 | #define alc269_modes alc260_modes |
| 14104 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14105 | |
| 14106 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14107 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14108 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14109 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14110 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14113 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14114 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14115 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14116 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14117 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14118 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14119 | { } /* end */ |
| 14120 | }; |
| 14121 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14122 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14123 | /* output mixer control */ |
| 14124 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14125 | { |
| 14126 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14127 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14128 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14129 | .info = snd_hda_mixer_amp_switch_info, |
| 14130 | .get = snd_hda_mixer_amp_switch_get, |
| 14131 | .put = alc268_acer_master_sw_put, |
| 14132 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14133 | }, |
| 14134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14135 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14136 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14137 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14138 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14139 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14140 | { } |
| 14141 | }; |
| 14142 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14143 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14144 | /* output mixer control */ |
| 14145 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14146 | { |
| 14147 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14148 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14149 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14150 | .info = snd_hda_mixer_amp_switch_info, |
| 14151 | .get = snd_hda_mixer_amp_switch_get, |
| 14152 | .put = alc268_acer_master_sw_put, |
| 14153 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14154 | }, |
| 14155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14156 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14157 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14158 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14159 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14160 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14161 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14162 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14163 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14164 | { } |
| 14165 | }; |
| 14166 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14167 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14168 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14169 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14170 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14171 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14172 | { } /* end */ |
| 14173 | }; |
| 14174 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14175 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14176 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14177 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14178 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14179 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14180 | { } /* end */ |
| 14181 | }; |
| 14182 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14183 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14184 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14185 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14186 | { } /* end */ |
| 14187 | }; |
| 14188 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14189 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14190 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14191 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14192 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14193 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14194 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14195 | { } /* end */ |
| 14196 | }; |
| 14197 | |
| 14198 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14199 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14200 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14201 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14202 | { } /* end */ |
| 14203 | }; |
| 14204 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14205 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14206 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14207 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14208 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14209 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14210 | { } /* end */ |
| 14211 | }; |
| 14212 | |
| 14213 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14214 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14215 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14216 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14217 | { } /* end */ |
| 14218 | }; |
| 14219 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14220 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14221 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14222 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14223 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14224 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14225 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14226 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14227 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14228 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14229 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14230 | { } |
| 14231 | }; |
| 14232 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14233 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14235 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14236 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14237 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14238 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14239 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14240 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14241 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14242 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14243 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14244 | { } |
| 14245 | }; |
| 14246 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14247 | /* toggle speaker-output according to the hp-jack state */ |
| 14248 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14249 | { |
| 14250 | unsigned int present; |
| 14251 | unsigned char bits; |
| 14252 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14253 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14254 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14255 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14256 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14257 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14258 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14259 | |
| 14260 | snd_hda_codec_write(codec, 0x20, 0, |
| 14261 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14262 | snd_hda_codec_write(codec, 0x20, 0, |
| 14263 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14264 | |
| 14265 | snd_hda_codec_write(codec, 0x20, 0, |
| 14266 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14267 | snd_hda_codec_write(codec, 0x20, 0, |
| 14268 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14269 | } |
| 14270 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14271 | /* toggle speaker-output according to the hp-jacks state */ |
| 14272 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14273 | { |
| 14274 | unsigned int present; |
| 14275 | unsigned char bits; |
| 14276 | |
| 14277 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14278 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14279 | |
| 14280 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14281 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14282 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14283 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14284 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14285 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14286 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14287 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14288 | |
| 14289 | snd_hda_codec_write(codec, 0x20, 0, |
| 14290 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14291 | snd_hda_codec_write(codec, 0x20, 0, |
| 14292 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14293 | |
| 14294 | snd_hda_codec_write(codec, 0x20, 0, |
| 14295 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14296 | snd_hda_codec_write(codec, 0x20, 0, |
| 14297 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14298 | } |
| 14299 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14300 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14301 | { |
| 14302 | unsigned int present_laptop; |
| 14303 | unsigned int present_dock; |
| 14304 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14305 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14306 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14307 | |
| 14308 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14309 | if (present_dock) |
| 14310 | snd_hda_codec_write(codec, 0x23, 0, |
| 14311 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14312 | if (present_laptop) |
| 14313 | snd_hda_codec_write(codec, 0x23, 0, |
| 14314 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14315 | if (!present_dock && !present_laptop) |
| 14316 | snd_hda_codec_write(codec, 0x23, 0, |
| 14317 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14318 | } |
| 14319 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14320 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14321 | unsigned int res) |
| 14322 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14323 | switch (res >> 26) { |
| 14324 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14325 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14326 | break; |
| 14327 | case ALC880_MIC_EVENT: |
| 14328 | alc_mic_automute(codec); |
| 14329 | break; |
| 14330 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14331 | } |
| 14332 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14333 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14334 | unsigned int res) |
| 14335 | { |
| 14336 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14337 | alc269_lifebook_speaker_automute(codec); |
| 14338 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14339 | alc269_lifebook_mic_autoswitch(codec); |
| 14340 | } |
| 14341 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14342 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14343 | { |
| 14344 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14345 | spec->autocfg.hp_pins[0] = 0x15; |
| 14346 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14347 | spec->ext_mic.pin = 0x18; |
| 14348 | spec->ext_mic.mux_idx = 0; |
| 14349 | spec->int_mic.pin = 0x19; |
| 14350 | spec->int_mic.mux_idx = 1; |
| 14351 | spec->auto_mic = 1; |
| 14352 | } |
| 14353 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14354 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14355 | { |
| 14356 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14357 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14358 | } |
| 14359 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14360 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14361 | { |
| 14362 | alc269_lifebook_speaker_automute(codec); |
| 14363 | alc269_lifebook_mic_autoswitch(codec); |
| 14364 | } |
| 14365 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14366 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14367 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14368 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14369 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14370 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14371 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14372 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14373 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14374 | {} |
| 14375 | }; |
| 14376 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14377 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14378 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14379 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14380 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14381 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14382 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14383 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14384 | {} |
| 14385 | }; |
| 14386 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14387 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14388 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14389 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14390 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14391 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14392 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14393 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14394 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14395 | {} |
| 14396 | }; |
| 14397 | |
| 14398 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14399 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14400 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14401 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14402 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14403 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14404 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14405 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14406 | {} |
| 14407 | }; |
| 14408 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14409 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14410 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14411 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14412 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14413 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14414 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14415 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14416 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14417 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14418 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14419 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14420 | { } |
| 14421 | }; |
| 14422 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14423 | /* toggle speaker-output according to the hp-jack state */ |
| 14424 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14425 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14426 | struct alc_spec *spec = codec->spec; |
| 14427 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14428 | unsigned int present; |
| 14429 | unsigned char bits; |
| 14430 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14431 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14432 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14433 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14434 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14435 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14436 | HDA_AMP_MUTE, bits); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 14437 | snd_hda_input_jack_report(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14438 | } |
| 14439 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14440 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14441 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14442 | unsigned int res) |
| 14443 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14444 | switch (res >> 26) { |
| 14445 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14446 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14447 | break; |
| 14448 | case ALC880_MIC_EVENT: |
| 14449 | alc_mic_automute(codec); |
| 14450 | break; |
| 14451 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14452 | } |
| 14453 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14454 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14455 | { |
| 14456 | struct alc_spec *spec = codec->spec; |
| 14457 | spec->autocfg.hp_pins[0] = 0x15; |
| 14458 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14459 | spec->ext_mic.pin = 0x18; |
| 14460 | spec->ext_mic.mux_idx = 0; |
| 14461 | spec->int_mic.pin = 0x19; |
| 14462 | spec->int_mic.mux_idx = 1; |
| 14463 | spec->auto_mic = 1; |
| 14464 | } |
| 14465 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14466 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14467 | { |
| 14468 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14469 | spec->autocfg.hp_pins[0] = 0x15; |
| 14470 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14471 | spec->ext_mic.pin = 0x18; |
| 14472 | spec->ext_mic.mux_idx = 0; |
| 14473 | spec->int_mic.pin = 0x12; |
| 14474 | spec->int_mic.mux_idx = 5; |
| 14475 | spec->auto_mic = 1; |
| 14476 | } |
| 14477 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14478 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14479 | { |
| 14480 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14481 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14482 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14483 | spec->ext_mic.pin = 0x18; |
| 14484 | spec->ext_mic.mux_idx = 0; |
| 14485 | spec->int_mic.pin = 0x19; |
| 14486 | spec->int_mic.mux_idx = 1; |
| 14487 | spec->auto_mic = 1; |
| 14488 | } |
| 14489 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14490 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14491 | { |
| 14492 | struct alc_spec *spec = codec->spec; |
| 14493 | spec->autocfg.hp_pins[0] = 0x21; |
| 14494 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14495 | spec->ext_mic.pin = 0x18; |
| 14496 | spec->ext_mic.mux_idx = 0; |
| 14497 | spec->int_mic.pin = 0x12; |
| 14498 | spec->int_mic.mux_idx = 6; |
| 14499 | spec->auto_mic = 1; |
| 14500 | } |
| 14501 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14502 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14503 | { |
| 14504 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14505 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14506 | } |
| 14507 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14508 | /* |
| 14509 | * generic initialization of ADC, input mixers and output mixers |
| 14510 | */ |
| 14511 | static struct hda_verb alc269_init_verbs[] = { |
| 14512 | /* |
| 14513 | * Unmute ADC0 and set the default input to mic-in |
| 14514 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14516 | |
| 14517 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14518 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14519 | */ |
| 14520 | /* set vol=0 to output mixers */ |
| 14521 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14522 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14523 | |
| 14524 | /* set up input amps for analog loopback */ |
| 14525 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14528 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14529 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14530 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14531 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14532 | |
| 14533 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14534 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14535 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14536 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14537 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14538 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14539 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14540 | |
| 14541 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14543 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14544 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14545 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14546 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14547 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14548 | |
| 14549 | /* set EAPD */ |
| 14550 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14551 | { } |
| 14552 | }; |
| 14553 | |
| 14554 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14555 | /* |
| 14556 | * Unmute ADC0 and set the default input to mic-in |
| 14557 | */ |
| 14558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14559 | |
| 14560 | /* |
| 14561 | * Set up output mixers (0x02 - 0x03) |
| 14562 | */ |
| 14563 | /* set vol=0 to output mixers */ |
| 14564 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14565 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14566 | |
| 14567 | /* set up input amps for analog loopback */ |
| 14568 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14569 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14570 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14571 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14572 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14573 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14574 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14575 | |
| 14576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14577 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14578 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14579 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14580 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14581 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14582 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14583 | |
| 14584 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14585 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14586 | |
| 14587 | /* FIXME: use Mux-type input source selection */ |
| 14588 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14589 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14590 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14591 | |
| 14592 | /* set EAPD */ |
| 14593 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14594 | { } |
| 14595 | }; |
| 14596 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14597 | #define alc269_auto_create_multi_out_ctls \ |
| 14598 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14599 | #define alc269_auto_create_input_ctls \ |
| 14600 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14601 | |
| 14602 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14603 | #define alc269_loopbacks alc880_loopbacks |
| 14604 | #endif |
| 14605 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14606 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14607 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14608 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14609 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14610 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14611 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14612 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14613 | .substreams = 1, |
| 14614 | .channels_min = 2, |
| 14615 | .channels_max = 8, |
| 14616 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14617 | /* NID is set in alc_build_pcms */ |
| 14618 | .ops = { |
| 14619 | .open = alc880_playback_pcm_open, |
| 14620 | .prepare = alc880_playback_pcm_prepare, |
| 14621 | .cleanup = alc880_playback_pcm_cleanup |
| 14622 | }, |
| 14623 | }; |
| 14624 | |
| 14625 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14626 | .substreams = 1, |
| 14627 | .channels_min = 2, |
| 14628 | .channels_max = 2, |
| 14629 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14630 | /* NID is set in alc_build_pcms */ |
| 14631 | }; |
| 14632 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14633 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14634 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14635 | { |
| 14636 | switch (codec->subsystem_id) { |
| 14637 | case 0x103c1586: |
| 14638 | return 1; |
| 14639 | } |
| 14640 | return 0; |
| 14641 | } |
| 14642 | |
| 14643 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14644 | { |
| 14645 | /* update mute-LED according to the speaker mute state */ |
| 14646 | if (nid == 0x01 || nid == 0x14) { |
| 14647 | int pinval; |
| 14648 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14649 | HDA_AMP_MUTE) |
| 14650 | pinval = 0x24; |
| 14651 | else |
| 14652 | pinval = 0x20; |
| 14653 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14654 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14655 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14656 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14657 | } |
| 14658 | return alc_check_power_status(codec, nid); |
| 14659 | } |
| 14660 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14661 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14662 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14663 | { |
| 14664 | struct alc_spec *spec = codec->spec; |
| 14665 | |
| 14666 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14667 | return 0; |
| 14668 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14669 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14670 | if (spec->ext_mic.pin <= 0x12) { |
| 14671 | spec->private_adc_nids[0] = 0x08; |
| 14672 | spec->private_adc_nids[1] = 0x11; |
| 14673 | spec->private_capsrc_nids[0] = 0x23; |
| 14674 | spec->private_capsrc_nids[1] = 0x22; |
| 14675 | } else { |
| 14676 | spec->private_adc_nids[0] = 0x11; |
| 14677 | spec->private_adc_nids[1] = 0x08; |
| 14678 | spec->private_capsrc_nids[0] = 0x22; |
| 14679 | spec->private_capsrc_nids[1] = 0x23; |
| 14680 | } |
| 14681 | spec->adc_nids = spec->private_adc_nids; |
| 14682 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14683 | spec->num_adc_nids = 2; |
| 14684 | spec->dual_adc_switch = 1; |
| 14685 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14686 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14687 | return 1; |
| 14688 | } |
| 14689 | return 0; |
| 14690 | } |
| 14691 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14692 | /* different alc269-variants */ |
| 14693 | enum { |
| 14694 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14695 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14696 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14697 | ALC269_TYPE_ALC269VB, |
| 14698 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14699 | ALC269_TYPE_ALC271X, |
| 14700 | }; |
| 14701 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14702 | /* |
| 14703 | * BIOS auto configuration |
| 14704 | */ |
| 14705 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14706 | { |
| 14707 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14708 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14709 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14710 | |
| 14711 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14712 | alc269_ignore); |
| 14713 | if (err < 0) |
| 14714 | return err; |
| 14715 | |
| 14716 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14717 | if (err < 0) |
| 14718 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14719 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14720 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14721 | else |
| 14722 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14723 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14724 | if (err < 0) |
| 14725 | return err; |
| 14726 | |
| 14727 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14728 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14729 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14730 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14731 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14732 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14733 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14734 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14735 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14736 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14737 | } else { |
| 14738 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14739 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14740 | } |
| 14741 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14742 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14743 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14744 | |
| 14745 | if (!alc275_setup_dual_adc(codec)) |
| 14746 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14747 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14748 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14749 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14750 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14751 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14752 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14753 | |
| 14754 | err = alc_auto_add_mic_boost(codec); |
| 14755 | if (err < 0) |
| 14756 | return err; |
| 14757 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14758 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14759 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14760 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14761 | return 1; |
| 14762 | } |
| 14763 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14764 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14765 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14766 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14767 | |
| 14768 | |
| 14769 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14770 | static void alc269_auto_init(struct hda_codec *codec) |
| 14771 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14772 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14773 | alc269_auto_init_multi_out(codec); |
| 14774 | alc269_auto_init_hp_out(codec); |
| 14775 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14776 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14777 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14778 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14779 | } |
| 14780 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14781 | #ifdef SND_HDA_NEEDS_RESUME |
| 14782 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14783 | { |
| 14784 | int val = alc_read_coef_idx(codec, 0x04); |
| 14785 | if (power_up) |
| 14786 | val |= 1 << 11; |
| 14787 | else |
| 14788 | val &= ~(1 << 11); |
| 14789 | alc_write_coef_idx(codec, 0x04, val); |
| 14790 | } |
| 14791 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14792 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14793 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) |
| 14794 | { |
| 14795 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14796 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14797 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14798 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14799 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14800 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14801 | msleep(150); |
| 14802 | } |
| 14803 | |
| 14804 | alc_shutup(codec); |
| 14805 | if (spec && spec->power_hook) |
| 14806 | spec->power_hook(codec); |
| 14807 | return 0; |
| 14808 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14809 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14810 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14811 | static int alc269_resume(struct hda_codec *codec) |
| 14812 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14813 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14814 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14815 | msleep(150); |
| 14816 | } |
| 14817 | |
| 14818 | codec->patch_ops.init(codec); |
| 14819 | |
| 14820 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14821 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14822 | msleep(200); |
| 14823 | } |
| 14824 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14825 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14826 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14827 | |
| 14828 | snd_hda_codec_resume_amp(codec); |
| 14829 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14830 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14831 | return 0; |
| 14832 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14833 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14834 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14835 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14836 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14837 | { |
| 14838 | int coef; |
| 14839 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14840 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14841 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14842 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14843 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14844 | } |
| 14845 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14846 | enum { |
| 14847 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14848 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14849 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14850 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14851 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14852 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14853 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14854 | }; |
| 14855 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14856 | static const struct alc_fixup alc269_fixups[] = { |
| 14857 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14858 | .type = ALC_FIXUP_VERBS, |
| 14859 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14861 | {} |
| 14862 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14863 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14864 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14865 | .type = ALC_FIXUP_VERBS, |
| 14866 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14867 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14868 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14869 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14870 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14871 | }, |
| 14872 | .chained = true, |
| 14873 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14874 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14875 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14876 | .type = ALC_FIXUP_VERBS, |
| 14877 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14878 | /* Enables internal speaker */ |
| 14879 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14880 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14881 | {} |
| 14882 | } |
| 14883 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14884 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14885 | .type = ALC_FIXUP_SKU, |
| 14886 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14887 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14888 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14889 | .type = ALC_FIXUP_PINS, |
| 14890 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14891 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14892 | { } |
| 14893 | } |
| 14894 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14895 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14896 | .type = ALC_FIXUP_VERBS, |
| 14897 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14898 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14899 | {} |
| 14900 | } |
| 14901 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14902 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14903 | .type = ALC_FIXUP_FUNC, |
| 14904 | .v.func = alc269_fixup_hweq, |
| 14905 | .chained = true, |
| 14906 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14907 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14908 | }; |
| 14909 | |
| 14910 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14911 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14912 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14913 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14914 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14915 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14916 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14917 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14918 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14919 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14920 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14921 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14922 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14923 | {} |
| 14924 | }; |
| 14925 | |
| 14926 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14927 | /* |
| 14928 | * configuration and preset |
| 14929 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14930 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14931 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14932 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14933 | [ALC269_AMIC] = "laptop-amic", |
| 14934 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14935 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14936 | [ALC269_LIFEBOOK] = "lifebook", |
| 14937 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14938 | }; |
| 14939 | |
| 14940 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14941 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14942 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14943 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14944 | ALC269_AMIC), |
| 14945 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14946 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14947 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14948 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14949 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14950 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14951 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14952 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14953 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 14954 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14955 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14956 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14957 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14958 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14959 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14960 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14961 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14962 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14963 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14964 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14965 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14966 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14967 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14968 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14969 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14970 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14971 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14972 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14973 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14974 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14975 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14976 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14977 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14978 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14979 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14980 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14981 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14982 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14983 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14984 | ALC269_DMIC), |
| 14985 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14986 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14987 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14988 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14989 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14990 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14991 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14992 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14993 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14994 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14995 | {} |
| 14996 | }; |
| 14997 | |
| 14998 | static struct alc_config_preset alc269_presets[] = { |
| 14999 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15000 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15001 | .init_verbs = { alc269_init_verbs }, |
| 15002 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15003 | .dac_nids = alc269_dac_nids, |
| 15004 | .hp_nid = 0x03, |
| 15005 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15006 | .channel_mode = alc269_modes, |
| 15007 | .input_mux = &alc269_capture_source, |
| 15008 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15009 | [ALC269_QUANTA_FL1] = { |
| 15010 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15011 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15012 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15013 | .dac_nids = alc269_dac_nids, |
| 15014 | .hp_nid = 0x03, |
| 15015 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15016 | .channel_mode = alc269_modes, |
| 15017 | .input_mux = &alc269_capture_source, |
| 15018 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15019 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15020 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15021 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15022 | [ALC269_AMIC] = { |
| 15023 | .mixers = { alc269_laptop_mixer }, |
| 15024 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15025 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15026 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15027 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15028 | .dac_nids = alc269_dac_nids, |
| 15029 | .hp_nid = 0x03, |
| 15030 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15031 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15032 | .unsol_event = alc269_laptop_unsol_event, |
| 15033 | .setup = alc269_laptop_amic_setup, |
| 15034 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15035 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15036 | [ALC269_DMIC] = { |
| 15037 | .mixers = { alc269_laptop_mixer }, |
| 15038 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15039 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15040 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15041 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15042 | .dac_nids = alc269_dac_nids, |
| 15043 | .hp_nid = 0x03, |
| 15044 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15045 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15046 | .unsol_event = alc269_laptop_unsol_event, |
| 15047 | .setup = alc269_laptop_dmic_setup, |
| 15048 | .init_hook = alc269_laptop_inithook, |
| 15049 | }, |
| 15050 | [ALC269VB_AMIC] = { |
| 15051 | .mixers = { alc269vb_laptop_mixer }, |
| 15052 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15053 | .init_verbs = { alc269vb_init_verbs, |
| 15054 | alc269vb_laptop_amic_init_verbs }, |
| 15055 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15056 | .dac_nids = alc269_dac_nids, |
| 15057 | .hp_nid = 0x03, |
| 15058 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15059 | .channel_mode = alc269_modes, |
| 15060 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15061 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15062 | .init_hook = alc269_laptop_inithook, |
| 15063 | }, |
| 15064 | [ALC269VB_DMIC] = { |
| 15065 | .mixers = { alc269vb_laptop_mixer }, |
| 15066 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15067 | .init_verbs = { alc269vb_init_verbs, |
| 15068 | alc269vb_laptop_dmic_init_verbs }, |
| 15069 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15070 | .dac_nids = alc269_dac_nids, |
| 15071 | .hp_nid = 0x03, |
| 15072 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15073 | .channel_mode = alc269_modes, |
| 15074 | .unsol_event = alc269_laptop_unsol_event, |
| 15075 | .setup = alc269vb_laptop_dmic_setup, |
| 15076 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15077 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15078 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15079 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15080 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15081 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15082 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15083 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15084 | .dac_nids = alc269_dac_nids, |
| 15085 | .hp_nid = 0x03, |
| 15086 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15087 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15088 | .unsol_event = alc269_laptop_unsol_event, |
| 15089 | .setup = alc269_laptop_dmic_setup, |
| 15090 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15091 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15092 | [ALC269_LIFEBOOK] = { |
| 15093 | .mixers = { alc269_lifebook_mixer }, |
| 15094 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15095 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15096 | .dac_nids = alc269_dac_nids, |
| 15097 | .hp_nid = 0x03, |
| 15098 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15099 | .channel_mode = alc269_modes, |
| 15100 | .input_mux = &alc269_capture_source, |
| 15101 | .unsol_event = alc269_lifebook_unsol_event, |
| 15102 | .init_hook = alc269_lifebook_init_hook, |
| 15103 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15104 | [ALC271_ACER] = { |
| 15105 | .mixers = { alc269_asus_mixer }, |
| 15106 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15107 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15108 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15109 | .dac_nids = alc269_dac_nids, |
| 15110 | .adc_nids = alc262_dmic_adc_nids, |
| 15111 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15112 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15113 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15114 | .channel_mode = alc269_modes, |
| 15115 | .input_mux = &alc269_capture_source, |
| 15116 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15117 | .unsol_event = alc_sku_unsol_event, |
| 15118 | .setup = alc269vb_laptop_dmic_setup, |
| 15119 | .init_hook = alc_inithook, |
| 15120 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15121 | }; |
| 15122 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15123 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15124 | { |
| 15125 | int val; |
| 15126 | |
| 15127 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15128 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15129 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15130 | } |
| 15131 | |
| 15132 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15133 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15134 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15135 | } |
| 15136 | |
| 15137 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15138 | val = alc_read_coef_idx(codec, 0x04); |
| 15139 | /* Power up output pin */ |
| 15140 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15141 | } |
| 15142 | |
| 15143 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15144 | val = alc_read_coef_idx(codec, 0xd); |
| 15145 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15146 | /* Capless ramp up clock control */ |
| 15147 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15148 | } |
| 15149 | val = alc_read_coef_idx(codec, 0x17); |
| 15150 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15151 | /* Class D power on reset */ |
| 15152 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15153 | } |
| 15154 | } |
| 15155 | return 0; |
| 15156 | } |
| 15157 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15158 | static int patch_alc269(struct hda_codec *codec) |
| 15159 | { |
| 15160 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15161 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15162 | int err; |
| 15163 | |
| 15164 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15165 | if (spec == NULL) |
| 15166 | return -ENOMEM; |
| 15167 | |
| 15168 | codec->spec = spec; |
| 15169 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15170 | alc_auto_parse_customize_define(codec); |
| 15171 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15172 | if (codec->vendor_id == 0x10ec0269) { |
| 15173 | coef = alc_read_coef_idx(codec, 0); |
| 15174 | if ((coef & 0x00f0) == 0x0010) { |
| 15175 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15176 | spec->cdefine.platform_type == 1) { |
| 15177 | alc_codec_rename(codec, "ALC271X"); |
| 15178 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15179 | } else if ((coef & 0xf000) == 0x1000) { |
| 15180 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15181 | } else if ((coef & 0xf000) == 0x2000) { |
| 15182 | alc_codec_rename(codec, "ALC259"); |
| 15183 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15184 | } else if ((coef & 0xf000) == 0x3000) { |
| 15185 | alc_codec_rename(codec, "ALC258"); |
| 15186 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15187 | } else { |
| 15188 | alc_codec_rename(codec, "ALC269VB"); |
| 15189 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15190 | } |
| 15191 | } else |
| 15192 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15193 | alc269_fill_coef(codec); |
| 15194 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15195 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15196 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15197 | alc269_models, |
| 15198 | alc269_cfg_tbl); |
| 15199 | |
| 15200 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15201 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15202 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15203 | board_config = ALC269_AUTO; |
| 15204 | } |
| 15205 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15206 | if (board_config == ALC269_AUTO) { |
| 15207 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15208 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15209 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15210 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15211 | if (board_config == ALC269_AUTO) { |
| 15212 | /* automatic parse from the BIOS config */ |
| 15213 | err = alc269_parse_auto_config(codec); |
| 15214 | if (err < 0) { |
| 15215 | alc_free(codec); |
| 15216 | return err; |
| 15217 | } else if (!err) { |
| 15218 | printk(KERN_INFO |
| 15219 | "hda_codec: Cannot set up configuration " |
| 15220 | "from BIOS. Using base mode...\n"); |
| 15221 | board_config = ALC269_BASIC; |
| 15222 | } |
| 15223 | } |
| 15224 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15225 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15226 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15227 | if (err < 0) { |
| 15228 | alc_free(codec); |
| 15229 | return err; |
| 15230 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15231 | } |
| 15232 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15233 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15234 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15235 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15236 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15237 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15238 | * fix the sample rate of analog I/O to 44.1kHz |
| 15239 | */ |
| 15240 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15241 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15242 | } else if (spec->dual_adc_switch) { |
| 15243 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15244 | /* switch ADC dynamically */ |
| 15245 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15246 | } else { |
| 15247 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15248 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15249 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15250 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15251 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15252 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15253 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15254 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15255 | spec->adc_nids = alc269_adc_nids; |
| 15256 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15257 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15258 | } else { |
| 15259 | spec->adc_nids = alc269vb_adc_nids; |
| 15260 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15261 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15262 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15263 | } |
| 15264 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15265 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15266 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15267 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15268 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15269 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15270 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15271 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15272 | spec->vmaster_nid = 0x02; |
| 15273 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15274 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15275 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15276 | codec->patch_ops.suspend = alc269_suspend; |
| 15277 | #endif |
| 15278 | #ifdef SND_HDA_NEEDS_RESUME |
| 15279 | codec->patch_ops.resume = alc269_resume; |
| 15280 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15281 | if (board_config == ALC269_AUTO) |
| 15282 | spec->init_hook = alc269_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15283 | |
| 15284 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15286 | if (!spec->loopback.amplist) |
| 15287 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15288 | if (alc269_mic2_for_mute_led(codec)) |
| 15289 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15290 | #endif |
| 15291 | |
| 15292 | return 0; |
| 15293 | } |
| 15294 | |
| 15295 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15296 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15297 | */ |
| 15298 | |
| 15299 | /* |
| 15300 | * set the path ways for 2 channel output |
| 15301 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15302 | */ |
| 15303 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15304 | /* set pin widget 1Ah (line in) for input */ |
| 15305 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15306 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15307 | * the vref |
| 15308 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15309 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15310 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15311 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15312 | #if 0 |
| 15313 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15314 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15315 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15316 | { } /* end */ |
| 15317 | }; |
| 15318 | /* |
| 15319 | * 6ch mode |
| 15320 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15321 | */ |
| 15322 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15323 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15324 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15325 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15326 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15327 | |
| 15328 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15329 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15330 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15331 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15332 | #if 0 |
| 15333 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15334 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15335 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15336 | { } /* end */ |
| 15337 | }; |
| 15338 | |
| 15339 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15340 | { 2, alc861_threestack_ch2_init }, |
| 15341 | { 6, alc861_threestack_ch6_init }, |
| 15342 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15343 | /* Set mic1 as input and unmute the mixer */ |
| 15344 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15345 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15346 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15347 | { } /* end */ |
| 15348 | }; |
| 15349 | /* Set mic1 as output and mute mixer */ |
| 15350 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15351 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15352 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15353 | { } /* end */ |
| 15354 | }; |
| 15355 | |
| 15356 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15357 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15358 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15359 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15360 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15361 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15362 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15363 | /* set pin widget 1Ah (line in) for input */ |
| 15364 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15365 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15366 | * the vref |
| 15367 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15368 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15369 | |
| 15370 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15371 | #if 0 |
| 15372 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15373 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15374 | #endif |
| 15375 | { } /* end */ |
| 15376 | }; |
| 15377 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15378 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15379 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15380 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15381 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15382 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15383 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15384 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15385 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15386 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15387 | |
| 15388 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15389 | #if 0 |
| 15390 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15391 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15392 | #endif |
| 15393 | { } /* end */ |
| 15394 | }; |
| 15395 | |
| 15396 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15397 | { 2, alc861_asus_ch2_init }, |
| 15398 | { 6, alc861_asus_ch6_init }, |
| 15399 | }; |
| 15400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15401 | /* patch-ALC861 */ |
| 15402 | |
| 15403 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15404 | /* output mixer control */ |
| 15405 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15406 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15407 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15408 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15409 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15410 | |
| 15411 | /*Input mixer control */ |
| 15412 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15413 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15414 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15415 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15416 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15417 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15418 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15419 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15420 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15421 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15422 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15423 | { } /* end */ |
| 15424 | }; |
| 15425 | |
| 15426 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15427 | /* output mixer control */ |
| 15428 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15429 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15430 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15431 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15432 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15433 | |
| 15434 | /* Input mixer control */ |
| 15435 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15436 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15437 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15438 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15439 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15440 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15441 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15442 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15443 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15444 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15445 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15446 | { |
| 15447 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15448 | .name = "Channel Mode", |
| 15449 | .info = alc_ch_mode_info, |
| 15450 | .get = alc_ch_mode_get, |
| 15451 | .put = alc_ch_mode_put, |
| 15452 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15453 | }, |
| 15454 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15455 | }; |
| 15456 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15457 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15458 | /* output mixer control */ |
| 15459 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15462 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15463 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15464 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15465 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15466 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15467 | /* output mixer control */ |
| 15468 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15469 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15470 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15471 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15472 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15473 | |
| 15474 | /* Input mixer control */ |
| 15475 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15476 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15477 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15478 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15479 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15480 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15481 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15482 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15483 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15484 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15485 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15486 | { |
| 15487 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15488 | .name = "Channel Mode", |
| 15489 | .info = alc_ch_mode_info, |
| 15490 | .get = alc_ch_mode_get, |
| 15491 | .put = alc_ch_mode_put, |
| 15492 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15493 | }, |
| 15494 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15495 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15496 | |
| 15497 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15498 | /* output mixer control */ |
| 15499 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15500 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15501 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15502 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15503 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15504 | |
| 15505 | /* Input mixer control */ |
| 15506 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15507 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15508 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15509 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15510 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15511 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15512 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15513 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15514 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15516 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15517 | { |
| 15518 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15519 | .name = "Channel Mode", |
| 15520 | .info = alc_ch_mode_info, |
| 15521 | .get = alc_ch_mode_get, |
| 15522 | .put = alc_ch_mode_put, |
| 15523 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15524 | }, |
| 15525 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15526 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15527 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15528 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15529 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15530 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15531 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15532 | { } |
| 15533 | }; |
| 15534 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15535 | /* |
| 15536 | * generic initialization of ADC, input mixers and output mixers |
| 15537 | */ |
| 15538 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15539 | /* |
| 15540 | * Unmute ADC0 and set the default input to mic-in |
| 15541 | */ |
| 15542 | /* port-A for surround (rear panel) */ |
| 15543 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15544 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15545 | /* port-B for mic-in (rear panel) with vref */ |
| 15546 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15547 | /* port-C for line-in (rear panel) */ |
| 15548 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15549 | /* port-D for Front */ |
| 15550 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15551 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15552 | /* port-E for HP out (front panel) */ |
| 15553 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15554 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15555 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15556 | /* port-F for mic-in (front panel) with vref */ |
| 15557 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15558 | /* port-G for CLFE (rear panel) */ |
| 15559 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15560 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15561 | /* port-H for side (rear panel) */ |
| 15562 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15563 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15564 | /* CD-in */ |
| 15565 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15566 | /* route front mic to ADC1*/ |
| 15567 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15568 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15569 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15570 | /* Unmute DAC0~3 & spdif out*/ |
| 15571 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15572 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15573 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15574 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15576 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15577 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15578 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15579 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15580 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15581 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15582 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15583 | /* Unmute Stereo Mixer 15 */ |
| 15584 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15585 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15587 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15588 | |
| 15589 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15590 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15591 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15592 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15593 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15594 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15595 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15596 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15597 | /* hp used DAC 3 (Front) */ |
| 15598 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15599 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15600 | |
| 15601 | { } |
| 15602 | }; |
| 15603 | |
| 15604 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15605 | /* |
| 15606 | * Unmute ADC0 and set the default input to mic-in |
| 15607 | */ |
| 15608 | /* port-A for surround (rear panel) */ |
| 15609 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15610 | /* port-B for mic-in (rear panel) with vref */ |
| 15611 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15612 | /* port-C for line-in (rear panel) */ |
| 15613 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15614 | /* port-D for Front */ |
| 15615 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15616 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15617 | /* port-E for HP out (front panel) */ |
| 15618 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15619 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15620 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15621 | /* port-F for mic-in (front panel) with vref */ |
| 15622 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15623 | /* port-G for CLFE (rear panel) */ |
| 15624 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15625 | /* port-H for side (rear panel) */ |
| 15626 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15627 | /* CD-in */ |
| 15628 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15629 | /* route front mic to ADC1*/ |
| 15630 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15631 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15632 | /* Unmute DAC0~3 & spdif out*/ |
| 15633 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15634 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15635 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15636 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15637 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15639 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15640 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15641 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15642 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15643 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15644 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15645 | /* Unmute Stereo Mixer 15 */ |
| 15646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15650 | |
| 15651 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15652 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15653 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15654 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15655 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15656 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15657 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15658 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15659 | /* hp used DAC 3 (Front) */ |
| 15660 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15661 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15662 | { } |
| 15663 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15664 | |
| 15665 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15666 | /* |
| 15667 | * Unmute ADC0 and set the default input to mic-in |
| 15668 | */ |
| 15669 | /* port-A for surround (rear panel) */ |
| 15670 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15671 | /* port-B for mic-in (rear panel) with vref */ |
| 15672 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15673 | /* port-C for line-in (rear panel) */ |
| 15674 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15675 | /* port-D for Front */ |
| 15676 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15677 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15678 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15679 | /* this has to be set to VREF80 */ |
| 15680 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15681 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15682 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15683 | /* port-F for mic-in (front panel) with vref */ |
| 15684 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15685 | /* port-G for CLFE (rear panel) */ |
| 15686 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15687 | /* port-H for side (rear panel) */ |
| 15688 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15689 | /* CD-in */ |
| 15690 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15691 | /* route front mic to ADC1*/ |
| 15692 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15693 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15694 | /* Unmute DAC0~3 & spdif out*/ |
| 15695 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15696 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15697 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15698 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15700 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15701 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15702 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15703 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15704 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15705 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15706 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15707 | /* Unmute Stereo Mixer 15 */ |
| 15708 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15712 | |
| 15713 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15714 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15715 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15716 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15717 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15718 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15719 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15720 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15721 | /* hp used DAC 3 (Front) */ |
| 15722 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15723 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15724 | { } |
| 15725 | }; |
| 15726 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15727 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15728 | /* |
| 15729 | * Unmute ADC0 and set the default input to mic-in |
| 15730 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15731 | /* port-A for surround (rear panel) |
| 15732 | * according to codec#0 this is the HP jack |
| 15733 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15734 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15735 | /* route front PCM to HP */ |
| 15736 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15737 | /* port-B for mic-in (rear panel) with vref */ |
| 15738 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15739 | /* port-C for line-in (rear panel) */ |
| 15740 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15741 | /* port-D for Front */ |
| 15742 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15743 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15744 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15745 | /* this has to be set to VREF80 */ |
| 15746 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15747 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15748 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15749 | /* port-F for mic-in (front panel) with vref */ |
| 15750 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15751 | /* port-G for CLFE (rear panel) */ |
| 15752 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15753 | /* port-H for side (rear panel) */ |
| 15754 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15755 | /* CD-in */ |
| 15756 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15757 | /* route front mic to ADC1*/ |
| 15758 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15759 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15760 | /* Unmute DAC0~3 & spdif out*/ |
| 15761 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15762 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15763 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15764 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15765 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15766 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15767 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15768 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15769 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15770 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15771 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15772 | /* Unmute Stereo Mixer 15 */ |
| 15773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15776 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15777 | |
| 15778 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15779 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15780 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15781 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15782 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15783 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15784 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15785 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15786 | /* hp used DAC 3 (Front) */ |
| 15787 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15788 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15789 | { } |
| 15790 | }; |
| 15791 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15792 | /* additional init verbs for ASUS laptops */ |
| 15793 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15794 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15795 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15796 | { } |
| 15797 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15798 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15799 | /* |
| 15800 | * generic initialization of ADC, input mixers and output mixers |
| 15801 | */ |
| 15802 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15803 | /* |
| 15804 | * Unmute ADC0 and set the default input to mic-in |
| 15805 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15806 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15807 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15808 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15809 | /* Unmute DAC0~3 & spdif out*/ |
| 15810 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15811 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15812 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15813 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15814 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15815 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15816 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15817 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15818 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15819 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15820 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15821 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15822 | /* Unmute Stereo Mixer 15 */ |
| 15823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15824 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15825 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15826 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15827 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15828 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15829 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15830 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15831 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15832 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15833 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15834 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15835 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15836 | |
| 15837 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15838 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15839 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15840 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15841 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15842 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15843 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15844 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15845 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15846 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15847 | |
| 15848 | { } |
| 15849 | }; |
| 15850 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15851 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15852 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15853 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15854 | { } |
| 15855 | }; |
| 15856 | |
| 15857 | /* toggle speaker-output according to the hp-jack state */ |
| 15858 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15859 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15860 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15861 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15862 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15863 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15864 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15865 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15866 | } |
| 15867 | |
| 15868 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15869 | unsigned int res) |
| 15870 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15871 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15872 | alc861_toshiba_automute(codec); |
| 15873 | } |
| 15874 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15875 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15876 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15877 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15878 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15879 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15880 | |
| 15881 | |
| 15882 | #define ALC861_DIGOUT_NID 0x07 |
| 15883 | |
| 15884 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15885 | { 8, NULL } |
| 15886 | }; |
| 15887 | |
| 15888 | static hda_nid_t alc861_dac_nids[4] = { |
| 15889 | /* front, surround, clfe, side */ |
| 15890 | 0x03, 0x06, 0x05, 0x04 |
| 15891 | }; |
| 15892 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15893 | static hda_nid_t alc660_dac_nids[3] = { |
| 15894 | /* front, clfe, surround */ |
| 15895 | 0x03, 0x05, 0x06 |
| 15896 | }; |
| 15897 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15898 | static hda_nid_t alc861_adc_nids[1] = { |
| 15899 | /* ADC0-2 */ |
| 15900 | 0x08, |
| 15901 | }; |
| 15902 | |
| 15903 | static struct hda_input_mux alc861_capture_source = { |
| 15904 | .num_items = 5, |
| 15905 | .items = { |
| 15906 | { "Mic", 0x0 }, |
| 15907 | { "Front Mic", 0x3 }, |
| 15908 | { "Line", 0x1 }, |
| 15909 | { "CD", 0x4 }, |
| 15910 | { "Mixer", 0x5 }, |
| 15911 | }, |
| 15912 | }; |
| 15913 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15914 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15915 | { |
| 15916 | struct alc_spec *spec = codec->spec; |
| 15917 | hda_nid_t mix, srcs[5]; |
| 15918 | int i, j, num; |
| 15919 | |
| 15920 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15921 | return 0; |
| 15922 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15923 | if (num < 0) |
| 15924 | return 0; |
| 15925 | for (i = 0; i < num; i++) { |
| 15926 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15927 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15928 | if (type != AC_WID_AUD_OUT) |
| 15929 | continue; |
| 15930 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15931 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15932 | break; |
| 15933 | if (j >= spec->multiout.num_dacs) |
| 15934 | return srcs[i]; |
| 15935 | } |
| 15936 | return 0; |
| 15937 | } |
| 15938 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15939 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15940 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15941 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15942 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15943 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15944 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15945 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15946 | |
| 15947 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15948 | for (i = 0; i < cfg->line_outs; i++) { |
| 15949 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15950 | dac = alc861_look_for_dac(codec, nid); |
| 15951 | if (!dac) |
| 15952 | continue; |
| 15953 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15954 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15955 | return 0; |
| 15956 | } |
| 15957 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15958 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15959 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15960 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15961 | 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] | 15962 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15963 | } |
| 15964 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15965 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15966 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15967 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15968 | /* add playback controls from the parsed DAC table */ |
| 15969 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15970 | const struct auto_pin_cfg *cfg) |
| 15971 | { |
| 15972 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 15973 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15974 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15975 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15976 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15977 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15978 | int i, err; |
| 15979 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15980 | for (i = 0; i < cfg->line_outs; i++) { |
| 15981 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15982 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15983 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15984 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15985 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15986 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15987 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15988 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15989 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15990 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15991 | return err; |
| 15992 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15993 | const char *name = pfx; |
| 15994 | if (!name) |
| 15995 | name = chname[i]; |
| 15996 | err = __alc861_create_out_sw(codec, name, nid, i, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15997 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15998 | return err; |
| 15999 | } |
| 16000 | } |
| 16001 | return 0; |
| 16002 | } |
| 16003 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16004 | 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] | 16005 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16006 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16007 | int err; |
| 16008 | hda_nid_t nid; |
| 16009 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16010 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16011 | return 0; |
| 16012 | |
| 16013 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16014 | nid = alc861_look_for_dac(codec, pin); |
| 16015 | if (nid) { |
| 16016 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16017 | if (err < 0) |
| 16018 | return err; |
| 16019 | spec->multiout.hp_nid = nid; |
| 16020 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16021 | } |
| 16022 | return 0; |
| 16023 | } |
| 16024 | |
| 16025 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16026 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16027 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16028 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16029 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16030 | } |
| 16031 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16032 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16033 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16034 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16035 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16036 | hda_nid_t mix, srcs[5]; |
| 16037 | int i, num; |
| 16038 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16039 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16040 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16041 | 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] | 16042 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16043 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16044 | return; |
| 16045 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16046 | if (num < 0) |
| 16047 | return; |
| 16048 | for (i = 0; i < num; i++) { |
| 16049 | unsigned int mute; |
| 16050 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16051 | mute = AMP_IN_UNMUTE(i); |
| 16052 | else |
| 16053 | mute = AMP_IN_MUTE(i); |
| 16054 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16055 | mute); |
| 16056 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16057 | } |
| 16058 | |
| 16059 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16060 | { |
| 16061 | struct alc_spec *spec = codec->spec; |
| 16062 | int i; |
| 16063 | |
| 16064 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16065 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16066 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16067 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16068 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16069 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16070 | } |
| 16071 | } |
| 16072 | |
| 16073 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16074 | { |
| 16075 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16076 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16077 | if (spec->autocfg.hp_outs) |
| 16078 | alc861_auto_set_output_and_unmute(codec, |
| 16079 | spec->autocfg.hp_pins[0], |
| 16080 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16081 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16082 | if (spec->autocfg.speaker_outs) |
| 16083 | alc861_auto_set_output_and_unmute(codec, |
| 16084 | spec->autocfg.speaker_pins[0], |
| 16085 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16086 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16087 | } |
| 16088 | |
| 16089 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16090 | { |
| 16091 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16092 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16093 | int i; |
| 16094 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16095 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16096 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16097 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16098 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16099 | } |
| 16100 | } |
| 16101 | |
| 16102 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16103 | /* return 1 if successful, 0 if the proper config is not found, |
| 16104 | * or a negative error code |
| 16105 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16106 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16107 | { |
| 16108 | struct alc_spec *spec = codec->spec; |
| 16109 | int err; |
| 16110 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16111 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16112 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16113 | alc861_ignore); |
| 16114 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16115 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16116 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16117 | return 0; /* can't find valid BIOS pin config */ |
| 16118 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16119 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16120 | if (err < 0) |
| 16121 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16122 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16123 | if (err < 0) |
| 16124 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16125 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16126 | if (err < 0) |
| 16127 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16128 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16129 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16130 | return err; |
| 16131 | |
| 16132 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16133 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16134 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16135 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16136 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16137 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16138 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16139 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16140 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16141 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16142 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16143 | |
| 16144 | spec->adc_nids = alc861_adc_nids; |
| 16145 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16146 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16147 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16148 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16149 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16150 | return 1; |
| 16151 | } |
| 16152 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16153 | /* additional initialization for auto-configuration model */ |
| 16154 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16155 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16156 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16157 | alc861_auto_init_multi_out(codec); |
| 16158 | alc861_auto_init_hp_out(codec); |
| 16159 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16160 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16161 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16162 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16163 | } |
| 16164 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16165 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16166 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16167 | { 0x15, HDA_INPUT, 0 }, |
| 16168 | { 0x15, HDA_INPUT, 1 }, |
| 16169 | { 0x15, HDA_INPUT, 2 }, |
| 16170 | { 0x15, HDA_INPUT, 3 }, |
| 16171 | { } /* end */ |
| 16172 | }; |
| 16173 | #endif |
| 16174 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16175 | |
| 16176 | /* |
| 16177 | * configuration and preset |
| 16178 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16179 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16180 | [ALC861_3ST] = "3stack", |
| 16181 | [ALC660_3ST] = "3stack-660", |
| 16182 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16183 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16184 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16185 | [ALC861_TOSHIBA] = "toshiba", |
| 16186 | [ALC861_ASUS] = "asus", |
| 16187 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16188 | [ALC861_AUTO] = "auto", |
| 16189 | }; |
| 16190 | |
| 16191 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16192 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16193 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16194 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16195 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16196 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16197 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16198 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16199 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16200 | * Any other models that need this preset? |
| 16201 | */ |
| 16202 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16203 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16204 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16205 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16206 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16207 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16208 | /* FIXME: the below seems conflict */ |
| 16209 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16210 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16211 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16212 | {} |
| 16213 | }; |
| 16214 | |
| 16215 | static struct alc_config_preset alc861_presets[] = { |
| 16216 | [ALC861_3ST] = { |
| 16217 | .mixers = { alc861_3ST_mixer }, |
| 16218 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16219 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16220 | .dac_nids = alc861_dac_nids, |
| 16221 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16222 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16223 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16224 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16225 | .adc_nids = alc861_adc_nids, |
| 16226 | .input_mux = &alc861_capture_source, |
| 16227 | }, |
| 16228 | [ALC861_3ST_DIG] = { |
| 16229 | .mixers = { alc861_base_mixer }, |
| 16230 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16231 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16232 | .dac_nids = alc861_dac_nids, |
| 16233 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16234 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16235 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16236 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16237 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16238 | .adc_nids = alc861_adc_nids, |
| 16239 | .input_mux = &alc861_capture_source, |
| 16240 | }, |
| 16241 | [ALC861_6ST_DIG] = { |
| 16242 | .mixers = { alc861_base_mixer }, |
| 16243 | .init_verbs = { alc861_base_init_verbs }, |
| 16244 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16245 | .dac_nids = alc861_dac_nids, |
| 16246 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16247 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16248 | .channel_mode = alc861_8ch_modes, |
| 16249 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16250 | .adc_nids = alc861_adc_nids, |
| 16251 | .input_mux = &alc861_capture_source, |
| 16252 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16253 | [ALC660_3ST] = { |
| 16254 | .mixers = { alc861_3ST_mixer }, |
| 16255 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16256 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16257 | .dac_nids = alc660_dac_nids, |
| 16258 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16259 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16260 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16261 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16262 | .adc_nids = alc861_adc_nids, |
| 16263 | .input_mux = &alc861_capture_source, |
| 16264 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16265 | [ALC861_UNIWILL_M31] = { |
| 16266 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16267 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16268 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16269 | .dac_nids = alc861_dac_nids, |
| 16270 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16271 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16272 | .channel_mode = alc861_uniwill_m31_modes, |
| 16273 | .need_dac_fix = 1, |
| 16274 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16275 | .adc_nids = alc861_adc_nids, |
| 16276 | .input_mux = &alc861_capture_source, |
| 16277 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16278 | [ALC861_TOSHIBA] = { |
| 16279 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16280 | .init_verbs = { alc861_base_init_verbs, |
| 16281 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16282 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16283 | .dac_nids = alc861_dac_nids, |
| 16284 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16285 | .channel_mode = alc883_3ST_2ch_modes, |
| 16286 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16287 | .adc_nids = alc861_adc_nids, |
| 16288 | .input_mux = &alc861_capture_source, |
| 16289 | .unsol_event = alc861_toshiba_unsol_event, |
| 16290 | .init_hook = alc861_toshiba_automute, |
| 16291 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16292 | [ALC861_ASUS] = { |
| 16293 | .mixers = { alc861_asus_mixer }, |
| 16294 | .init_verbs = { alc861_asus_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_asus_modes), |
| 16299 | .channel_mode = alc861_asus_modes, |
| 16300 | .need_dac_fix = 1, |
| 16301 | .hp_nid = 0x06, |
| 16302 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16303 | .adc_nids = alc861_adc_nids, |
| 16304 | .input_mux = &alc861_capture_source, |
| 16305 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16306 | [ALC861_ASUS_LAPTOP] = { |
| 16307 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16308 | .init_verbs = { alc861_asus_init_verbs, |
| 16309 | alc861_asus_laptop_init_verbs }, |
| 16310 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16311 | .dac_nids = alc861_dac_nids, |
| 16312 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16313 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16314 | .channel_mode = alc883_3ST_2ch_modes, |
| 16315 | .need_dac_fix = 1, |
| 16316 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16317 | .adc_nids = alc861_adc_nids, |
| 16318 | .input_mux = &alc861_capture_source, |
| 16319 | }, |
| 16320 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16321 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16322 | /* Pin config fixes */ |
| 16323 | enum { |
| 16324 | PINFIX_FSC_AMILO_PI1505, |
| 16325 | }; |
| 16326 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16327 | static const struct alc_fixup alc861_fixups[] = { |
| 16328 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16329 | .type = ALC_FIXUP_PINS, |
| 16330 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16331 | { 0x0b, 0x0221101f }, /* HP */ |
| 16332 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16333 | { } |
| 16334 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16335 | }, |
| 16336 | }; |
| 16337 | |
| 16338 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16339 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16340 | {} |
| 16341 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16342 | |
| 16343 | static int patch_alc861(struct hda_codec *codec) |
| 16344 | { |
| 16345 | struct alc_spec *spec; |
| 16346 | int board_config; |
| 16347 | int err; |
| 16348 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16349 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16350 | if (spec == NULL) |
| 16351 | return -ENOMEM; |
| 16352 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16353 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16354 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16355 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16356 | alc861_models, |
| 16357 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16358 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16359 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16360 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16361 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16362 | board_config = ALC861_AUTO; |
| 16363 | } |
| 16364 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16365 | if (board_config == ALC861_AUTO) { |
| 16366 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16367 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16368 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16369 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16370 | if (board_config == ALC861_AUTO) { |
| 16371 | /* automatic parse from the BIOS config */ |
| 16372 | err = alc861_parse_auto_config(codec); |
| 16373 | if (err < 0) { |
| 16374 | alc_free(codec); |
| 16375 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16376 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16377 | printk(KERN_INFO |
| 16378 | "hda_codec: Cannot set up configuration " |
| 16379 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16380 | board_config = ALC861_3ST_DIG; |
| 16381 | } |
| 16382 | } |
| 16383 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16384 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16385 | if (err < 0) { |
| 16386 | alc_free(codec); |
| 16387 | return err; |
| 16388 | } |
| 16389 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16390 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16391 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16393 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16394 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16396 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16397 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16398 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16399 | if (!spec->cap_mixer) |
| 16400 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16401 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16402 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16403 | spec->vmaster_nid = 0x03; |
| 16404 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16405 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16406 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16407 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16408 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16409 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16410 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16411 | spec->power_hook = alc_power_eapd; |
| 16412 | #endif |
| 16413 | } |
| 16414 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16415 | if (!spec->loopback.amplist) |
| 16416 | spec->loopback.amplist = alc861_loopbacks; |
| 16417 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16418 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16419 | return 0; |
| 16420 | } |
| 16421 | |
| 16422 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16423 | * ALC861-VD support |
| 16424 | * |
| 16425 | * Based on ALC882 |
| 16426 | * |
| 16427 | * In addition, an independent DAC |
| 16428 | */ |
| 16429 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16430 | |
| 16431 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16432 | /* front, surr, clfe, side surr */ |
| 16433 | 0x02, 0x03, 0x04, 0x05 |
| 16434 | }; |
| 16435 | |
| 16436 | /* dac_nids for ALC660vd are in a different order - according to |
| 16437 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16438 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16439 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16440 | * - and it is the same as in 861vd. |
| 16441 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16442 | */ |
| 16443 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16444 | /* front, rear, clfe, rear_surr */ |
| 16445 | 0x02, 0x04, 0x03 |
| 16446 | }; |
| 16447 | |
| 16448 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16449 | /* ADC0 */ |
| 16450 | 0x09, |
| 16451 | }; |
| 16452 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16453 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16454 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16455 | /* input MUX */ |
| 16456 | /* FIXME: should be a matrix-type input source selection */ |
| 16457 | static struct hda_input_mux alc861vd_capture_source = { |
| 16458 | .num_items = 4, |
| 16459 | .items = { |
| 16460 | { "Mic", 0x0 }, |
| 16461 | { "Front Mic", 0x1 }, |
| 16462 | { "Line", 0x2 }, |
| 16463 | { "CD", 0x4 }, |
| 16464 | }, |
| 16465 | }; |
| 16466 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16467 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16468 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16469 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16470 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16471 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16472 | }, |
| 16473 | }; |
| 16474 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16475 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16476 | .num_items = 2, |
| 16477 | .items = { |
| 16478 | { "Front Mic", 0x0 }, |
| 16479 | { "ATAPI Mic", 0x1 }, |
| 16480 | }, |
| 16481 | }; |
| 16482 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16483 | /* |
| 16484 | * 2ch mode |
| 16485 | */ |
| 16486 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16487 | { 2, NULL } |
| 16488 | }; |
| 16489 | |
| 16490 | /* |
| 16491 | * 6ch mode |
| 16492 | */ |
| 16493 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16494 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16495 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16496 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16497 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16498 | { } /* end */ |
| 16499 | }; |
| 16500 | |
| 16501 | /* |
| 16502 | * 8ch mode |
| 16503 | */ |
| 16504 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16505 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16506 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16507 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16508 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16509 | { } /* end */ |
| 16510 | }; |
| 16511 | |
| 16512 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16513 | { 6, alc861vd_6stack_ch6_init }, |
| 16514 | { 8, alc861vd_6stack_ch8_init }, |
| 16515 | }; |
| 16516 | |
| 16517 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16518 | { |
| 16519 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16520 | .name = "Channel Mode", |
| 16521 | .info = alc_ch_mode_info, |
| 16522 | .get = alc_ch_mode_get, |
| 16523 | .put = alc_ch_mode_put, |
| 16524 | }, |
| 16525 | { } /* end */ |
| 16526 | }; |
| 16527 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16528 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16529 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16530 | */ |
| 16531 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16532 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16533 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16534 | |
| 16535 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16536 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16537 | |
| 16538 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16539 | HDA_OUTPUT), |
| 16540 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16541 | HDA_OUTPUT), |
| 16542 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16543 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16544 | |
| 16545 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16546 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16547 | |
| 16548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16549 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16550 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16551 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16553 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16554 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16555 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16556 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16557 | |
| 16558 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16559 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16560 | |
| 16561 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16562 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16563 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16564 | { } /* end */ |
| 16565 | }; |
| 16566 | |
| 16567 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16569 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16570 | |
| 16571 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16572 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16573 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16574 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16575 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16576 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16577 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16578 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16579 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16580 | |
| 16581 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16582 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16583 | |
| 16584 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16585 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16586 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16587 | { } /* end */ |
| 16588 | }; |
| 16589 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16590 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16591 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16592 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16593 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16594 | |
| 16595 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16596 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16597 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16598 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16599 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16600 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16601 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16602 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16603 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16604 | |
| 16605 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16606 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16607 | |
| 16608 | { } /* end */ |
| 16609 | }; |
| 16610 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16611 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16612 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16613 | */ |
| 16614 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16615 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16616 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16617 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16618 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16619 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16620 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16621 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16622 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16623 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16624 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16625 | { } /* end */ |
| 16626 | }; |
| 16627 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16628 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16629 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16630 | */ |
| 16631 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16634 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16635 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16636 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16637 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16638 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16639 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16640 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16641 | { } /* end */ |
| 16642 | }; |
| 16643 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16644 | /* |
| 16645 | * generic initialization of ADC, input mixers and output mixers |
| 16646 | */ |
| 16647 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16648 | /* |
| 16649 | * Unmute ADC0 and set the default input to mic-in |
| 16650 | */ |
| 16651 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16652 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16653 | |
| 16654 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16655 | * the analog-loopback mixer widget |
| 16656 | */ |
| 16657 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16659 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16663 | |
| 16664 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16665 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16669 | |
| 16670 | /* |
| 16671 | * Set up output mixers (0x02 - 0x05) |
| 16672 | */ |
| 16673 | /* set vol=0 to output mixers */ |
| 16674 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16675 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16676 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16677 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16678 | |
| 16679 | /* set up input amps for analog loopback */ |
| 16680 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16681 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16682 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16683 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16684 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16685 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16686 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16687 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16688 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16689 | |
| 16690 | { } |
| 16691 | }; |
| 16692 | |
| 16693 | /* |
| 16694 | * 3-stack pin configuration: |
| 16695 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16696 | */ |
| 16697 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16698 | /* |
| 16699 | * Set pin mode and muting |
| 16700 | */ |
| 16701 | /* set front pin widgets 0x14 for output */ |
| 16702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16704 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16705 | |
| 16706 | /* Mic (rear) pin: input vref at 80% */ |
| 16707 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16708 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16709 | /* Front Mic pin: input vref at 80% */ |
| 16710 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16711 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16712 | /* Line In pin: input */ |
| 16713 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16714 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16715 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16716 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16717 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16718 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16719 | /* CD pin widget for input */ |
| 16720 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16721 | |
| 16722 | { } |
| 16723 | }; |
| 16724 | |
| 16725 | /* |
| 16726 | * 6-stack pin configuration: |
| 16727 | */ |
| 16728 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16729 | /* |
| 16730 | * Set pin mode and muting |
| 16731 | */ |
| 16732 | /* set front pin widgets 0x14 for output */ |
| 16733 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16734 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16735 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16736 | |
| 16737 | /* Rear Pin: output 1 (0x0d) */ |
| 16738 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16739 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16740 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16741 | /* CLFE Pin: output 2 (0x0e) */ |
| 16742 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16744 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16745 | /* Side Pin: output 3 (0x0f) */ |
| 16746 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16747 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16748 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16749 | |
| 16750 | /* Mic (rear) pin: input vref at 80% */ |
| 16751 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16752 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16753 | /* Front Mic pin: input vref at 80% */ |
| 16754 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16755 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16756 | /* Line In pin: input */ |
| 16757 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16758 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16759 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16762 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16763 | /* CD pin widget for input */ |
| 16764 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16765 | |
| 16766 | { } |
| 16767 | }; |
| 16768 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16769 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16770 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16771 | { } |
| 16772 | }; |
| 16773 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16774 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16775 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16776 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16777 | { } |
| 16778 | }; |
| 16779 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16780 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16783 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16784 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16785 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16786 | {} |
| 16787 | }; |
| 16788 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16789 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16790 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16791 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16792 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16793 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16794 | } |
| 16795 | |
| 16796 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16797 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16798 | alc_automute_amp(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16799 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16800 | } |
| 16801 | |
| 16802 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16803 | unsigned int res) |
| 16804 | { |
| 16805 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16806 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16807 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16808 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16809 | default: |
| 16810 | alc_automute_amp_unsol_event(codec, res); |
| 16811 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16812 | } |
| 16813 | } |
| 16814 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16815 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16816 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16817 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16818 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16819 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16820 | |
| 16821 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16822 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16823 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16824 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16825 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16826 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16827 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16828 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16829 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16830 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16831 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16833 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16834 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16835 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16836 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16837 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16838 | |
| 16839 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16840 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16841 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16842 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16843 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16844 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16845 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16846 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16847 | |
| 16848 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16849 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16850 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16851 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16852 | |
| 16853 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16854 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16855 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16856 | |
| 16857 | { } /* end */ |
| 16858 | }; |
| 16859 | |
| 16860 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16861 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16862 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16863 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16864 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16865 | spec->autocfg.hp_pins[0] = 0x15; |
| 16866 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16867 | } |
| 16868 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16869 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16870 | #define alc861vd_loopbacks alc880_loopbacks |
| 16871 | #endif |
| 16872 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16873 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16874 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16875 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16876 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16877 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16878 | |
| 16879 | /* |
| 16880 | * configuration and preset |
| 16881 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16882 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16883 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16884 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16885 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16886 | [ALC861VD_3ST] = "3stack", |
| 16887 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16888 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16889 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16890 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16891 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16892 | [ALC861VD_AUTO] = "auto", |
| 16893 | }; |
| 16894 | |
| 16895 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16896 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16897 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16898 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16899 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16900 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16901 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16902 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16903 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16904 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16905 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16906 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16907 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16908 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16909 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16910 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16911 | {} |
| 16912 | }; |
| 16913 | |
| 16914 | static struct alc_config_preset alc861vd_presets[] = { |
| 16915 | [ALC660VD_3ST] = { |
| 16916 | .mixers = { alc861vd_3st_mixer }, |
| 16917 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16918 | alc861vd_3stack_init_verbs }, |
| 16919 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16920 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16921 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16922 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16923 | .input_mux = &alc861vd_capture_source, |
| 16924 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16925 | [ALC660VD_3ST_DIG] = { |
| 16926 | .mixers = { alc861vd_3st_mixer }, |
| 16927 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16928 | alc861vd_3stack_init_verbs }, |
| 16929 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16930 | .dac_nids = alc660vd_dac_nids, |
| 16931 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16932 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16933 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16934 | .input_mux = &alc861vd_capture_source, |
| 16935 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16936 | [ALC861VD_3ST] = { |
| 16937 | .mixers = { alc861vd_3st_mixer }, |
| 16938 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16939 | alc861vd_3stack_init_verbs }, |
| 16940 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16941 | .dac_nids = alc861vd_dac_nids, |
| 16942 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16943 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16944 | .input_mux = &alc861vd_capture_source, |
| 16945 | }, |
| 16946 | [ALC861VD_3ST_DIG] = { |
| 16947 | .mixers = { alc861vd_3st_mixer }, |
| 16948 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16949 | alc861vd_3stack_init_verbs }, |
| 16950 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16951 | .dac_nids = alc861vd_dac_nids, |
| 16952 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16953 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16954 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16955 | .input_mux = &alc861vd_capture_source, |
| 16956 | }, |
| 16957 | [ALC861VD_6ST_DIG] = { |
| 16958 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16959 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16960 | alc861vd_6stack_init_verbs }, |
| 16961 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16962 | .dac_nids = alc861vd_dac_nids, |
| 16963 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16964 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16965 | .channel_mode = alc861vd_6stack_modes, |
| 16966 | .input_mux = &alc861vd_capture_source, |
| 16967 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16968 | [ALC861VD_LENOVO] = { |
| 16969 | .mixers = { alc861vd_lenovo_mixer }, |
| 16970 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16971 | alc861vd_3stack_init_verbs, |
| 16972 | alc861vd_eapd_verbs, |
| 16973 | alc861vd_lenovo_unsol_verbs }, |
| 16974 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16975 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16976 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16977 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16978 | .input_mux = &alc861vd_capture_source, |
| 16979 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16980 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16981 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16982 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16983 | [ALC861VD_DALLAS] = { |
| 16984 | .mixers = { alc861vd_dallas_mixer }, |
| 16985 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16986 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16987 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16988 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16989 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16990 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16991 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16992 | .setup = alc861vd_dallas_setup, |
| 16993 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16994 | }, |
| 16995 | [ALC861VD_HP] = { |
| 16996 | .mixers = { alc861vd_hp_mixer }, |
| 16997 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16998 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16999 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17000 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17001 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17002 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17003 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17004 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17005 | .setup = alc861vd_dallas_setup, |
| 17006 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17007 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17008 | [ALC660VD_ASUS_V1S] = { |
| 17009 | .mixers = { alc861vd_lenovo_mixer }, |
| 17010 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17011 | alc861vd_3stack_init_verbs, |
| 17012 | alc861vd_eapd_verbs, |
| 17013 | alc861vd_lenovo_unsol_verbs }, |
| 17014 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17015 | .dac_nids = alc660vd_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 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17021 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17022 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17023 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17024 | }; |
| 17025 | |
| 17026 | /* |
| 17027 | * BIOS auto configuration |
| 17028 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17029 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17030 | const struct auto_pin_cfg *cfg) |
| 17031 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17032 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17033 | } |
| 17034 | |
| 17035 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17036 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17037 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17038 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17039 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17040 | } |
| 17041 | |
| 17042 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17043 | { |
| 17044 | struct alc_spec *spec = codec->spec; |
| 17045 | int i; |
| 17046 | |
| 17047 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17048 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17049 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17050 | if (nid) |
| 17051 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17052 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17053 | } |
| 17054 | } |
| 17055 | |
| 17056 | |
| 17057 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17058 | { |
| 17059 | struct alc_spec *spec = codec->spec; |
| 17060 | hda_nid_t pin; |
| 17061 | |
| 17062 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17063 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17064 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17065 | pin = spec->autocfg.speaker_pins[0]; |
| 17066 | if (pin) |
| 17067 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17068 | } |
| 17069 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17070 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17071 | |
| 17072 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17073 | { |
| 17074 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17075 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17076 | int i; |
| 17077 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17078 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17079 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17080 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17081 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17082 | if (nid != ALC861VD_PIN_CD_NID && |
| 17083 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17084 | snd_hda_codec_write(codec, nid, 0, |
| 17085 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17086 | AMP_OUT_MUTE); |
| 17087 | } |
| 17088 | } |
| 17089 | } |
| 17090 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17091 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17092 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17093 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17094 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17095 | |
| 17096 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17097 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17098 | * different NIDs for mute/unmute switch and volume control */ |
| 17099 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17100 | const struct auto_pin_cfg *cfg) |
| 17101 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17102 | static const char * const chname[4] = { |
| 17103 | "Front", "Surround", "CLFE", "Side" |
| 17104 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17105 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17106 | hda_nid_t nid_v, nid_s; |
| 17107 | int i, err; |
| 17108 | |
| 17109 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17110 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17111 | continue; |
| 17112 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17113 | alc880_dac_to_idx( |
| 17114 | spec->multiout.dac_nids[i])); |
| 17115 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17116 | alc880_dac_to_idx( |
| 17117 | spec->multiout.dac_nids[i])); |
| 17118 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17119 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17120 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17121 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17122 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17123 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17124 | HDA_OUTPUT)); |
| 17125 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17126 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17127 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17128 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17129 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17130 | HDA_OUTPUT)); |
| 17131 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17132 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17133 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17134 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17135 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17136 | HDA_INPUT)); |
| 17137 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17138 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17139 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17140 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17141 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17142 | HDA_INPUT)); |
| 17143 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17144 | return err; |
| 17145 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17146 | const char *name = pfx; |
| 17147 | if (!name) |
| 17148 | name = chname[i]; |
| 17149 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17150 | name, i, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17151 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17152 | HDA_OUTPUT)); |
| 17153 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17154 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17155 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17156 | name, i, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17157 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17158 | HDA_INPUT)); |
| 17159 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17160 | return err; |
| 17161 | } |
| 17162 | } |
| 17163 | return 0; |
| 17164 | } |
| 17165 | |
| 17166 | /* add playback controls for speaker and HP outputs */ |
| 17167 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17168 | * different NIDs for mute/unmute switch and volume control */ |
| 17169 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17170 | hda_nid_t pin, const char *pfx) |
| 17171 | { |
| 17172 | hda_nid_t nid_v, nid_s; |
| 17173 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17174 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17175 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17176 | return 0; |
| 17177 | |
| 17178 | if (alc880_is_fixed_pin(pin)) { |
| 17179 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17180 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17181 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17182 | spec->multiout.hp_nid = nid_v; |
| 17183 | else |
| 17184 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17185 | /* control HP volume/switch on the output mixer amp */ |
| 17186 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17187 | alc880_fixed_pin_idx(pin)); |
| 17188 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17189 | alc880_fixed_pin_idx(pin)); |
| 17190 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17191 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17192 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17193 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17194 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17195 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17196 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17197 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17198 | return err; |
| 17199 | } else if (alc880_is_multi_pin(pin)) { |
| 17200 | /* set manual connection */ |
| 17201 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17202 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17203 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17204 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17205 | return err; |
| 17206 | } |
| 17207 | return 0; |
| 17208 | } |
| 17209 | |
| 17210 | /* parse the BIOS configuration and set up the alc_spec |
| 17211 | * return 1 if successful, 0 if the proper config is not found, |
| 17212 | * or a negative error code |
| 17213 | * Based on ALC880 version - had to change it to override |
| 17214 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17215 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17216 | { |
| 17217 | struct alc_spec *spec = codec->spec; |
| 17218 | int err; |
| 17219 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17220 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17221 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17222 | alc861vd_ignore); |
| 17223 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17224 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17225 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17226 | return 0; /* can't find valid BIOS pin config */ |
| 17227 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17228 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17229 | if (err < 0) |
| 17230 | return err; |
| 17231 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17232 | if (err < 0) |
| 17233 | return err; |
| 17234 | err = alc861vd_auto_create_extra_out(spec, |
| 17235 | spec->autocfg.speaker_pins[0], |
| 17236 | "Speaker"); |
| 17237 | if (err < 0) |
| 17238 | return err; |
| 17239 | err = alc861vd_auto_create_extra_out(spec, |
| 17240 | spec->autocfg.hp_pins[0], |
| 17241 | "Headphone"); |
| 17242 | if (err < 0) |
| 17243 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17244 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17245 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17246 | return err; |
| 17247 | |
| 17248 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17249 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17250 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17251 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17252 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17253 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17254 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17255 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17256 | |
| 17257 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17258 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17259 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17260 | err = alc_auto_add_mic_boost(codec); |
| 17261 | if (err < 0) |
| 17262 | return err; |
| 17263 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17264 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17265 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17266 | return 1; |
| 17267 | } |
| 17268 | |
| 17269 | /* additional initialization for auto-configuration model */ |
| 17270 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17271 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17272 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17273 | alc861vd_auto_init_multi_out(codec); |
| 17274 | alc861vd_auto_init_hp_out(codec); |
| 17275 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17276 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17277 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17278 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17279 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17280 | } |
| 17281 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17282 | enum { |
| 17283 | ALC660VD_FIX_ASUS_GPIO1 |
| 17284 | }; |
| 17285 | |
| 17286 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17287 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17288 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17289 | .type = ALC_FIXUP_VERBS, |
| 17290 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17291 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17292 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17293 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17294 | { } |
| 17295 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17296 | }, |
| 17297 | }; |
| 17298 | |
| 17299 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17300 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17301 | {} |
| 17302 | }; |
| 17303 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17304 | static int patch_alc861vd(struct hda_codec *codec) |
| 17305 | { |
| 17306 | struct alc_spec *spec; |
| 17307 | int err, board_config; |
| 17308 | |
| 17309 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17310 | if (spec == NULL) |
| 17311 | return -ENOMEM; |
| 17312 | |
| 17313 | codec->spec = spec; |
| 17314 | |
| 17315 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17316 | alc861vd_models, |
| 17317 | alc861vd_cfg_tbl); |
| 17318 | |
| 17319 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17320 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17321 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17322 | board_config = ALC861VD_AUTO; |
| 17323 | } |
| 17324 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17325 | if (board_config == ALC861VD_AUTO) { |
| 17326 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17327 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17328 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17329 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17330 | if (board_config == ALC861VD_AUTO) { |
| 17331 | /* automatic parse from the BIOS config */ |
| 17332 | err = alc861vd_parse_auto_config(codec); |
| 17333 | if (err < 0) { |
| 17334 | alc_free(codec); |
| 17335 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17336 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17337 | printk(KERN_INFO |
| 17338 | "hda_codec: Cannot set up configuration " |
| 17339 | "from BIOS. Using base mode...\n"); |
| 17340 | board_config = ALC861VD_3ST; |
| 17341 | } |
| 17342 | } |
| 17343 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17344 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17345 | if (err < 0) { |
| 17346 | alc_free(codec); |
| 17347 | return err; |
| 17348 | } |
| 17349 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17350 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17351 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17352 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17353 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17354 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17355 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17356 | } |
| 17357 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17358 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17359 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17360 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17361 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17362 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17363 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17364 | if (!spec->adc_nids) { |
| 17365 | spec->adc_nids = alc861vd_adc_nids; |
| 17366 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17367 | } |
| 17368 | if (!spec->capsrc_nids) |
| 17369 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17370 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17371 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17372 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17373 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17374 | spec->vmaster_nid = 0x02; |
| 17375 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17376 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17377 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17378 | codec->patch_ops = alc_patch_ops; |
| 17379 | |
| 17380 | if (board_config == ALC861VD_AUTO) |
| 17381 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17382 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17383 | if (!spec->loopback.amplist) |
| 17384 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17385 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17386 | |
| 17387 | return 0; |
| 17388 | } |
| 17389 | |
| 17390 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17391 | * ALC662 support |
| 17392 | * |
| 17393 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17394 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17395 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17396 | * 6-channel independent captures. |
| 17397 | * |
| 17398 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17399 | * driver yet). |
| 17400 | */ |
| 17401 | #define ALC662_DIGOUT_NID 0x06 |
| 17402 | #define ALC662_DIGIN_NID 0x0a |
| 17403 | |
| 17404 | static hda_nid_t alc662_dac_nids[4] = { |
| 17405 | /* front, rear, clfe, rear_surr */ |
| 17406 | 0x02, 0x03, 0x04 |
| 17407 | }; |
| 17408 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17409 | static hda_nid_t alc272_dac_nids[2] = { |
| 17410 | 0x02, 0x03 |
| 17411 | }; |
| 17412 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17413 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17414 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17415 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17416 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17417 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17418 | static hda_nid_t alc272_adc_nids[1] = { |
| 17419 | /* ADC1-2 */ |
| 17420 | 0x08, |
| 17421 | }; |
| 17422 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17423 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17424 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17425 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17426 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17427 | /* input MUX */ |
| 17428 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17429 | static struct hda_input_mux alc662_capture_source = { |
| 17430 | .num_items = 4, |
| 17431 | .items = { |
| 17432 | { "Mic", 0x0 }, |
| 17433 | { "Front Mic", 0x1 }, |
| 17434 | { "Line", 0x2 }, |
| 17435 | { "CD", 0x4 }, |
| 17436 | }, |
| 17437 | }; |
| 17438 | |
| 17439 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17440 | .num_items = 2, |
| 17441 | .items = { |
| 17442 | { "Mic", 0x1 }, |
| 17443 | { "Line", 0x2 }, |
| 17444 | }, |
| 17445 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17446 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17447 | static struct hda_input_mux alc663_capture_source = { |
| 17448 | .num_items = 3, |
| 17449 | .items = { |
| 17450 | { "Mic", 0x0 }, |
| 17451 | { "Front Mic", 0x1 }, |
| 17452 | { "Line", 0x2 }, |
| 17453 | }, |
| 17454 | }; |
| 17455 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17456 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17457 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17458 | .num_items = 16, |
| 17459 | .items = { |
| 17460 | { "Autoselect Mic", 0x0 }, |
| 17461 | { "Internal Mic", 0x1 }, |
| 17462 | { "In-0x02", 0x2 }, |
| 17463 | { "In-0x03", 0x3 }, |
| 17464 | { "In-0x04", 0x4 }, |
| 17465 | { "In-0x05", 0x5 }, |
| 17466 | { "In-0x06", 0x6 }, |
| 17467 | { "In-0x07", 0x7 }, |
| 17468 | { "In-0x08", 0x8 }, |
| 17469 | { "In-0x09", 0x9 }, |
| 17470 | { "In-0x0a", 0x0a }, |
| 17471 | { "In-0x0b", 0x0b }, |
| 17472 | { "In-0x0c", 0x0c }, |
| 17473 | { "In-0x0d", 0x0d }, |
| 17474 | { "In-0x0e", 0x0e }, |
| 17475 | { "In-0x0f", 0x0f }, |
| 17476 | }, |
| 17477 | }; |
| 17478 | #endif |
| 17479 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17480 | /* |
| 17481 | * 2ch mode |
| 17482 | */ |
| 17483 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17484 | { 2, NULL } |
| 17485 | }; |
| 17486 | |
| 17487 | /* |
| 17488 | * 2ch mode |
| 17489 | */ |
| 17490 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17491 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17492 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17493 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17494 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17495 | { } /* end */ |
| 17496 | }; |
| 17497 | |
| 17498 | /* |
| 17499 | * 6ch mode |
| 17500 | */ |
| 17501 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17502 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17503 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17504 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17505 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17506 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17507 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17508 | { } /* end */ |
| 17509 | }; |
| 17510 | |
| 17511 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17512 | { 2, alc662_3ST_ch2_init }, |
| 17513 | { 6, alc662_3ST_ch6_init }, |
| 17514 | }; |
| 17515 | |
| 17516 | /* |
| 17517 | * 2ch mode |
| 17518 | */ |
| 17519 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17520 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17521 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17522 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17523 | { } /* end */ |
| 17524 | }; |
| 17525 | |
| 17526 | /* |
| 17527 | * 6ch mode |
| 17528 | */ |
| 17529 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17530 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17531 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17532 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17533 | { } /* end */ |
| 17534 | }; |
| 17535 | |
| 17536 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17537 | { 2, alc662_sixstack_ch6_init }, |
| 17538 | { 6, alc662_sixstack_ch8_init }, |
| 17539 | }; |
| 17540 | |
| 17541 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17542 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17543 | */ |
| 17544 | |
| 17545 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17546 | /* output mixer control */ |
| 17547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17548 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17549 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17550 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17551 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17552 | 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] | 17553 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17554 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17555 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17556 | |
| 17557 | /*Input mixer control */ |
| 17558 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17559 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17560 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17561 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17562 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17563 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17564 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17565 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17566 | { } /* end */ |
| 17567 | }; |
| 17568 | |
| 17569 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17570 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17571 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17572 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17573 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17574 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17575 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17576 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17578 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17579 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17580 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17581 | { } /* end */ |
| 17582 | }; |
| 17583 | |
| 17584 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17585 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17586 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17587 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17588 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17589 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17590 | 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] | 17591 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17592 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17593 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17595 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17596 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17597 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17598 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17599 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17600 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17601 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17602 | { } /* end */ |
| 17603 | }; |
| 17604 | |
| 17605 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17606 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17607 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17608 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17609 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17610 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17611 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17612 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17613 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17614 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17615 | { } /* end */ |
| 17616 | }; |
| 17617 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17618 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17619 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17620 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17621 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17622 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17625 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17626 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17627 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17628 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17629 | { } /* end */ |
| 17630 | }; |
| 17631 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17632 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17633 | ALC262_HIPPO_MASTER_SWITCH, |
| 17634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17635 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17636 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17637 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17638 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, 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 | { } /* end */ |
| 17644 | }; |
| 17645 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17646 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17647 | .ops = &snd_hda_bind_vol, |
| 17648 | .values = { |
| 17649 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17650 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17651 | 0 |
| 17652 | }, |
| 17653 | }; |
| 17654 | |
| 17655 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17656 | .ops = &snd_hda_bind_sw, |
| 17657 | .values = { |
| 17658 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17659 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17660 | 0 |
| 17661 | }, |
| 17662 | }; |
| 17663 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17664 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17665 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17666 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17669 | { } /* end */ |
| 17670 | }; |
| 17671 | |
| 17672 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17673 | .ops = &snd_hda_bind_sw, |
| 17674 | .values = { |
| 17675 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17676 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17677 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17678 | 0 |
| 17679 | }, |
| 17680 | }; |
| 17681 | |
| 17682 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17683 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17684 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17685 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17686 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17687 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17688 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17689 | |
| 17690 | { } /* end */ |
| 17691 | }; |
| 17692 | |
| 17693 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17694 | .ops = &snd_hda_bind_sw, |
| 17695 | .values = { |
| 17696 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17697 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17698 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17699 | 0 |
| 17700 | }, |
| 17701 | }; |
| 17702 | |
| 17703 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17704 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17705 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17708 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17709 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17710 | { } /* end */ |
| 17711 | }; |
| 17712 | |
| 17713 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17714 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17715 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17716 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17717 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17719 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17720 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17721 | { } /* end */ |
| 17722 | }; |
| 17723 | |
| 17724 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17725 | .ops = &snd_hda_bind_vol, |
| 17726 | .values = { |
| 17727 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17728 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17729 | 0 |
| 17730 | }, |
| 17731 | }; |
| 17732 | |
| 17733 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17734 | .ops = &snd_hda_bind_sw, |
| 17735 | .values = { |
| 17736 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17737 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17738 | 0 |
| 17739 | }, |
| 17740 | }; |
| 17741 | |
| 17742 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17743 | HDA_BIND_VOL("Master Playback Volume", |
| 17744 | &alc663_asus_two_bind_master_vol), |
| 17745 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17746 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17747 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17748 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17750 | { } /* end */ |
| 17751 | }; |
| 17752 | |
| 17753 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17754 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17755 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17756 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17757 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17759 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17760 | { } /* end */ |
| 17761 | }; |
| 17762 | |
| 17763 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17764 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17765 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17767 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17769 | |
| 17770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17772 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17773 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17774 | { } /* end */ |
| 17775 | }; |
| 17776 | |
| 17777 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17778 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17779 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17780 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17781 | |
| 17782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17784 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17785 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17786 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17787 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17788 | { } /* end */ |
| 17789 | }; |
| 17790 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17791 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17792 | .ops = &snd_hda_bind_sw, |
| 17793 | .values = { |
| 17794 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17795 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17796 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17797 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17798 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17799 | 0 |
| 17800 | }, |
| 17801 | }; |
| 17802 | |
| 17803 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17804 | .ops = &snd_hda_bind_sw, |
| 17805 | .values = { |
| 17806 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17807 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17808 | 0 |
| 17809 | }, |
| 17810 | }; |
| 17811 | |
| 17812 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17813 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17814 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17815 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17816 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17817 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17818 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17819 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17822 | { } /* end */ |
| 17823 | }; |
| 17824 | |
| 17825 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17826 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17827 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17828 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17829 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17830 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17831 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17832 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17833 | { } /* end */ |
| 17834 | }; |
| 17835 | |
| 17836 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17837 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17838 | { |
| 17839 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17840 | .name = "Channel Mode", |
| 17841 | .info = alc_ch_mode_info, |
| 17842 | .get = alc_ch_mode_get, |
| 17843 | .put = alc_ch_mode_put, |
| 17844 | }, |
| 17845 | { } /* end */ |
| 17846 | }; |
| 17847 | |
| 17848 | static struct hda_verb alc662_init_verbs[] = { |
| 17849 | /* ADC: mute amp left and right */ |
| 17850 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17851 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17852 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17854 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17855 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17856 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17857 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17858 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17859 | |
| 17860 | /* Front Pin: output 0 (0x0c) */ |
| 17861 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17862 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17863 | |
| 17864 | /* Rear Pin: output 1 (0x0d) */ |
| 17865 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17867 | |
| 17868 | /* CLFE Pin: output 2 (0x0e) */ |
| 17869 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17870 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17871 | |
| 17872 | /* Mic (rear) pin: input vref at 80% */ |
| 17873 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17874 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17875 | /* Front Mic pin: input vref at 80% */ |
| 17876 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17877 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17878 | /* Line In pin: input */ |
| 17879 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17880 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17881 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17882 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17883 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17884 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17885 | /* CD pin widget for input */ |
| 17886 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17887 | |
| 17888 | /* FIXME: use matrix-type input source selection */ |
| 17889 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17890 | /* Input mixer */ |
| 17891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17892 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17893 | |
| 17894 | /* always trun on EAPD */ |
| 17895 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17896 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17897 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17898 | { } |
| 17899 | }; |
| 17900 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17901 | static struct hda_verb alc663_init_verbs[] = { |
| 17902 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17903 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17904 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17905 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17906 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17907 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17908 | { } |
| 17909 | }; |
| 17910 | |
| 17911 | static struct hda_verb alc272_init_verbs[] = { |
| 17912 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17913 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17914 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17915 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17916 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17917 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17918 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17919 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17920 | { } |
| 17921 | }; |
| 17922 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17923 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17924 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17925 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17926 | {} |
| 17927 | }; |
| 17928 | |
| 17929 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17930 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17931 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17932 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17933 | }; |
| 17934 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17935 | /* Set Unsolicited Event*/ |
| 17936 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17937 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17938 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17939 | {} |
| 17940 | }; |
| 17941 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17942 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17943 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17944 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17945 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17946 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17947 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17948 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17950 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17951 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17952 | {} |
| 17953 | }; |
| 17954 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17955 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17956 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17957 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17958 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17959 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17961 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17962 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17963 | {} |
| 17964 | }; |
| 17965 | |
| 17966 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17967 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17968 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17969 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17970 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17973 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17974 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17975 | {} |
| 17976 | }; |
| 17977 | |
| 17978 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17979 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17980 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17981 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17982 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17984 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17985 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17986 | {} |
| 17987 | }; |
| 17988 | |
| 17989 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17990 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17991 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17992 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17993 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17994 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17995 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17996 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17997 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17999 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18000 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18001 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18002 | {} |
| 18003 | }; |
| 18004 | |
| 18005 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18006 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18007 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18008 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18009 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18010 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18011 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18012 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18013 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18014 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18015 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18016 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18017 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18018 | {} |
| 18019 | }; |
| 18020 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18021 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18022 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18023 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18024 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18025 | |
| 18026 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18027 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18028 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18029 | |
| 18030 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18031 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18032 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18033 | {} |
| 18034 | }; |
| 18035 | |
| 18036 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18037 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18038 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18039 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18040 | |
| 18041 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18042 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18043 | {} |
| 18044 | }; |
| 18045 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18046 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18047 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18048 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18049 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18050 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18051 | {} |
| 18052 | }; |
| 18053 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18054 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18055 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18056 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18058 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18059 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18060 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18061 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18064 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18065 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18066 | {} |
| 18067 | }; |
| 18068 | |
| 18069 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18070 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18071 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18072 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18073 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18074 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18075 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18076 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18077 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18078 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18079 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18080 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18081 | {} |
| 18082 | }; |
| 18083 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18084 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18085 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18086 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18087 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18088 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18089 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18090 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18091 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18092 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18093 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18094 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18097 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18098 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18099 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18100 | {} |
| 18101 | }; |
| 18102 | |
| 18103 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18104 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18105 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18106 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18107 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18108 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18109 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18110 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18111 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18112 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18113 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18114 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18115 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18117 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18118 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18119 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18120 | {} |
| 18121 | }; |
| 18122 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18123 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18124 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18125 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18126 | { } /* end */ |
| 18127 | }; |
| 18128 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18129 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18130 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18131 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18132 | { } /* end */ |
| 18133 | }; |
| 18134 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18135 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 18136 | { |
| 18137 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18138 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18139 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18140 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18141 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18142 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18143 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18144 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18145 | } |
| 18146 | |
| 18147 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 18148 | { |
| 18149 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18150 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18151 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18152 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18153 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18154 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 18155 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18156 | HDA_AMP_MUTE, bits); |
| 18157 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18158 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18159 | } |
| 18160 | |
| 18161 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 18162 | unsigned int res) |
| 18163 | { |
| 18164 | if ((res >> 26) == ALC880_HP_EVENT) |
| 18165 | alc662_lenovo_101e_all_automute(codec); |
| 18166 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 18167 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 18168 | } |
| 18169 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18170 | /* unsolicited event for HP jack sensing */ |
| 18171 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 18172 | unsigned int res) |
| 18173 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18174 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18175 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18176 | else |
| 18177 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18178 | } |
| 18179 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18180 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18181 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18182 | struct alc_spec *spec = codec->spec; |
| 18183 | |
| 18184 | alc262_hippo1_setup(codec); |
| 18185 | spec->ext_mic.pin = 0x18; |
| 18186 | spec->ext_mic.mux_idx = 0; |
| 18187 | spec->int_mic.pin = 0x19; |
| 18188 | spec->int_mic.mux_idx = 1; |
| 18189 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18190 | } |
| 18191 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18192 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 18193 | { |
| 18194 | alc262_hippo_automute(codec); |
| 18195 | alc_mic_automute(codec); |
| 18196 | } |
| 18197 | |
| 18198 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18199 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18200 | struct alc_spec *spec = codec->spec; |
| 18201 | |
| 18202 | spec->autocfg.hp_pins[0] = 0x14; |
| 18203 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18204 | } |
| 18205 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18206 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 18207 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18208 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 18209 | { |
| 18210 | unsigned int present; |
| 18211 | unsigned char bits; |
| 18212 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18213 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18214 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18215 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18216 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18217 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18218 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18219 | } |
| 18220 | |
| 18221 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 18222 | { |
| 18223 | unsigned int present; |
| 18224 | unsigned char bits; |
| 18225 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18226 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18227 | bits = present ? HDA_AMP_MUTE : 0; |
| 18228 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18229 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18230 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18231 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18232 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18233 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18234 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18235 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18236 | } |
| 18237 | |
| 18238 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 18239 | { |
| 18240 | unsigned int present; |
| 18241 | unsigned char bits; |
| 18242 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18243 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18244 | bits = present ? HDA_AMP_MUTE : 0; |
| 18245 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18246 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18247 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18248 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18249 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18250 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18251 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18252 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18253 | } |
| 18254 | |
| 18255 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 18256 | { |
| 18257 | unsigned int present; |
| 18258 | unsigned char bits; |
| 18259 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18260 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18261 | bits = present ? 0 : PIN_OUT; |
| 18262 | snd_hda_codec_write(codec, 0x14, 0, |
| 18263 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 18264 | } |
| 18265 | |
| 18266 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 18267 | { |
| 18268 | unsigned int present1, present2; |
| 18269 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18270 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 18271 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18272 | |
| 18273 | if (present1 || present2) { |
| 18274 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18275 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18276 | } else { |
| 18277 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18278 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18279 | } |
| 18280 | } |
| 18281 | |
| 18282 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 18283 | { |
| 18284 | unsigned int present1, present2; |
| 18285 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18286 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 18287 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18288 | |
| 18289 | if (present1 || present2) { |
| 18290 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18291 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18292 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18293 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18294 | } else { |
| 18295 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18296 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18297 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 18298 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18299 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18300 | } |
| 18301 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18302 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 18303 | { |
| 18304 | unsigned int present1, present2; |
| 18305 | |
| 18306 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 18307 | AC_VERB_GET_PIN_SENSE, 0) |
| 18308 | & AC_PINSENSE_PRESENCE; |
| 18309 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 18310 | AC_VERB_GET_PIN_SENSE, 0) |
| 18311 | & AC_PINSENSE_PRESENCE; |
| 18312 | |
| 18313 | if (present1 || present2) { |
| 18314 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18315 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18316 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18317 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18318 | } else { |
| 18319 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18320 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18321 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18322 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18323 | } |
| 18324 | } |
| 18325 | |
| 18326 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 18327 | { |
| 18328 | unsigned int present1, present2; |
| 18329 | |
| 18330 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 18331 | AC_VERB_GET_PIN_SENSE, 0) |
| 18332 | & AC_PINSENSE_PRESENCE; |
| 18333 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 18334 | AC_VERB_GET_PIN_SENSE, 0) |
| 18335 | & AC_PINSENSE_PRESENCE; |
| 18336 | |
| 18337 | if (present1 || present2) { |
| 18338 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18339 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18340 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18341 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 18342 | } else { |
| 18343 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 18344 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18345 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 18346 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 18347 | } |
| 18348 | } |
| 18349 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18350 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 18351 | unsigned int res) |
| 18352 | { |
| 18353 | switch (res >> 26) { |
| 18354 | case ALC880_HP_EVENT: |
| 18355 | alc663_m51va_speaker_automute(codec); |
| 18356 | break; |
| 18357 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18358 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18359 | break; |
| 18360 | } |
| 18361 | } |
| 18362 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18363 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18364 | { |
| 18365 | struct alc_spec *spec = codec->spec; |
| 18366 | spec->ext_mic.pin = 0x18; |
| 18367 | spec->ext_mic.mux_idx = 0; |
| 18368 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18369 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18370 | spec->auto_mic = 1; |
| 18371 | } |
| 18372 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18373 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 18374 | { |
| 18375 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18376 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18377 | } |
| 18378 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18379 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18380 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18381 | |
| 18382 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18383 | { |
| 18384 | struct alc_spec *spec = codec->spec; |
| 18385 | spec->ext_mic.pin = 0x18; |
| 18386 | spec->ext_mic.mux_idx = 0; |
| 18387 | spec->int_mic.pin = 0x19; |
| 18388 | spec->int_mic.mux_idx = 1; |
| 18389 | spec->auto_mic = 1; |
| 18390 | } |
| 18391 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18392 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18393 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18394 | /* ***************** Mode2 ******************************/ |
| 18395 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 18396 | unsigned int res) |
| 18397 | { |
| 18398 | switch (res >> 26) { |
| 18399 | case ALC880_HP_EVENT: |
| 18400 | alc662_f5z_speaker_automute(codec); |
| 18401 | break; |
| 18402 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18403 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18404 | break; |
| 18405 | } |
| 18406 | } |
| 18407 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18408 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18409 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18410 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 18411 | { |
| 18412 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18413 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18414 | } |
| 18415 | /* ***************** Mode3 ******************************/ |
| 18416 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 18417 | unsigned int res) |
| 18418 | { |
| 18419 | switch (res >> 26) { |
| 18420 | case ALC880_HP_EVENT: |
| 18421 | alc663_two_hp_m1_speaker_automute(codec); |
| 18422 | break; |
| 18423 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18424 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18425 | break; |
| 18426 | } |
| 18427 | } |
| 18428 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18429 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18430 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18431 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 18432 | { |
| 18433 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18434 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18435 | } |
| 18436 | /* ***************** Mode4 ******************************/ |
| 18437 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 18438 | unsigned int res) |
| 18439 | { |
| 18440 | switch (res >> 26) { |
| 18441 | case ALC880_HP_EVENT: |
| 18442 | alc663_21jd_two_speaker_automute(codec); |
| 18443 | break; |
| 18444 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18445 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18446 | break; |
| 18447 | } |
| 18448 | } |
| 18449 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18450 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18451 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18452 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18453 | { |
| 18454 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18455 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18456 | } |
| 18457 | /* ***************** Mode5 ******************************/ |
| 18458 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18459 | unsigned int res) |
| 18460 | { |
| 18461 | switch (res >> 26) { |
| 18462 | case ALC880_HP_EVENT: |
| 18463 | alc663_15jd_two_speaker_automute(codec); |
| 18464 | break; |
| 18465 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18466 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18467 | break; |
| 18468 | } |
| 18469 | } |
| 18470 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18471 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18472 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18473 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18474 | { |
| 18475 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18476 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18477 | } |
| 18478 | /* ***************** Mode6 ******************************/ |
| 18479 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18480 | unsigned int res) |
| 18481 | { |
| 18482 | switch (res >> 26) { |
| 18483 | case ALC880_HP_EVENT: |
| 18484 | alc663_two_hp_m2_speaker_automute(codec); |
| 18485 | break; |
| 18486 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18487 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18488 | break; |
| 18489 | } |
| 18490 | } |
| 18491 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18492 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18493 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18494 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18495 | { |
| 18496 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18497 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18498 | } |
| 18499 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18500 | /* ***************** Mode7 ******************************/ |
| 18501 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18502 | unsigned int res) |
| 18503 | { |
| 18504 | switch (res >> 26) { |
| 18505 | case ALC880_HP_EVENT: |
| 18506 | alc663_two_hp_m7_speaker_automute(codec); |
| 18507 | break; |
| 18508 | case ALC880_MIC_EVENT: |
| 18509 | alc_mic_automute(codec); |
| 18510 | break; |
| 18511 | } |
| 18512 | } |
| 18513 | |
| 18514 | #define alc663_mode7_setup alc663_mode1_setup |
| 18515 | |
| 18516 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18517 | { |
| 18518 | alc663_two_hp_m7_speaker_automute(codec); |
| 18519 | alc_mic_automute(codec); |
| 18520 | } |
| 18521 | |
| 18522 | /* ***************** Mode8 ******************************/ |
| 18523 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18524 | unsigned int res) |
| 18525 | { |
| 18526 | switch (res >> 26) { |
| 18527 | case ALC880_HP_EVENT: |
| 18528 | alc663_two_hp_m8_speaker_automute(codec); |
| 18529 | break; |
| 18530 | case ALC880_MIC_EVENT: |
| 18531 | alc_mic_automute(codec); |
| 18532 | break; |
| 18533 | } |
| 18534 | } |
| 18535 | |
| 18536 | #define alc663_mode8_setup alc663_m51va_setup |
| 18537 | |
| 18538 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18539 | { |
| 18540 | alc663_two_hp_m8_speaker_automute(codec); |
| 18541 | alc_mic_automute(codec); |
| 18542 | } |
| 18543 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18544 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18545 | { |
| 18546 | unsigned int present; |
| 18547 | unsigned char bits; |
| 18548 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18549 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18550 | bits = present ? HDA_AMP_MUTE : 0; |
| 18551 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18552 | HDA_AMP_MUTE, bits); |
| 18553 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18554 | HDA_AMP_MUTE, bits); |
| 18555 | } |
| 18556 | |
| 18557 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18558 | { |
| 18559 | unsigned int present; |
| 18560 | unsigned char bits; |
| 18561 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18562 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18563 | bits = present ? HDA_AMP_MUTE : 0; |
| 18564 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18565 | HDA_AMP_MUTE, bits); |
| 18566 | } |
| 18567 | |
| 18568 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18569 | unsigned int res) |
| 18570 | { |
| 18571 | switch (res >> 26) { |
| 18572 | case ALC880_HP_EVENT: |
| 18573 | alc663_g71v_hp_automute(codec); |
| 18574 | break; |
| 18575 | case ALC880_FRONT_EVENT: |
| 18576 | alc663_g71v_front_automute(codec); |
| 18577 | break; |
| 18578 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18579 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18580 | break; |
| 18581 | } |
| 18582 | } |
| 18583 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18584 | #define alc663_g71v_setup alc663_m51va_setup |
| 18585 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18586 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18587 | { |
| 18588 | alc663_g71v_front_automute(codec); |
| 18589 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18590 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18591 | } |
| 18592 | |
| 18593 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18594 | unsigned int res) |
| 18595 | { |
| 18596 | switch (res >> 26) { |
| 18597 | case ALC880_HP_EVENT: |
| 18598 | alc663_m51va_speaker_automute(codec); |
| 18599 | break; |
| 18600 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18601 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18602 | break; |
| 18603 | } |
| 18604 | } |
| 18605 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18606 | #define alc663_g50v_setup alc663_m51va_setup |
| 18607 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18608 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18609 | { |
| 18610 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18611 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18612 | } |
| 18613 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18614 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18615 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18616 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18617 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18618 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18619 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18620 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18621 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18622 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18623 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18624 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18625 | { } /* end */ |
| 18626 | }; |
| 18627 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18628 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18629 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18630 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18631 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18632 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18634 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18635 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18637 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18638 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18639 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18640 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18641 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18642 | { } /* end */ |
| 18643 | }; |
| 18644 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18645 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18646 | #define alc662_loopbacks alc880_loopbacks |
| 18647 | #endif |
| 18648 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18649 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18650 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18651 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18652 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18653 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18654 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18655 | |
| 18656 | /* |
| 18657 | * configuration and preset |
| 18658 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18659 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18660 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18661 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18662 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18663 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18664 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18665 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18666 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18667 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18668 | [ALC663_ASUS_M51VA] = "m51va", |
| 18669 | [ALC663_ASUS_G71V] = "g71v", |
| 18670 | [ALC663_ASUS_H13] = "h13", |
| 18671 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18672 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18673 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18674 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18675 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18676 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18677 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18678 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18679 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18680 | [ALC272_DELL] = "dell", |
| 18681 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18682 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18683 | [ALC662_AUTO] = "auto", |
| 18684 | }; |
| 18685 | |
| 18686 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18687 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18688 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18689 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18690 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18691 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18692 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18693 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18694 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18695 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18696 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18697 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18698 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18699 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18700 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18701 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18702 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18703 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18704 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18705 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18706 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18707 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18708 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18709 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18710 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18711 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18712 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18713 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18714 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18715 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18716 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18717 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18718 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18719 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18720 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18721 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18722 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18723 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18724 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18725 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18726 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18727 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18728 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18729 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18730 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18731 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18732 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18733 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18734 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18735 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18736 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18737 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18738 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18739 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18740 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18741 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18742 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18743 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18744 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18745 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18746 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18747 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18748 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18749 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18750 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18751 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18752 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18753 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18754 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18755 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18756 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18757 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18758 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18759 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18760 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18761 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18762 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18763 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18764 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18765 | {} |
| 18766 | }; |
| 18767 | |
| 18768 | static struct alc_config_preset alc662_presets[] = { |
| 18769 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18770 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18771 | .init_verbs = { alc662_init_verbs }, |
| 18772 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18773 | .dac_nids = alc662_dac_nids, |
| 18774 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18775 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18776 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18777 | .channel_mode = alc662_3ST_2ch_modes, |
| 18778 | .input_mux = &alc662_capture_source, |
| 18779 | }, |
| 18780 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18781 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18782 | .init_verbs = { alc662_init_verbs }, |
| 18783 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18784 | .dac_nids = alc662_dac_nids, |
| 18785 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18786 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18787 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18788 | .channel_mode = alc662_3ST_6ch_modes, |
| 18789 | .need_dac_fix = 1, |
| 18790 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18791 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18792 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18793 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18794 | .init_verbs = { alc662_init_verbs }, |
| 18795 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18796 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18797 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18798 | .channel_mode = alc662_3ST_6ch_modes, |
| 18799 | .need_dac_fix = 1, |
| 18800 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18801 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18802 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18803 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18804 | .init_verbs = { alc662_init_verbs }, |
| 18805 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18806 | .dac_nids = alc662_dac_nids, |
| 18807 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18808 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18809 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18810 | .channel_mode = alc662_5stack_modes, |
| 18811 | .input_mux = &alc662_capture_source, |
| 18812 | }, |
| 18813 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18814 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18815 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18816 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18817 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18818 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18819 | .channel_mode = alc662_3ST_2ch_modes, |
| 18820 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18821 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18822 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18823 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18824 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18825 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18826 | .init_verbs = { alc662_init_verbs, |
| 18827 | alc662_eeepc_sue_init_verbs }, |
| 18828 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18829 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18830 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18831 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18832 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18833 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18834 | .init_hook = alc662_eeepc_inithook, |
| 18835 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18836 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18837 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18838 | alc662_chmode_mixer }, |
| 18839 | .init_verbs = { alc662_init_verbs, |
| 18840 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18841 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18842 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18843 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18844 | .channel_mode = alc662_3ST_6ch_modes, |
| 18845 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18846 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18847 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18848 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18849 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18850 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18851 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18852 | .init_verbs = { alc662_init_verbs, |
| 18853 | alc662_ecs_init_verbs }, |
| 18854 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18855 | .dac_nids = alc662_dac_nids, |
| 18856 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18857 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18858 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18859 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18860 | .init_hook = alc662_eeepc_inithook, |
| 18861 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18862 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18863 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18864 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18865 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18866 | .dac_nids = alc662_dac_nids, |
| 18867 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18868 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18869 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18870 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18871 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18872 | .init_hook = alc663_m51va_inithook, |
| 18873 | }, |
| 18874 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18875 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18876 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18877 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18878 | .dac_nids = alc662_dac_nids, |
| 18879 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18880 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18881 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18882 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18883 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18884 | .init_hook = alc663_g71v_inithook, |
| 18885 | }, |
| 18886 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18887 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18888 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18889 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18890 | .dac_nids = alc662_dac_nids, |
| 18891 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18892 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18893 | .unsol_event = alc663_m51va_unsol_event, |
| 18894 | .init_hook = alc663_m51va_inithook, |
| 18895 | }, |
| 18896 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18897 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18898 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18899 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18900 | .dac_nids = alc662_dac_nids, |
| 18901 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18902 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18903 | .channel_mode = alc662_3ST_6ch_modes, |
| 18904 | .input_mux = &alc663_capture_source, |
| 18905 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18906 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18907 | .init_hook = alc663_g50v_inithook, |
| 18908 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18909 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18910 | .mixers = { alc663_m51va_mixer }, |
| 18911 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18912 | .init_verbs = { alc662_init_verbs, |
| 18913 | alc663_21jd_amic_init_verbs }, |
| 18914 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18915 | .hp_nid = 0x03, |
| 18916 | .dac_nids = alc662_dac_nids, |
| 18917 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18918 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18919 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18920 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18921 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18922 | .init_hook = alc663_mode1_inithook, |
| 18923 | }, |
| 18924 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18925 | .mixers = { alc662_1bjd_mixer }, |
| 18926 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18927 | .init_verbs = { alc662_init_verbs, |
| 18928 | alc662_1bjd_amic_init_verbs }, |
| 18929 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18930 | .dac_nids = alc662_dac_nids, |
| 18931 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18932 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18933 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18934 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18935 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18936 | .init_hook = alc662_mode2_inithook, |
| 18937 | }, |
| 18938 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18939 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18940 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18941 | .init_verbs = { alc662_init_verbs, |
| 18942 | alc663_two_hp_amic_m1_init_verbs }, |
| 18943 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18944 | .hp_nid = 0x03, |
| 18945 | .dac_nids = alc662_dac_nids, |
| 18946 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18947 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18948 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18949 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18950 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18951 | .init_hook = alc663_mode3_inithook, |
| 18952 | }, |
| 18953 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18954 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18955 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18956 | .init_verbs = { alc662_init_verbs, |
| 18957 | alc663_21jd_amic_init_verbs}, |
| 18958 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18959 | .hp_nid = 0x03, |
| 18960 | .dac_nids = alc662_dac_nids, |
| 18961 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18962 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18963 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18964 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18965 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18966 | .init_hook = alc663_mode4_inithook, |
| 18967 | }, |
| 18968 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18969 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18970 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18971 | .init_verbs = { alc662_init_verbs, |
| 18972 | alc663_15jd_amic_init_verbs }, |
| 18973 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18974 | .hp_nid = 0x03, |
| 18975 | .dac_nids = alc662_dac_nids, |
| 18976 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18977 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18978 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18979 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18980 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18981 | .init_hook = alc663_mode5_inithook, |
| 18982 | }, |
| 18983 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18984 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18985 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18986 | .init_verbs = { alc662_init_verbs, |
| 18987 | alc663_two_hp_amic_m2_init_verbs }, |
| 18988 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18989 | .hp_nid = 0x03, |
| 18990 | .dac_nids = alc662_dac_nids, |
| 18991 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18992 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18993 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18994 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18995 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18996 | .init_hook = alc663_mode6_inithook, |
| 18997 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18998 | [ALC663_ASUS_MODE7] = { |
| 18999 | .mixers = { alc663_mode7_mixer }, |
| 19000 | .cap_mixer = alc662_auto_capture_mixer, |
| 19001 | .init_verbs = { alc662_init_verbs, |
| 19002 | alc663_mode7_init_verbs }, |
| 19003 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19004 | .hp_nid = 0x03, |
| 19005 | .dac_nids = alc662_dac_nids, |
| 19006 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19007 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19008 | .channel_mode = alc662_3ST_2ch_modes, |
| 19009 | .unsol_event = alc663_mode7_unsol_event, |
| 19010 | .setup = alc663_mode7_setup, |
| 19011 | .init_hook = alc663_mode7_inithook, |
| 19012 | }, |
| 19013 | [ALC663_ASUS_MODE8] = { |
| 19014 | .mixers = { alc663_mode8_mixer }, |
| 19015 | .cap_mixer = alc662_auto_capture_mixer, |
| 19016 | .init_verbs = { alc662_init_verbs, |
| 19017 | alc663_mode8_init_verbs }, |
| 19018 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 19019 | .hp_nid = 0x03, |
| 19020 | .dac_nids = alc662_dac_nids, |
| 19021 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 19022 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19023 | .channel_mode = alc662_3ST_2ch_modes, |
| 19024 | .unsol_event = alc663_mode8_unsol_event, |
| 19025 | .setup = alc663_mode8_setup, |
| 19026 | .init_hook = alc663_mode8_inithook, |
| 19027 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19028 | [ALC272_DELL] = { |
| 19029 | .mixers = { alc663_m51va_mixer }, |
| 19030 | .cap_mixer = alc272_auto_capture_mixer, |
| 19031 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 19032 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19033 | .dac_nids = alc662_dac_nids, |
| 19034 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19035 | .adc_nids = alc272_adc_nids, |
| 19036 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 19037 | .capsrc_nids = alc272_capsrc_nids, |
| 19038 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19039 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19040 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19041 | .init_hook = alc663_m51va_inithook, |
| 19042 | }, |
| 19043 | [ALC272_DELL_ZM1] = { |
| 19044 | .mixers = { alc663_m51va_mixer }, |
| 19045 | .cap_mixer = alc662_auto_capture_mixer, |
| 19046 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 19047 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19048 | .dac_nids = alc662_dac_nids, |
| 19049 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19050 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19051 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19052 | .capsrc_nids = alc662_capsrc_nids, |
| 19053 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19054 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19055 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 19056 | .init_hook = alc663_m51va_inithook, |
| 19057 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19058 | [ALC272_SAMSUNG_NC10] = { |
| 19059 | .mixers = { alc272_nc10_mixer }, |
| 19060 | .init_verbs = { alc662_init_verbs, |
| 19061 | alc663_21jd_amic_init_verbs }, |
| 19062 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 19063 | .dac_nids = alc272_dac_nids, |
| 19064 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 19065 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19066 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19067 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 19068 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 19069 | .init_hook = alc663_mode4_inithook, |
| 19070 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19071 | }; |
| 19072 | |
| 19073 | |
| 19074 | /* |
| 19075 | * BIOS auto configuration |
| 19076 | */ |
| 19077 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19078 | /* convert from MIX nid to DAC */ |
| 19079 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 19080 | { |
| 19081 | if (nid == 0x0f) |
| 19082 | return 0x02; |
| 19083 | else if (nid >= 0x0c && nid <= 0x0e) |
| 19084 | return nid - 0x0c + 0x02; |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19085 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
| 19086 | return 0x25; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19087 | else |
| 19088 | return 0; |
| 19089 | } |
| 19090 | |
| 19091 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 19092 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 19093 | hda_nid_t dac) |
| 19094 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 19095 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19096 | int i, num; |
| 19097 | |
| 19098 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 19099 | for (i = 0; i < num; i++) { |
| 19100 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 19101 | return mix[i]; |
| 19102 | } |
| 19103 | return 0; |
| 19104 | } |
| 19105 | |
| 19106 | /* look for an empty DAC slot */ |
| 19107 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 19108 | { |
| 19109 | struct alc_spec *spec = codec->spec; |
| 19110 | hda_nid_t srcs[5]; |
| 19111 | int i, j, num; |
| 19112 | |
| 19113 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 19114 | if (num < 0) |
| 19115 | return 0; |
| 19116 | for (i = 0; i < num; i++) { |
| 19117 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 19118 | if (!nid) |
| 19119 | continue; |
| 19120 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 19121 | if (spec->multiout.dac_nids[j] == nid) |
| 19122 | break; |
| 19123 | if (j >= spec->multiout.num_dacs) |
| 19124 | return nid; |
| 19125 | } |
| 19126 | return 0; |
| 19127 | } |
| 19128 | |
| 19129 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 19130 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 19131 | const struct auto_pin_cfg *cfg) |
| 19132 | { |
| 19133 | struct alc_spec *spec = codec->spec; |
| 19134 | int i; |
| 19135 | hda_nid_t dac; |
| 19136 | |
| 19137 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19138 | for (i = 0; i < cfg->line_outs; i++) { |
| 19139 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 19140 | if (!dac) |
| 19141 | continue; |
| 19142 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19143 | } |
| 19144 | return 0; |
| 19145 | } |
| 19146 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19147 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 19148 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19149 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19150 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19151 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 19152 | } |
| 19153 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19154 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19155 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19156 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19157 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19158 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19159 | } |
| 19160 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19161 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19162 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19163 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19164 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19165 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19166 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19167 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19168 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19169 | |
| 19170 | /* add playback controls from the parsed DAC table */ |
| 19171 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19172 | const struct auto_pin_cfg *cfg) |
| 19173 | { |
| 19174 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19175 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19176 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19177 | }; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19178 | const char *pfx = alc_get_line_out_pfx(cfg, true); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19179 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19180 | int i, err; |
| 19181 | |
| 19182 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19183 | nid = spec->multiout.dac_nids[i]; |
| 19184 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19185 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19186 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 19187 | if (!mix) |
| 19188 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19189 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19190 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19191 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19192 | if (err < 0) |
| 19193 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19194 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19195 | if (err < 0) |
| 19196 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19197 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19198 | if (err < 0) |
| 19199 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19200 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19201 | if (err < 0) |
| 19202 | return err; |
| 19203 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19204 | const char *name = pfx; |
| 19205 | if (!name) |
| 19206 | name = chname[i]; |
| 19207 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19208 | if (err < 0) |
| 19209 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19210 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19211 | if (err < 0) |
| 19212 | return err; |
| 19213 | } |
| 19214 | } |
| 19215 | return 0; |
| 19216 | } |
| 19217 | |
| 19218 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19219 | /* return DAC nid if any new DAC is assigned */ |
| 19220 | 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] | 19221 | const char *pfx) |
| 19222 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19223 | struct alc_spec *spec = codec->spec; |
| 19224 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19225 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19226 | |
| 19227 | if (!pin) |
| 19228 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19229 | nid = alc662_look_for_dac(codec, pin); |
| 19230 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19231 | /* the corresponding DAC is already occupied */ |
| 19232 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19233 | return 0; /* no way */ |
| 19234 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19235 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19236 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19237 | } |
| 19238 | |
| 19239 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 19240 | if (!mix) |
| 19241 | return 0; |
| 19242 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19243 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19244 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19245 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19246 | if (err < 0) |
| 19247 | return err; |
| 19248 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19249 | } |
| 19250 | |
| 19251 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19252 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19253 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19254 | |
| 19255 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19256 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19257 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19258 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19259 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19260 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19261 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19262 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19263 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19264 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 19265 | if (num <= 1) |
| 19266 | return; |
| 19267 | for (i = 0; i < num; i++) { |
| 19268 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 19269 | continue; |
| 19270 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 19271 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19272 | } |
| 19273 | } |
| 19274 | |
| 19275 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19276 | { |
| 19277 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19278 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19279 | int i; |
| 19280 | |
| 19281 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19282 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19283 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19284 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19285 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19286 | } |
| 19287 | } |
| 19288 | |
| 19289 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19290 | { |
| 19291 | struct alc_spec *spec = codec->spec; |
| 19292 | hda_nid_t pin; |
| 19293 | |
| 19294 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19295 | if (pin) |
| 19296 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19297 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19298 | pin = spec->autocfg.speaker_pins[0]; |
| 19299 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19300 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19301 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19302 | } |
| 19303 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19304 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19305 | |
| 19306 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19307 | { |
| 19308 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19309 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19310 | int i; |
| 19311 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19312 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19313 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19314 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19315 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19316 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19317 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19318 | snd_hda_codec_write(codec, nid, 0, |
| 19319 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19320 | AMP_OUT_MUTE); |
| 19321 | } |
| 19322 | } |
| 19323 | } |
| 19324 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19325 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19326 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19327 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19328 | { |
| 19329 | struct alc_spec *spec = codec->spec; |
| 19330 | int err; |
| 19331 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19332 | |
| 19333 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19334 | alc662_ignore); |
| 19335 | if (err < 0) |
| 19336 | return err; |
| 19337 | if (!spec->autocfg.line_outs) |
| 19338 | return 0; /* can't find valid BIOS pin config */ |
| 19339 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19340 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19341 | if (err < 0) |
| 19342 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19343 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19344 | if (err < 0) |
| 19345 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19346 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19347 | spec->autocfg.speaker_pins[0], |
| 19348 | "Speaker"); |
| 19349 | if (err < 0) |
| 19350 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19351 | if (err) |
| 19352 | spec->multiout.extra_out_nid[0] = err; |
| 19353 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19354 | "Headphone"); |
| 19355 | if (err < 0) |
| 19356 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19357 | if (err) |
| 19358 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19359 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19360 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19361 | return err; |
| 19362 | |
| 19363 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19364 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19365 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19366 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19367 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19368 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19369 | |
| 19370 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19371 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19372 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19373 | add_verb(spec, alc662_init_verbs); |
| 19374 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19375 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19376 | add_verb(spec, alc663_init_verbs); |
| 19377 | |
| 19378 | if (codec->vendor_id == 0x10ec0272) |
| 19379 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19380 | |
| 19381 | err = alc_auto_add_mic_boost(codec); |
| 19382 | if (err < 0) |
| 19383 | return err; |
| 19384 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19385 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19386 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19387 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19388 | else |
| 19389 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19390 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19391 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19392 | } |
| 19393 | |
| 19394 | /* additional initialization for auto-configuration model */ |
| 19395 | static void alc662_auto_init(struct hda_codec *codec) |
| 19396 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19397 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19398 | alc662_auto_init_multi_out(codec); |
| 19399 | alc662_auto_init_hp_out(codec); |
| 19400 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19401 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19402 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19403 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19404 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19405 | } |
| 19406 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19407 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19408 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19409 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19410 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19411 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19412 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19413 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19414 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19415 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19416 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19417 | printk(KERN_WARNING |
| 19418 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19419 | } |
| 19420 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19421 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19422 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19423 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19424 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19425 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19426 | }; |
| 19427 | |
| 19428 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19429 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19430 | .type = ALC_FIXUP_PINS, |
| 19431 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19432 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19433 | { } |
| 19434 | } |
| 19435 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19436 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19437 | .type = ALC_FIXUP_PINS, |
| 19438 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19439 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19440 | { } |
| 19441 | } |
| 19442 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19443 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19444 | .type = ALC_FIXUP_FUNC, |
| 19445 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19446 | }, |
| 19447 | [ALC662_FIXUP_CZC_P10T] = { |
| 19448 | .type = ALC_FIXUP_VERBS, |
| 19449 | .v.verbs = (const struct hda_verb[]) { |
| 19450 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19451 | {} |
| 19452 | } |
| 19453 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19454 | }; |
| 19455 | |
| 19456 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19457 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19458 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19459 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19460 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19461 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19462 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19463 | {} |
| 19464 | }; |
| 19465 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19466 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19467 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19468 | {} |
| 19469 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19470 | |
| 19471 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19472 | static int patch_alc662(struct hda_codec *codec) |
| 19473 | { |
| 19474 | struct alc_spec *spec; |
| 19475 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19476 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19477 | |
| 19478 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19479 | if (!spec) |
| 19480 | return -ENOMEM; |
| 19481 | |
| 19482 | codec->spec = spec; |
| 19483 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19484 | alc_auto_parse_customize_define(codec); |
| 19485 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19486 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19487 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19488 | coef = alc_read_coef_idx(codec, 0); |
| 19489 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19490 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19491 | else if (coef & (1 << 14) && |
| 19492 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19493 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19494 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19495 | else if (coef == 0x4011) |
| 19496 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19497 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19498 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19499 | alc662_models, |
| 19500 | alc662_cfg_tbl); |
| 19501 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19502 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19503 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19504 | board_config = ALC662_AUTO; |
| 19505 | } |
| 19506 | |
| 19507 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19508 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19509 | alc662_fixup_tbl, alc662_fixups); |
| 19510 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19511 | /* automatic parse from the BIOS config */ |
| 19512 | err = alc662_parse_auto_config(codec); |
| 19513 | if (err < 0) { |
| 19514 | alc_free(codec); |
| 19515 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19516 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19517 | printk(KERN_INFO |
| 19518 | "hda_codec: Cannot set up configuration " |
| 19519 | "from BIOS. Using base mode...\n"); |
| 19520 | board_config = ALC662_3ST_2ch_DIG; |
| 19521 | } |
| 19522 | } |
| 19523 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19524 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19525 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19526 | if (err < 0) { |
| 19527 | alc_free(codec); |
| 19528 | return err; |
| 19529 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19530 | } |
| 19531 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19532 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19533 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19534 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19535 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19536 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19537 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19538 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19539 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19540 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19541 | if (!spec->adc_nids) { |
| 19542 | spec->adc_nids = alc662_adc_nids; |
| 19543 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19544 | } |
| 19545 | if (!spec->capsrc_nids) |
| 19546 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19547 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19548 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19549 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19550 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19551 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19552 | switch (codec->vendor_id) { |
| 19553 | case 0x10ec0662: |
| 19554 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19555 | break; |
| 19556 | case 0x10ec0272: |
| 19557 | case 0x10ec0663: |
| 19558 | case 0x10ec0665: |
| 19559 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19560 | break; |
| 19561 | case 0x10ec0273: |
| 19562 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19563 | break; |
| 19564 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19565 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19566 | spec->vmaster_nid = 0x02; |
| 19567 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19568 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19569 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19570 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19571 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19572 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19573 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19574 | alc_init_jacks(codec); |
| 19575 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19576 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19577 | if (!spec->loopback.amplist) |
| 19578 | spec->loopback.amplist = alc662_loopbacks; |
| 19579 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19580 | |
| 19581 | return 0; |
| 19582 | } |
| 19583 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19584 | static int patch_alc888(struct hda_codec *codec) |
| 19585 | { |
| 19586 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19587 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19588 | if (codec->vendor_id == 0x10ec0887) |
| 19589 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19590 | else |
| 19591 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19592 | if (!codec->chip_name) { |
| 19593 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19594 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19595 | } |
| 19596 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19597 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19598 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19599 | } |
| 19600 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19601 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19602 | * ALC680 support |
| 19603 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19604 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19605 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19606 | #define alc680_modes alc260_modes |
| 19607 | |
| 19608 | static hda_nid_t alc680_dac_nids[3] = { |
| 19609 | /* Lout1, Lout2, hp */ |
| 19610 | 0x02, 0x03, 0x04 |
| 19611 | }; |
| 19612 | |
| 19613 | static hda_nid_t alc680_adc_nids[3] = { |
| 19614 | /* ADC0-2 */ |
| 19615 | /* DMIC, MIC, Line-in*/ |
| 19616 | 0x07, 0x08, 0x09 |
| 19617 | }; |
| 19618 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19619 | /* |
| 19620 | * Analog capture ADC cgange |
| 19621 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19622 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19623 | { |
| 19624 | struct alc_spec *spec = codec->spec; |
| 19625 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19626 | int pin_found = 0; |
| 19627 | int type_found = AUTO_PIN_LAST; |
| 19628 | hda_nid_t nid; |
| 19629 | int i; |
| 19630 | |
| 19631 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19632 | nid = cfg->inputs[i].pin; |
| 19633 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19634 | AC_PINCAP_PRES_DETECT)) |
| 19635 | continue; |
| 19636 | if (snd_hda_jack_detect(codec, nid)) { |
| 19637 | if (cfg->inputs[i].type < type_found) { |
| 19638 | type_found = cfg->inputs[i].type; |
| 19639 | pin_found = nid; |
| 19640 | } |
| 19641 | } |
| 19642 | } |
| 19643 | |
| 19644 | nid = 0x07; |
| 19645 | if (pin_found) |
| 19646 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19647 | |
| 19648 | if (nid != spec->cur_adc) |
| 19649 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19650 | spec->cur_adc = nid; |
| 19651 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19652 | spec->cur_adc_format); |
| 19653 | } |
| 19654 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19655 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19656 | struct hda_codec *codec, |
| 19657 | unsigned int stream_tag, |
| 19658 | unsigned int format, |
| 19659 | struct snd_pcm_substream *substream) |
| 19660 | { |
| 19661 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19662 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19663 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19664 | spec->cur_adc_stream_tag = stream_tag; |
| 19665 | spec->cur_adc_format = format; |
| 19666 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19667 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19668 | return 0; |
| 19669 | } |
| 19670 | |
| 19671 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19672 | struct hda_codec *codec, |
| 19673 | struct snd_pcm_substream *substream) |
| 19674 | { |
| 19675 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19676 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19677 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19678 | return 0; |
| 19679 | } |
| 19680 | |
| 19681 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19682 | .substreams = 1, /* can be overridden */ |
| 19683 | .channels_min = 2, |
| 19684 | .channels_max = 2, |
| 19685 | /* NID is set in alc_build_pcms */ |
| 19686 | .ops = { |
| 19687 | .prepare = alc680_capture_pcm_prepare, |
| 19688 | .cleanup = alc680_capture_pcm_cleanup |
| 19689 | }, |
| 19690 | }; |
| 19691 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19692 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19693 | /* output mixer control */ |
| 19694 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19695 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19696 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19698 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19699 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19700 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19701 | { } |
| 19702 | }; |
| 19703 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19704 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19705 | .ops = &snd_hda_bind_vol, |
| 19706 | .values = { |
| 19707 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19708 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19709 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19710 | 0 |
| 19711 | }, |
| 19712 | }; |
| 19713 | |
| 19714 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19715 | .ops = &snd_hda_bind_sw, |
| 19716 | .values = { |
| 19717 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19718 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19719 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19720 | 0 |
| 19721 | }, |
| 19722 | }; |
| 19723 | |
| 19724 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19725 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19726 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19727 | { } /* end */ |
| 19728 | }; |
| 19729 | |
| 19730 | /* |
| 19731 | * generic initialization of ADC, input mixers and output mixers |
| 19732 | */ |
| 19733 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19734 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19735 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19736 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19737 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19738 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19739 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19741 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19742 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19743 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19744 | |
| 19745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19750 | |
| 19751 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19752 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19753 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19754 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19755 | { } |
| 19756 | }; |
| 19757 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19758 | /* toggle speaker-output according to the hp-jack state */ |
| 19759 | static void alc680_base_setup(struct hda_codec *codec) |
| 19760 | { |
| 19761 | struct alc_spec *spec = codec->spec; |
| 19762 | |
| 19763 | spec->autocfg.hp_pins[0] = 0x16; |
| 19764 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19765 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19766 | spec->autocfg.num_inputs = 2; |
| 19767 | spec->autocfg.inputs[0].pin = 0x18; |
| 19768 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19769 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19770 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19771 | } |
| 19772 | |
| 19773 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19774 | unsigned int res) |
| 19775 | { |
| 19776 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19777 | alc_automute_amp(codec); |
| 19778 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19779 | alc680_rec_autoswitch(codec); |
| 19780 | } |
| 19781 | |
| 19782 | static void alc680_inithook(struct hda_codec *codec) |
| 19783 | { |
| 19784 | alc_automute_amp(codec); |
| 19785 | alc680_rec_autoswitch(codec); |
| 19786 | } |
| 19787 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19788 | /* create input playback/capture controls for the given pin */ |
| 19789 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19790 | const char *ctlname, int idx) |
| 19791 | { |
| 19792 | hda_nid_t dac; |
| 19793 | int err; |
| 19794 | |
| 19795 | switch (nid) { |
| 19796 | case 0x14: |
| 19797 | dac = 0x02; |
| 19798 | break; |
| 19799 | case 0x15: |
| 19800 | dac = 0x03; |
| 19801 | break; |
| 19802 | case 0x16: |
| 19803 | dac = 0x04; |
| 19804 | break; |
| 19805 | default: |
| 19806 | return 0; |
| 19807 | } |
| 19808 | if (spec->multiout.dac_nids[0] != dac && |
| 19809 | spec->multiout.dac_nids[1] != dac) { |
| 19810 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19811 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19812 | HDA_OUTPUT)); |
| 19813 | if (err < 0) |
| 19814 | return err; |
| 19815 | |
| 19816 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19817 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19818 | |
| 19819 | if (err < 0) |
| 19820 | return err; |
| 19821 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19822 | } |
| 19823 | |
| 19824 | return 0; |
| 19825 | } |
| 19826 | |
| 19827 | /* add playback controls from the parsed DAC table */ |
| 19828 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19829 | const struct auto_pin_cfg *cfg) |
| 19830 | { |
| 19831 | hda_nid_t nid; |
| 19832 | int err; |
| 19833 | |
| 19834 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19835 | |
| 19836 | nid = cfg->line_out_pins[0]; |
| 19837 | if (nid) { |
| 19838 | const char *name; |
| 19839 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19840 | name = "Speaker"; |
| 19841 | else |
| 19842 | name = "Front"; |
| 19843 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19844 | if (err < 0) |
| 19845 | return err; |
| 19846 | } |
| 19847 | |
| 19848 | nid = cfg->speaker_pins[0]; |
| 19849 | if (nid) { |
| 19850 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19851 | if (err < 0) |
| 19852 | return err; |
| 19853 | } |
| 19854 | nid = cfg->hp_pins[0]; |
| 19855 | if (nid) { |
| 19856 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19857 | if (err < 0) |
| 19858 | return err; |
| 19859 | } |
| 19860 | |
| 19861 | return 0; |
| 19862 | } |
| 19863 | |
| 19864 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19865 | hda_nid_t nid, int pin_type) |
| 19866 | { |
| 19867 | alc_set_pin_output(codec, nid, pin_type); |
| 19868 | } |
| 19869 | |
| 19870 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19871 | { |
| 19872 | struct alc_spec *spec = codec->spec; |
| 19873 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19874 | if (nid) { |
| 19875 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19876 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19877 | } |
| 19878 | } |
| 19879 | |
| 19880 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19881 | { |
| 19882 | struct alc_spec *spec = codec->spec; |
| 19883 | hda_nid_t pin; |
| 19884 | |
| 19885 | pin = spec->autocfg.hp_pins[0]; |
| 19886 | if (pin) |
| 19887 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19888 | pin = spec->autocfg.speaker_pins[0]; |
| 19889 | if (pin) |
| 19890 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19891 | } |
| 19892 | |
| 19893 | /* pcm configuration: identical with ALC880 */ |
| 19894 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19895 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19896 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19897 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19898 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19899 | |
| 19900 | /* |
| 19901 | * BIOS auto configuration |
| 19902 | */ |
| 19903 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19904 | { |
| 19905 | struct alc_spec *spec = codec->spec; |
| 19906 | int err; |
| 19907 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19908 | |
| 19909 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19910 | alc680_ignore); |
| 19911 | if (err < 0) |
| 19912 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19913 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19914 | if (!spec->autocfg.line_outs) { |
| 19915 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19916 | spec->multiout.max_channels = 2; |
| 19917 | spec->no_analog = 1; |
| 19918 | goto dig_only; |
| 19919 | } |
| 19920 | return 0; /* can't find valid BIOS pin config */ |
| 19921 | } |
| 19922 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19923 | if (err < 0) |
| 19924 | return err; |
| 19925 | |
| 19926 | spec->multiout.max_channels = 2; |
| 19927 | |
| 19928 | dig_only: |
| 19929 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19930 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19931 | if (spec->kctls.list) |
| 19932 | add_mixer(spec, spec->kctls.list); |
| 19933 | |
| 19934 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19935 | |
| 19936 | err = alc_auto_add_mic_boost(codec); |
| 19937 | if (err < 0) |
| 19938 | return err; |
| 19939 | |
| 19940 | return 1; |
| 19941 | } |
| 19942 | |
| 19943 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19944 | |
| 19945 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19946 | static void alc680_auto_init(struct hda_codec *codec) |
| 19947 | { |
| 19948 | struct alc_spec *spec = codec->spec; |
| 19949 | alc680_auto_init_multi_out(codec); |
| 19950 | alc680_auto_init_hp_out(codec); |
| 19951 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19952 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19953 | if (spec->unsol_event) |
| 19954 | alc_inithook(codec); |
| 19955 | } |
| 19956 | |
| 19957 | /* |
| 19958 | * configuration and preset |
| 19959 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19960 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19961 | [ALC680_BASE] = "base", |
| 19962 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19963 | }; |
| 19964 | |
| 19965 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19966 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19967 | {} |
| 19968 | }; |
| 19969 | |
| 19970 | static struct alc_config_preset alc680_presets[] = { |
| 19971 | [ALC680_BASE] = { |
| 19972 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19973 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19974 | .init_verbs = { alc680_init_verbs }, |
| 19975 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19976 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19977 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19978 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19979 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19980 | .unsol_event = alc680_unsol_event, |
| 19981 | .setup = alc680_base_setup, |
| 19982 | .init_hook = alc680_inithook, |
| 19983 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19984 | }, |
| 19985 | }; |
| 19986 | |
| 19987 | static int patch_alc680(struct hda_codec *codec) |
| 19988 | { |
| 19989 | struct alc_spec *spec; |
| 19990 | int board_config; |
| 19991 | int err; |
| 19992 | |
| 19993 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19994 | if (spec == NULL) |
| 19995 | return -ENOMEM; |
| 19996 | |
| 19997 | codec->spec = spec; |
| 19998 | |
| 19999 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 20000 | alc680_models, |
| 20001 | alc680_cfg_tbl); |
| 20002 | |
| 20003 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 20004 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 20005 | codec->chip_name); |
| 20006 | board_config = ALC680_AUTO; |
| 20007 | } |
| 20008 | |
| 20009 | if (board_config == ALC680_AUTO) { |
| 20010 | /* automatic parse from the BIOS config */ |
| 20011 | err = alc680_parse_auto_config(codec); |
| 20012 | if (err < 0) { |
| 20013 | alc_free(codec); |
| 20014 | return err; |
| 20015 | } else if (!err) { |
| 20016 | printk(KERN_INFO |
| 20017 | "hda_codec: Cannot set up configuration " |
| 20018 | "from BIOS. Using base mode...\n"); |
| 20019 | board_config = ALC680_BASE; |
| 20020 | } |
| 20021 | } |
| 20022 | |
| 20023 | if (board_config != ALC680_AUTO) |
| 20024 | setup_preset(codec, &alc680_presets[board_config]); |
| 20025 | |
| 20026 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20027 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20028 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20029 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20030 | |
| 20031 | if (!spec->adc_nids) { |
| 20032 | spec->adc_nids = alc680_adc_nids; |
| 20033 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 20034 | } |
| 20035 | |
| 20036 | if (!spec->cap_mixer) |
| 20037 | set_capture_mixer(codec); |
| 20038 | |
| 20039 | spec->vmaster_nid = 0x02; |
| 20040 | |
| 20041 | codec->patch_ops = alc_patch_ops; |
| 20042 | if (board_config == ALC680_AUTO) |
| 20043 | spec->init_hook = alc680_auto_init; |
| 20044 | |
| 20045 | return 0; |
| 20046 | } |
| 20047 | |
| 20048 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20049 | * patch entries |
| 20050 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20051 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20052 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20053 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20054 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20055 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20056 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20057 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20058 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20059 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20060 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20061 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20062 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20063 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20064 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20065 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20066 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20067 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20068 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20069 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20070 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20071 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20072 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20073 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20074 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20075 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20076 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20077 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20078 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20079 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20080 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20081 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20082 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20083 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20084 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20085 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20086 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20087 | {} /* terminator */ |
| 20088 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20089 | |
| 20090 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20091 | |
| 20092 | MODULE_LICENSE("GPL"); |
| 20093 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20094 | |
| 20095 | static struct hda_codec_preset_list realtek_list = { |
| 20096 | .preset = snd_hda_preset_realtek, |
| 20097 | .owner = THIS_MODULE, |
| 20098 | }; |
| 20099 | |
| 20100 | static int __init patch_realtek_init(void) |
| 20101 | { |
| 20102 | return snd_hda_add_codec_preset(&realtek_list); |
| 20103 | } |
| 20104 | |
| 20105 | static void __exit patch_realtek_exit(void) |
| 20106 | { |
| 20107 | snd_hda_delete_codec_preset(&realtek_list); |
| 20108 | } |
| 20109 | |
| 20110 | module_init(patch_realtek_init) |
| 20111 | module_exit(patch_realtek_exit) |