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 | 7cf51e4 | 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 | 7cf51e4 | 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 | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 297 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 298 | }; |
| 299 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 300 | struct alc_fixup; |
| 301 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 302 | struct alc_multi_io { |
| 303 | hda_nid_t pin; /* multi-io widget pin NID */ |
| 304 | hda_nid_t dac; /* DAC to be connected */ |
| 305 | unsigned int ctl_in; /* cached input-pin control value */ |
| 306 | }; |
| 307 | |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 308 | enum { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 309 | ALC_AUTOMUTE_PIN, /* change the pin control */ |
| 310 | ALC_AUTOMUTE_AMP, /* mute/unmute the pin AMP */ |
| 311 | ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 312 | }; |
| 313 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | struct alc_spec { |
| 315 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 316 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 318 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 319 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 321 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 322 | * don't forget NULL |
| 323 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 324 | */ |
| 325 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 327 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | struct hda_pcm_stream *stream_analog_playback; |
| 329 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 330 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 331 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 333 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | struct hda_pcm_stream *stream_digital_playback; |
| 335 | struct hda_pcm_stream *stream_digital_capture; |
| 336 | |
| 337 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 338 | struct hda_multi_out multiout; /* playback set-up |
| 339 | * max_channels, dacs must be set |
| 340 | * dig_out_nid and hp_nid are optional |
| 341 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 342 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 343 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 344 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | |
| 346 | /* capture */ |
| 347 | unsigned int num_adc_nids; |
| 348 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 349 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 350 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 352 | /* capture setup for dynamic dual-adc switch */ |
| 353 | unsigned int cur_adc_idx; |
| 354 | hda_nid_t cur_adc; |
| 355 | unsigned int cur_adc_stream_tag; |
| 356 | unsigned int cur_adc_format; |
| 357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 359 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | const struct hda_input_mux *input_mux; |
| 361 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 362 | struct alc_mic_route ext_mic; |
| 363 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | |
| 365 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 366 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 368 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 369 | int const_channel_count; |
| 370 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | |
| 372 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 373 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 374 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 375 | /* dynamic controls, init_verbs and input_mux */ |
| 376 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 377 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 378 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 379 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 380 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 381 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 382 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 383 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 384 | /* hooks */ |
| 385 | void (*init_hook)(struct hda_codec *codec); |
| 386 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 387 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 388 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 389 | #endif |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 390 | void (*shutup)(struct hda_codec *codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 391 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 392 | /* for pin sensing */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 393 | unsigned int jack_present: 1; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 394 | unsigned int line_jack_present:1; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 395 | unsigned int master_mute:1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 396 | unsigned int auto_mic:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 397 | unsigned int automute:1; /* HP automute enabled */ |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 398 | unsigned int detect_line:1; /* Line-out detection enabled */ |
| 399 | unsigned int automute_lines:1; /* automute line-out as well */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 400 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 401 | /* other flags */ |
| 402 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 403 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 404 | unsigned int single_input_src:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 405 | |
| 406 | /* auto-mute control */ |
| 407 | int automute_mode; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 408 | hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 409 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 410 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 411 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 412 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 413 | /* for virtual master */ |
| 414 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 415 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 416 | struct hda_loopback_check loopback; |
| 417 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 418 | |
| 419 | /* for PLL fix */ |
| 420 | hda_nid_t pll_nid; |
| 421 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 422 | |
| 423 | /* fix-up list */ |
| 424 | int fixup_id; |
| 425 | const struct alc_fixup *fixup_list; |
| 426 | const char *fixup_name; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 427 | |
| 428 | /* multi-io */ |
| 429 | int multi_ios; |
| 430 | struct alc_multi_io multi_io[4]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 431 | }; |
| 432 | |
| 433 | /* |
| 434 | * configuration template - to be copied to the spec instance |
| 435 | */ |
| 436 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 437 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 438 | * with spec |
| 439 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 440 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 441 | const struct hda_verb *init_verbs[5]; |
| 442 | unsigned int num_dacs; |
| 443 | hda_nid_t *dac_nids; |
| 444 | hda_nid_t dig_out_nid; /* optional */ |
| 445 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 446 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 447 | unsigned int num_adc_nids; |
| 448 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 449 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 450 | hda_nid_t dig_in_nid; |
| 451 | unsigned int num_channel_mode; |
| 452 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 453 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 454 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 455 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 456 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 457 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 458 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 459 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 460 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 461 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 462 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 463 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | }; |
| 465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | |
| 467 | /* |
| 468 | * input MUX handling |
| 469 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { |
| 473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 474 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 475 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 476 | if (mux_idx >= spec->num_mux_defs) |
| 477 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 478 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 479 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 480 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | } |
| 482 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 483 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 484 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | { |
| 486 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 487 | struct alc_spec *spec = codec->spec; |
| 488 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 489 | |
| 490 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 491 | return 0; |
| 492 | } |
| 493 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 494 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 495 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | { |
| 497 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 498 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 499 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 501 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 502 | hda_nid_t nid = spec->capsrc_nids ? |
| 503 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 504 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 506 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 507 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 508 | if (!imux->num_items && mux_idx > 0) |
| 509 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 510 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 511 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 512 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 513 | /* Matrix-mixer style (e.g. ALC882) */ |
| 514 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 515 | unsigned int i, idx; |
| 516 | |
| 517 | idx = ucontrol->value.enumerated.item[0]; |
| 518 | if (idx >= imux->num_items) |
| 519 | idx = imux->num_items - 1; |
| 520 | if (*cur_val == idx) |
| 521 | return 0; |
| 522 | for (i = 0; i < imux->num_items; i++) { |
| 523 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 524 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 525 | imux->items[i].index, |
| 526 | HDA_AMP_MUTE, v); |
| 527 | } |
| 528 | *cur_val = idx; |
| 529 | return 1; |
| 530 | } else { |
| 531 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 532 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 533 | &spec->cur_mux[adc_idx]); |
| 534 | } |
| 535 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 536 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | /* |
| 538 | * channel mode setting |
| 539 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 540 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 541 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | { |
| 543 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 544 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 545 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 546 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | } |
| 548 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 549 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 550 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | { |
| 552 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 553 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 554 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 556 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | } |
| 558 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 560 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | { |
| 562 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 563 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 564 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 565 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 566 | &spec->ext_channel_count); |
| 567 | if (err >= 0 && !spec->const_channel_count) { |
| 568 | spec->multiout.max_channels = spec->ext_channel_count; |
| 569 | if (spec->need_dac_fix) |
| 570 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 571 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 572 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | } |
| 574 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 577 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 578 | * being part of a format specifier. Maximum allowed length of a value is |
| 579 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 580 | * |
| 581 | * Note: some retasking pin complexes seem to ignore requests for input |
| 582 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 583 | * are requested. Therefore order this list so that this behaviour will not |
| 584 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 585 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 586 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 587 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 588 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 589 | "Mic 50pc bias", "Mic 80pc bias", |
| 590 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | }; |
| 592 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 593 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 594 | }; |
| 595 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 596 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 597 | * addition, "input" pins may or may not process the mic bias option |
| 598 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 599 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 600 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 602 | #define ALC_PIN_DIR_IN 0x00 |
| 603 | #define ALC_PIN_DIR_OUT 0x01 |
| 604 | #define ALC_PIN_DIR_INOUT 0x02 |
| 605 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 606 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 607 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 608 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | * For each direction the minimum and maximum values are given. |
| 610 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 611 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 612 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 613 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 614 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 615 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 616 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 617 | }; |
| 618 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 619 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 620 | #define alc_pin_mode_n_items(_dir) \ |
| 621 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 624 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 625 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | unsigned int item_num = uinfo->value.enumerated.item; |
| 627 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 628 | |
| 629 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 630 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 631 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 632 | |
| 633 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 634 | item_num = alc_pin_mode_min(dir); |
| 635 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 636 | return 0; |
| 637 | } |
| 638 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 639 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 641 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 642 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 644 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 645 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 646 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 647 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 648 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 649 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 650 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 651 | /* Find enumerated value for current pinctl setting */ |
| 652 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 653 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 654 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 655 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 656 | return 0; |
| 657 | } |
| 658 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 659 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 660 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 661 | { |
| 662 | signed int change; |
| 663 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 664 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 665 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 666 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 667 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 668 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 669 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 670 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 671 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 672 | val = alc_pin_mode_min(dir); |
| 673 | |
| 674 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 675 | if (change) { |
| 676 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 677 | snd_hda_codec_write_cache(codec, nid, 0, |
| 678 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 679 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 680 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 681 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 682 | * for the requested pin mode. Enum values of 2 or less are |
| 683 | * input modes. |
| 684 | * |
| 685 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 686 | * reduces noise slightly (particularly on input) so we'll |
| 687 | * do it. However, having both input and output buffers |
| 688 | * enabled simultaneously doesn't seem to be problematic if |
| 689 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 690 | */ |
| 691 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 692 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 693 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 694 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 695 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 696 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 697 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 698 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 699 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 700 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 701 | } |
| 702 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 703 | return change; |
| 704 | } |
| 705 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 706 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 707 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 708 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 709 | .info = alc_pin_mode_info, \ |
| 710 | .get = alc_pin_mode_get, \ |
| 711 | .put = alc_pin_mode_put, \ |
| 712 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 713 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 714 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 715 | * together using a mask with more than one bit set. This control is |
| 716 | * currently used only by the ALC260 test model. At this stage they are not |
| 717 | * needed for any "production" models. |
| 718 | */ |
| 719 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 720 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 721 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 723 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 724 | { |
| 725 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 726 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 727 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 728 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 729 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 730 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 731 | |
| 732 | *valp = (val & mask) != 0; |
| 733 | return 0; |
| 734 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 735 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 736 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 737 | { |
| 738 | signed int change; |
| 739 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 740 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 741 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 742 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 743 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 744 | AC_VERB_GET_GPIO_DATA, |
| 745 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 746 | |
| 747 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 748 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 749 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 750 | gpio_data &= ~mask; |
| 751 | else |
| 752 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 753 | snd_hda_codec_write_cache(codec, nid, 0, |
| 754 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 755 | |
| 756 | return change; |
| 757 | } |
| 758 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 759 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 760 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 761 | .info = alc_gpio_data_info, \ |
| 762 | .get = alc_gpio_data_get, \ |
| 763 | .put = alc_gpio_data_put, \ |
| 764 | .private_value = nid | (mask<<16) } |
| 765 | #endif /* CONFIG_SND_DEBUG */ |
| 766 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 767 | /* A switch control to allow the enabling of the digital IO pins on the |
| 768 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 769 | * to provide something in the test model allowing digital outputs to be |
| 770 | * identified if present. If models are found which can utilise these |
| 771 | * outputs a more complete mixer control can be devised for those models if |
| 772 | * necessary. |
| 773 | */ |
| 774 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 775 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 776 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 777 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 778 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 779 | { |
| 780 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 781 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 782 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 783 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 784 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 785 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 786 | |
| 787 | *valp = (val & mask) != 0; |
| 788 | return 0; |
| 789 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 790 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 791 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 792 | { |
| 793 | signed int change; |
| 794 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 795 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 796 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 797 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 798 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 799 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 800 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 801 | |
| 802 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 803 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 804 | if (val==0) |
| 805 | ctrl_data &= ~mask; |
| 806 | else |
| 807 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 808 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 809 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 810 | |
| 811 | return change; |
| 812 | } |
| 813 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 814 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 815 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 816 | .info = alc_spdif_ctrl_info, \ |
| 817 | .get = alc_spdif_ctrl_get, \ |
| 818 | .put = alc_spdif_ctrl_put, \ |
| 819 | .private_value = nid | (mask<<16) } |
| 820 | #endif /* CONFIG_SND_DEBUG */ |
| 821 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 822 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 823 | * Again, this is only used in the ALC26x test models to help identify when |
| 824 | * the EAPD line must be asserted for features to work. |
| 825 | */ |
| 826 | #ifdef CONFIG_SND_DEBUG |
| 827 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 828 | |
| 829 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 830 | struct snd_ctl_elem_value *ucontrol) |
| 831 | { |
| 832 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 833 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 834 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 835 | long *valp = ucontrol->value.integer.value; |
| 836 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 837 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 838 | |
| 839 | *valp = (val & mask) != 0; |
| 840 | return 0; |
| 841 | } |
| 842 | |
| 843 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 844 | struct snd_ctl_elem_value *ucontrol) |
| 845 | { |
| 846 | int change; |
| 847 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 848 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 849 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 850 | long val = *ucontrol->value.integer.value; |
| 851 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 852 | AC_VERB_GET_EAPD_BTLENABLE, |
| 853 | 0x00); |
| 854 | |
| 855 | /* Set/unset the masked control bit(s) as needed */ |
| 856 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 857 | if (!val) |
| 858 | ctrl_data &= ~mask; |
| 859 | else |
| 860 | ctrl_data |= mask; |
| 861 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 862 | ctrl_data); |
| 863 | |
| 864 | return change; |
| 865 | } |
| 866 | |
| 867 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 868 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 869 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 870 | .info = alc_eapd_ctrl_info, \ |
| 871 | .get = alc_eapd_ctrl_get, \ |
| 872 | .put = alc_eapd_ctrl_put, \ |
| 873 | .private_value = nid | (mask<<16) } |
| 874 | #endif /* CONFIG_SND_DEBUG */ |
| 875 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 876 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 877 | * set up the input pin config (depending on the given auto-pin type) |
| 878 | */ |
| 879 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 880 | int auto_pin_type) |
| 881 | { |
| 882 | unsigned int val = PIN_IN; |
| 883 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 884 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 885 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 886 | unsigned int oldval; |
| 887 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 888 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 889 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 890 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 891 | /* if the default pin setup is vref50, we give it priority */ |
| 892 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 893 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 894 | else if (pincap & AC_PINCAP_VREF_50) |
| 895 | val = PIN_VREF50; |
| 896 | else if (pincap & AC_PINCAP_VREF_100) |
| 897 | val = PIN_VREF100; |
| 898 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 899 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 900 | } |
| 901 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 902 | } |
| 903 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 904 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 905 | { |
| 906 | struct alc_spec *spec = codec->spec; |
| 907 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 908 | |
| 909 | if (!cfg->line_outs) { |
| 910 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 911 | cfg->line_out_pins[cfg->line_outs]) |
| 912 | cfg->line_outs++; |
| 913 | } |
| 914 | if (!cfg->speaker_outs) { |
| 915 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 916 | cfg->speaker_pins[cfg->speaker_outs]) |
| 917 | cfg->speaker_outs++; |
| 918 | } |
| 919 | if (!cfg->hp_outs) { |
| 920 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 921 | cfg->hp_pins[cfg->hp_outs]) |
| 922 | cfg->hp_outs++; |
| 923 | } |
| 924 | } |
| 925 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 926 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 927 | */ |
| 928 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 929 | { |
| 930 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 931 | return; |
| 932 | spec->mixers[spec->num_mixers++] = mix; |
| 933 | } |
| 934 | |
| 935 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 936 | { |
| 937 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 938 | return; |
| 939 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 940 | } |
| 941 | |
| 942 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 943 | * set up from the preset table |
| 944 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 945 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 946 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 947 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 948 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 949 | int i; |
| 950 | |
| 951 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 952 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 953 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 954 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 955 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 956 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 957 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 958 | spec->channel_mode = preset->channel_mode; |
| 959 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 960 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 961 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 962 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 963 | if (preset->const_channel_count) |
| 964 | spec->multiout.max_channels = preset->const_channel_count; |
| 965 | else |
| 966 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 967 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 968 | |
| 969 | spec->multiout.num_dacs = preset->num_dacs; |
| 970 | spec->multiout.dac_nids = preset->dac_nids; |
| 971 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 972 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 973 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 974 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 975 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 976 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 977 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 978 | spec->input_mux = preset->input_mux; |
| 979 | |
| 980 | spec->num_adc_nids = preset->num_adc_nids; |
| 981 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 982 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 983 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 984 | |
| 985 | spec->unsol_event = preset->unsol_event; |
| 986 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 987 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 988 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 989 | spec->loopback.amplist = preset->loopbacks; |
| 990 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 991 | |
| 992 | if (preset->setup) |
| 993 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 994 | |
| 995 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 996 | } |
| 997 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 998 | /* Enable GPIO mask and set output */ |
| 999 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 1000 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 1001 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 1002 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 1003 | { } |
| 1004 | }; |
| 1005 | |
| 1006 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 1007 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 1008 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 1009 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 1010 | { } |
| 1011 | }; |
| 1012 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1013 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 1014 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 1015 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 1016 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 1017 | { } |
| 1018 | }; |
| 1019 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 1020 | /* |
| 1021 | * Fix hardware PLL issue |
| 1022 | * On some codecs, the analog PLL gating control must be off while |
| 1023 | * the default value is 1. |
| 1024 | */ |
| 1025 | static void alc_fix_pll(struct hda_codec *codec) |
| 1026 | { |
| 1027 | struct alc_spec *spec = codec->spec; |
| 1028 | unsigned int val; |
| 1029 | |
| 1030 | if (!spec->pll_nid) |
| 1031 | return; |
| 1032 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1033 | spec->pll_coef_idx); |
| 1034 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1035 | AC_VERB_GET_PROC_COEF, 0); |
| 1036 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1037 | spec->pll_coef_idx); |
| 1038 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1039 | val & ~(1 << spec->pll_coef_bit)); |
| 1040 | } |
| 1041 | |
| 1042 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1043 | unsigned int coef_idx, unsigned int coef_bit) |
| 1044 | { |
| 1045 | struct alc_spec *spec = codec->spec; |
| 1046 | spec->pll_nid = nid; |
| 1047 | spec->pll_coef_idx = coef_idx; |
| 1048 | spec->pll_coef_bit = coef_bit; |
| 1049 | alc_fix_pll(codec); |
| 1050 | } |
| 1051 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1052 | static int alc_init_jacks(struct hda_codec *codec) |
| 1053 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1054 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1055 | struct alc_spec *spec = codec->spec; |
| 1056 | int err; |
| 1057 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1058 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1059 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1060 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1061 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1062 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1063 | if (err < 0) |
| 1064 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1065 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1066 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1067 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1068 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1069 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1070 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1071 | if (err < 0) |
| 1072 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1073 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1074 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1075 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1076 | return 0; |
| 1077 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1078 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1079 | static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1080 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1081 | int i, present = 0; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1082 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1083 | for (i = 0; i < num_pins; i++) { |
| 1084 | hda_nid_t nid = pins[i]; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1085 | if (!nid) |
| 1086 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1087 | snd_hda_input_jack_report(codec, nid); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1088 | present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1089 | } |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1090 | return present; |
| 1091 | } |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1092 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1093 | static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1094 | bool mute, bool hp_out) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1095 | { |
| 1096 | struct alc_spec *spec = codec->spec; |
| 1097 | unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1098 | unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1099 | int i; |
| 1100 | |
| 1101 | for (i = 0; i < num_pins; i++) { |
| 1102 | hda_nid_t nid = pins[i]; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1103 | if (!nid) |
| 1104 | break; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1105 | switch (spec->automute_mode) { |
| 1106 | case ALC_AUTOMUTE_PIN: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1107 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1108 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1109 | pin_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1110 | break; |
| 1111 | case ALC_AUTOMUTE_AMP: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1112 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1113 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1114 | break; |
| 1115 | case ALC_AUTOMUTE_MIXER: |
| 1116 | nid = spec->automute_mixer_nid[i]; |
| 1117 | if (!nid) |
| 1118 | break; |
| 1119 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1120 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1121 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1122 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1123 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1124 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1125 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | } |
| 1127 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1128 | /* Toggle internal speakers muting */ |
| 1129 | static void update_speakers(struct hda_codec *codec) |
| 1130 | { |
| 1131 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1132 | int on; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1133 | |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1134 | if (!spec->automute) |
| 1135 | on = 0; |
| 1136 | else |
| 1137 | on = spec->jack_present | spec->line_jack_present; |
| 1138 | on |= spec->master_mute; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1139 | do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1140 | spec->autocfg.speaker_pins, on, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1141 | |
| 1142 | /* toggle line-out mutes if needed, too */ |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1143 | /* if LO is a copy of either HP or Speaker, don't need to handle it */ |
| 1144 | if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] || |
| 1145 | spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0]) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1146 | return; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1147 | if (!spec->automute_lines || !spec->automute) |
| 1148 | on = 0; |
| 1149 | else |
| 1150 | on = spec->jack_present; |
| 1151 | on |= spec->master_mute; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1152 | do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1153 | spec->autocfg.line_out_pins, on, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1154 | } |
| 1155 | |
| 1156 | static void alc_hp_automute(struct hda_codec *codec) |
| 1157 | { |
| 1158 | struct alc_spec *spec = codec->spec; |
| 1159 | |
| 1160 | if (!spec->automute) |
| 1161 | return; |
| 1162 | spec->jack_present = |
| 1163 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 1164 | spec->autocfg.hp_pins); |
| 1165 | update_speakers(codec); |
| 1166 | } |
| 1167 | |
| 1168 | static void alc_line_automute(struct hda_codec *codec) |
| 1169 | { |
| 1170 | struct alc_spec *spec = codec->spec; |
| 1171 | |
| 1172 | if (!spec->automute || !spec->detect_line) |
| 1173 | return; |
| 1174 | spec->line_jack_present = |
| 1175 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
| 1176 | spec->autocfg.line_out_pins); |
| 1177 | update_speakers(codec); |
| 1178 | } |
| 1179 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1180 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1181 | hda_nid_t nid) |
| 1182 | { |
| 1183 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1184 | int i, nums; |
| 1185 | |
| 1186 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1187 | for (i = 0; i < nums; i++) |
| 1188 | if (conn[i] == nid) |
| 1189 | return i; |
| 1190 | return -1; |
| 1191 | } |
| 1192 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1193 | /* switch the current ADC according to the jack state */ |
| 1194 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1195 | { |
| 1196 | struct alc_spec *spec = codec->spec; |
| 1197 | unsigned int present; |
| 1198 | hda_nid_t new_adc; |
| 1199 | |
| 1200 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1201 | if (present) |
| 1202 | spec->cur_adc_idx = 1; |
| 1203 | else |
| 1204 | spec->cur_adc_idx = 0; |
| 1205 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1206 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1207 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1208 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1209 | spec->cur_adc = new_adc; |
| 1210 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1211 | spec->cur_adc_stream_tag, 0, |
| 1212 | spec->cur_adc_format); |
| 1213 | } |
| 1214 | } |
| 1215 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1216 | static void alc_mic_automute(struct hda_codec *codec) |
| 1217 | { |
| 1218 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1219 | struct alc_mic_route *dead, *alive; |
| 1220 | unsigned int present, type; |
| 1221 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1222 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1223 | if (!spec->auto_mic) |
| 1224 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1225 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1226 | return; |
| 1227 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1228 | return; |
| 1229 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1230 | if (spec->dual_adc_switch) { |
| 1231 | alc_dual_mic_adc_auto_switch(codec); |
| 1232 | return; |
| 1233 | } |
| 1234 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1235 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1236 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1237 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1238 | if (present) { |
| 1239 | alive = &spec->ext_mic; |
| 1240 | dead = &spec->int_mic; |
| 1241 | } else { |
| 1242 | alive = &spec->int_mic; |
| 1243 | dead = &spec->ext_mic; |
| 1244 | } |
| 1245 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1246 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1247 | if (type == AC_WID_AUD_MIX) { |
| 1248 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1249 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1250 | alive->mux_idx, |
| 1251 | HDA_AMP_MUTE, 0); |
| 1252 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1253 | dead->mux_idx, |
| 1254 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1255 | } else { |
| 1256 | /* MUX style (e.g. ALC880) */ |
| 1257 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1258 | AC_VERB_SET_CONNECT_SEL, |
| 1259 | alive->mux_idx); |
| 1260 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1261 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1262 | |
| 1263 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1264 | } |
| 1265 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1266 | /* unsolicited event for HP jack sensing */ |
| 1267 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1268 | { |
| 1269 | if (codec->vendor_id == 0x10ec0880) |
| 1270 | res >>= 28; |
| 1271 | else |
| 1272 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1273 | switch (res) { |
| 1274 | case ALC880_HP_EVENT: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1275 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1276 | break; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1277 | case ALC880_FRONT_EVENT: |
| 1278 | alc_line_automute(codec); |
| 1279 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1280 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1281 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1282 | break; |
| 1283 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1284 | } |
| 1285 | |
| 1286 | static void alc_inithook(struct hda_codec *codec) |
| 1287 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1288 | alc_hp_automute(codec); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1289 | alc_line_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1290 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1291 | } |
| 1292 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1293 | /* additional initialization for ALC888 variants */ |
| 1294 | static void alc888_coef_init(struct hda_codec *codec) |
| 1295 | { |
| 1296 | unsigned int tmp; |
| 1297 | |
| 1298 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1299 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1300 | 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] | 1301 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1302 | /* alc888S-VC */ |
| 1303 | snd_hda_codec_read(codec, 0x20, 0, |
| 1304 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1305 | else |
| 1306 | /* alc888-VB */ |
| 1307 | snd_hda_codec_read(codec, 0x20, 0, |
| 1308 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1309 | } |
| 1310 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1311 | static void alc889_coef_init(struct hda_codec *codec) |
| 1312 | { |
| 1313 | unsigned int tmp; |
| 1314 | |
| 1315 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1316 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1317 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1318 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1319 | } |
| 1320 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1321 | /* turn on/off EAPD control (only if available) */ |
| 1322 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1323 | { |
| 1324 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1325 | return; |
| 1326 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1327 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1328 | on ? 2 : 0); |
| 1329 | } |
| 1330 | |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1331 | /* turn on/off EAPD controls of the codec */ |
| 1332 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) |
| 1333 | { |
| 1334 | /* We currently only handle front, HP */ |
| 1335 | switch (codec->vendor_id) { |
| 1336 | case 0x10ec0260: |
| 1337 | set_eapd(codec, 0x0f, on); |
| 1338 | set_eapd(codec, 0x10, on); |
| 1339 | break; |
| 1340 | case 0x10ec0262: |
| 1341 | case 0x10ec0267: |
| 1342 | case 0x10ec0268: |
| 1343 | case 0x10ec0269: |
| 1344 | case 0x10ec0270: |
| 1345 | case 0x10ec0272: |
| 1346 | case 0x10ec0660: |
| 1347 | case 0x10ec0662: |
| 1348 | case 0x10ec0663: |
| 1349 | case 0x10ec0665: |
| 1350 | case 0x10ec0862: |
| 1351 | case 0x10ec0889: |
| 1352 | case 0x10ec0892: |
| 1353 | set_eapd(codec, 0x14, on); |
| 1354 | set_eapd(codec, 0x15, on); |
| 1355 | break; |
| 1356 | } |
| 1357 | } |
| 1358 | |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 1359 | /* generic shutup callback; |
| 1360 | * just turning off EPAD and a little pause for avoiding pop-noise |
| 1361 | */ |
| 1362 | static void alc_eapd_shutup(struct hda_codec *codec) |
| 1363 | { |
| 1364 | alc_auto_setup_eapd(codec, false); |
| 1365 | msleep(200); |
| 1366 | } |
| 1367 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1368 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1369 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1370 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1371 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1372 | switch (type) { |
| 1373 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1374 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1375 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1376 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1377 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1378 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1379 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1380 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1381 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1382 | case ALC_INIT_DEFAULT: |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1383 | alc_auto_setup_eapd(codec, true); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1384 | switch (codec->vendor_id) { |
| 1385 | case 0x10ec0260: |
| 1386 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1387 | AC_VERB_SET_COEF_INDEX, 7); |
| 1388 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1389 | AC_VERB_GET_PROC_COEF, 0); |
| 1390 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1391 | AC_VERB_SET_COEF_INDEX, 7); |
| 1392 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1393 | AC_VERB_SET_PROC_COEF, |
| 1394 | tmp | 0x2010); |
| 1395 | break; |
| 1396 | case 0x10ec0262: |
| 1397 | case 0x10ec0880: |
| 1398 | case 0x10ec0882: |
| 1399 | case 0x10ec0883: |
| 1400 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1401 | case 0x10ec0887: |
Takashi Iwai | 20b67dd | 2011-03-23 22:54:32 +0100 | [diff] [blame] | 1402 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1403 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1404 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1405 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1406 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1407 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1408 | #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] | 1409 | case 0x10ec0267: |
| 1410 | case 0x10ec0268: |
| 1411 | snd_hda_codec_write(codec, 0x20, 0, |
| 1412 | AC_VERB_SET_COEF_INDEX, 7); |
| 1413 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1414 | AC_VERB_GET_PROC_COEF, 0); |
| 1415 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1416 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1417 | snd_hda_codec_write(codec, 0x20, 0, |
| 1418 | AC_VERB_SET_PROC_COEF, |
| 1419 | tmp | 0x3000); |
| 1420 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1421 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1422 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1423 | break; |
| 1424 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1425 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1426 | |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1427 | static int alc_automute_mode_info(struct snd_kcontrol *kcontrol, |
| 1428 | struct snd_ctl_elem_info *uinfo) |
| 1429 | { |
| 1430 | static const char * const texts[] = { |
| 1431 | "Disabled", "Speaker Only", "Line-Out+Speaker" |
| 1432 | }; |
| 1433 | |
| 1434 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 1435 | uinfo->count = 1; |
| 1436 | uinfo->value.enumerated.items = 3; |
| 1437 | if (uinfo->value.enumerated.item >= 3) |
| 1438 | uinfo->value.enumerated.item = 2; |
| 1439 | strcpy(uinfo->value.enumerated.name, |
| 1440 | texts[uinfo->value.enumerated.item]); |
| 1441 | return 0; |
| 1442 | } |
| 1443 | |
| 1444 | static int alc_automute_mode_get(struct snd_kcontrol *kcontrol, |
| 1445 | struct snd_ctl_elem_value *ucontrol) |
| 1446 | { |
| 1447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1448 | struct alc_spec *spec = codec->spec; |
| 1449 | unsigned int val; |
| 1450 | if (!spec->automute) |
| 1451 | val = 0; |
| 1452 | else if (!spec->automute_lines) |
| 1453 | val = 1; |
| 1454 | else |
| 1455 | val = 2; |
| 1456 | ucontrol->value.enumerated.item[0] = val; |
| 1457 | return 0; |
| 1458 | } |
| 1459 | |
| 1460 | static int alc_automute_mode_put(struct snd_kcontrol *kcontrol, |
| 1461 | struct snd_ctl_elem_value *ucontrol) |
| 1462 | { |
| 1463 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1464 | struct alc_spec *spec = codec->spec; |
| 1465 | |
| 1466 | switch (ucontrol->value.enumerated.item[0]) { |
| 1467 | case 0: |
| 1468 | if (!spec->automute) |
| 1469 | return 0; |
| 1470 | spec->automute = 0; |
| 1471 | break; |
| 1472 | case 1: |
| 1473 | if (spec->automute && !spec->automute_lines) |
| 1474 | return 0; |
| 1475 | spec->automute = 1; |
| 1476 | spec->automute_lines = 0; |
| 1477 | break; |
| 1478 | case 2: |
| 1479 | if (spec->automute && spec->automute_lines) |
| 1480 | return 0; |
| 1481 | spec->automute = 1; |
| 1482 | spec->automute_lines = 1; |
| 1483 | break; |
| 1484 | default: |
| 1485 | return -EINVAL; |
| 1486 | } |
| 1487 | update_speakers(codec); |
| 1488 | return 1; |
| 1489 | } |
| 1490 | |
| 1491 | static struct snd_kcontrol_new alc_automute_mode_enum = { |
| 1492 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1493 | .name = "Auto-Mute Mode", |
| 1494 | .info = alc_automute_mode_info, |
| 1495 | .get = alc_automute_mode_get, |
| 1496 | .put = alc_automute_mode_put, |
| 1497 | }; |
| 1498 | |
| 1499 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec); |
| 1500 | |
| 1501 | static int alc_add_automute_mode_enum(struct hda_codec *codec) |
| 1502 | { |
| 1503 | struct alc_spec *spec = codec->spec; |
| 1504 | struct snd_kcontrol_new *knew; |
| 1505 | |
| 1506 | knew = alc_kcontrol_new(spec); |
| 1507 | if (!knew) |
| 1508 | return -ENOMEM; |
| 1509 | *knew = alc_automute_mode_enum; |
| 1510 | knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL); |
| 1511 | if (!knew->name) |
| 1512 | return -ENOMEM; |
| 1513 | return 0; |
| 1514 | } |
| 1515 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1516 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1517 | { |
| 1518 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1519 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 1daf5f4 | 2011-04-28 17:57:46 +0200 | [diff] [blame^] | 1520 | int present = 0; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1521 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1522 | |
Takashi Iwai | 1daf5f4 | 2011-04-28 17:57:46 +0200 | [diff] [blame^] | 1523 | if (cfg->hp_pins[0]) |
| 1524 | present++; |
| 1525 | if (cfg->line_out_pins[0]) |
| 1526 | present++; |
| 1527 | if (cfg->speaker_pins[0]) |
| 1528 | present++; |
| 1529 | if (present < 2) /* need two different output types */ |
| 1530 | return; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1531 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1532 | if (!cfg->speaker_pins[0]) { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1533 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1534 | sizeof(cfg->speaker_pins)); |
| 1535 | cfg->speaker_outs = cfg->line_outs; |
| 1536 | } |
| 1537 | |
| 1538 | if (!cfg->hp_pins[0]) { |
| 1539 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1540 | sizeof(cfg->hp_pins)); |
| 1541 | cfg->hp_outs = cfg->line_outs; |
| 1542 | } |
| 1543 | |
| 1544 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1545 | hda_nid_t nid = cfg->hp_pins[i]; |
| 1546 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 1547 | AC_PINCAP_PRES_DETECT)) |
| 1548 | continue; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1549 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1550 | nid); |
| 1551 | snd_hda_codec_write_cache(codec, nid, 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1552 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1553 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1554 | spec->automute = 1; |
| 1555 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1556 | } |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1557 | if (spec->automute && cfg->line_out_pins[0] && |
| 1558 | cfg->line_out_pins[0] != cfg->hp_pins[0] && |
| 1559 | cfg->line_out_pins[0] != cfg->speaker_pins[0]) { |
| 1560 | for (i = 0; i < cfg->line_outs; i++) { |
| 1561 | hda_nid_t nid = cfg->line_out_pins[i]; |
| 1562 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 1563 | AC_PINCAP_PRES_DETECT)) |
| 1564 | continue; |
| 1565 | snd_printdd("realtek: Enable Line-Out auto-muting " |
| 1566 | "on NID 0x%x\n", nid); |
| 1567 | snd_hda_codec_write_cache(codec, nid, 0, |
| 1568 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1569 | AC_USRSP_EN | ALC880_FRONT_EVENT); |
| 1570 | spec->detect_line = 1; |
| 1571 | } |
| 1572 | /* create a control for automute mode */ |
| 1573 | alc_add_automute_mode_enum(codec); |
| 1574 | spec->automute_lines = 1; |
| 1575 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1576 | spec->unsol_event = alc_sku_unsol_event; |
| 1577 | } |
| 1578 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1579 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1580 | { |
| 1581 | struct alc_spec *spec = codec->spec; |
| 1582 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1583 | hda_nid_t fixed, ext; |
| 1584 | int i; |
| 1585 | |
| 1586 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1587 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1588 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1589 | return; |
| 1590 | |
| 1591 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1592 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1593 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1594 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1595 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1596 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1597 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1598 | if (fixed) |
| 1599 | return; /* already occupied */ |
| 1600 | fixed = nid; |
| 1601 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1602 | case INPUT_PIN_ATTR_UNUSED: |
| 1603 | return; /* invalid entry */ |
| 1604 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1605 | if (ext) |
| 1606 | return; /* already occupied */ |
| 1607 | ext = nid; |
| 1608 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1609 | } |
| 1610 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1611 | if (!ext || !fixed) |
| 1612 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1613 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1614 | return; /* no unsol support */ |
| 1615 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1616 | ext, fixed); |
| 1617 | spec->ext_mic.pin = ext; |
| 1618 | spec->int_mic.pin = fixed; |
| 1619 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1620 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1621 | spec->auto_mic = 1; |
| 1622 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1623 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1624 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1625 | spec->unsol_event = alc_sku_unsol_event; |
| 1626 | } |
| 1627 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1628 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1629 | * the driver to ignore any present sku defines. |
| 1630 | */ |
| 1631 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1632 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1633 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1634 | { |
| 1635 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1636 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1637 | struct alc_spec *spec = codec->spec; |
| 1638 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1639 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1640 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1641 | if (spec->cdefine.fixup) { |
| 1642 | ass = spec->cdefine.sku_cfg; |
| 1643 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1644 | return -1; |
| 1645 | goto do_sku; |
| 1646 | } |
| 1647 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1648 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1649 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1650 | goto do_sku; |
| 1651 | |
| 1652 | nid = 0x1d; |
| 1653 | if (codec->vendor_id == 0x10ec0260) |
| 1654 | nid = 0x17; |
| 1655 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1656 | |
| 1657 | if (!(ass & 1)) { |
| 1658 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1659 | codec->chip_name, ass); |
| 1660 | return -1; |
| 1661 | } |
| 1662 | |
| 1663 | /* check sum */ |
| 1664 | tmp = 0; |
| 1665 | for (i = 1; i < 16; i++) { |
| 1666 | if ((ass >> i) & 1) |
| 1667 | tmp++; |
| 1668 | } |
| 1669 | if (((ass >> 16) & 0xf) != tmp) |
| 1670 | return -1; |
| 1671 | |
| 1672 | spec->cdefine.port_connectivity = ass >> 30; |
| 1673 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1674 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1675 | spec->cdefine.customization = ass >> 8; |
| 1676 | do_sku: |
| 1677 | spec->cdefine.sku_cfg = ass; |
| 1678 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1679 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1680 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1681 | spec->cdefine.override = ass & 0x1; |
| 1682 | |
| 1683 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1684 | nid, spec->cdefine.sku_cfg); |
| 1685 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1686 | spec->cdefine.port_connectivity); |
| 1687 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1688 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1689 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1690 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1691 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1692 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1693 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1694 | |
| 1695 | return 0; |
| 1696 | } |
| 1697 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1698 | /* check subsystem ID and set up device-specific initialization; |
| 1699 | * return 1 if initialized, 0 if invalid SSID |
| 1700 | */ |
| 1701 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1702 | * 31 ~ 16 : Manufacture ID |
| 1703 | * 15 ~ 8 : SKU ID |
| 1704 | * 7 ~ 0 : Assembly ID |
| 1705 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1706 | */ |
| 1707 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1708 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1709 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1710 | { |
| 1711 | unsigned int ass, tmp, i; |
| 1712 | unsigned nid; |
| 1713 | struct alc_spec *spec = codec->spec; |
| 1714 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1715 | if (spec->cdefine.fixup) { |
| 1716 | ass = spec->cdefine.sku_cfg; |
| 1717 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1718 | return 0; |
| 1719 | goto do_sku; |
| 1720 | } |
| 1721 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1722 | ass = codec->subsystem_id & 0xffff; |
| 1723 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1724 | goto do_sku; |
| 1725 | |
| 1726 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1727 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1728 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1729 | * 29~21 : reserve |
| 1730 | * 20 : PCBEEP input |
| 1731 | * 19~16 : Check sum (15:1) |
| 1732 | * 15~1 : Custom |
| 1733 | * 0 : override |
| 1734 | */ |
| 1735 | nid = 0x1d; |
| 1736 | if (codec->vendor_id == 0x10ec0260) |
| 1737 | nid = 0x17; |
| 1738 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1739 | snd_printd("realtek: No valid SSID, " |
| 1740 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1741 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1742 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1743 | return 0; |
| 1744 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1745 | return 0; |
| 1746 | |
| 1747 | /* check sum */ |
| 1748 | tmp = 0; |
| 1749 | for (i = 1; i < 16; i++) { |
| 1750 | if ((ass >> i) & 1) |
| 1751 | tmp++; |
| 1752 | } |
| 1753 | if (((ass >> 16) & 0xf) != tmp) |
| 1754 | return 0; |
| 1755 | do_sku: |
| 1756 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1757 | ass & 0xffff, codec->vendor_id); |
| 1758 | /* |
| 1759 | * 0 : override |
| 1760 | * 1 : Swap Jack |
| 1761 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1762 | * 3~5 : External Amplifier control |
| 1763 | * 7~6 : Reserved |
| 1764 | */ |
| 1765 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1766 | switch (tmp) { |
| 1767 | case 1: |
| 1768 | spec->init_amp = ALC_INIT_GPIO1; |
| 1769 | break; |
| 1770 | case 3: |
| 1771 | spec->init_amp = ALC_INIT_GPIO2; |
| 1772 | break; |
| 1773 | case 7: |
| 1774 | spec->init_amp = ALC_INIT_GPIO3; |
| 1775 | break; |
| 1776 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1777 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1778 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1779 | break; |
| 1780 | } |
| 1781 | |
| 1782 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1783 | * when the external headphone out jack is plugged" |
| 1784 | */ |
| 1785 | if (!(ass & 0x8000)) |
| 1786 | return 1; |
| 1787 | /* |
| 1788 | * 10~8 : Jack location |
| 1789 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1790 | * 14~13: Resvered |
| 1791 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1792 | * when the external headphone out jack is plugged" |
| 1793 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1794 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1795 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1796 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1797 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1798 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1799 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1800 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1801 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1802 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1803 | else if (tmp == 3) |
| 1804 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1805 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1806 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1807 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1808 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1809 | return 1; |
| 1810 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1811 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1812 | return 1; |
| 1813 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1814 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1815 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1816 | hda_nid_t porta, hda_nid_t porte, |
| 1817 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1818 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1819 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1820 | struct alc_spec *spec = codec->spec; |
| 1821 | snd_printd("realtek: " |
| 1822 | "Enable default setup for auto mode as fallback\n"); |
| 1823 | spec->init_amp = ALC_INIT_DEFAULT; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1824 | } |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1825 | |
| 1826 | alc_init_auto_hp(codec); |
| 1827 | alc_init_auto_mic(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1828 | } |
| 1829 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1830 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1831 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1832 | */ |
| 1833 | |
| 1834 | struct alc_pincfg { |
| 1835 | hda_nid_t nid; |
| 1836 | u32 val; |
| 1837 | }; |
| 1838 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1839 | struct alc_model_fixup { |
| 1840 | const int id; |
| 1841 | const char *name; |
| 1842 | }; |
| 1843 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1844 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1845 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1846 | bool chained; |
| 1847 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1848 | union { |
| 1849 | unsigned int sku; |
| 1850 | const struct alc_pincfg *pins; |
| 1851 | const struct hda_verb *verbs; |
| 1852 | void (*func)(struct hda_codec *codec, |
| 1853 | const struct alc_fixup *fix, |
| 1854 | int action); |
| 1855 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1856 | }; |
| 1857 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1858 | enum { |
| 1859 | ALC_FIXUP_INVALID, |
| 1860 | ALC_FIXUP_SKU, |
| 1861 | ALC_FIXUP_PINS, |
| 1862 | ALC_FIXUP_VERBS, |
| 1863 | ALC_FIXUP_FUNC, |
| 1864 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1865 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1866 | enum { |
| 1867 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1868 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1869 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1870 | }; |
| 1871 | |
| 1872 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1873 | { |
| 1874 | struct alc_spec *spec = codec->spec; |
| 1875 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1876 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1877 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1878 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1879 | int depth = 0; |
| 1880 | |
| 1881 | if (!spec->fixup_list) |
| 1882 | return; |
| 1883 | |
| 1884 | while (id >= 0) { |
| 1885 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1886 | const struct alc_pincfg *cfg; |
| 1887 | |
| 1888 | switch (fix->type) { |
| 1889 | case ALC_FIXUP_SKU: |
| 1890 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1891 | break;; |
| 1892 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1893 | "Apply sku override for %s\n", |
| 1894 | codec->chip_name, modelname); |
| 1895 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1896 | spec->cdefine.fixup = 1; |
| 1897 | break; |
| 1898 | case ALC_FIXUP_PINS: |
| 1899 | cfg = fix->v.pins; |
| 1900 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1901 | break; |
| 1902 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1903 | "Apply pincfg for %s\n", |
| 1904 | codec->chip_name, modelname); |
| 1905 | for (; cfg->nid; cfg++) |
| 1906 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1907 | cfg->val); |
| 1908 | break; |
| 1909 | case ALC_FIXUP_VERBS: |
| 1910 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1911 | break; |
| 1912 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1913 | "Apply fix-verbs for %s\n", |
| 1914 | codec->chip_name, modelname); |
| 1915 | add_verb(codec->spec, fix->v.verbs); |
| 1916 | break; |
| 1917 | case ALC_FIXUP_FUNC: |
| 1918 | if (!fix->v.func) |
| 1919 | break; |
| 1920 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1921 | "Apply fix-func for %s\n", |
| 1922 | codec->chip_name, modelname); |
| 1923 | fix->v.func(codec, fix, action); |
| 1924 | break; |
| 1925 | default: |
| 1926 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1927 | "Invalid fixup type %d\n", |
| 1928 | codec->chip_name, fix->type); |
| 1929 | break; |
| 1930 | } |
| 1931 | if (!fix[id].chained) |
| 1932 | break; |
| 1933 | if (++depth > 10) |
| 1934 | break; |
| 1935 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1936 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1937 | } |
| 1938 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1939 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1940 | const struct alc_model_fixup *models, |
| 1941 | const struct snd_pci_quirk *quirk, |
| 1942 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1943 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1944 | struct alc_spec *spec = codec->spec; |
| 1945 | int id = -1; |
| 1946 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1947 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1948 | if (codec->modelname && models) { |
| 1949 | while (models->name) { |
| 1950 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1951 | id = models->id; |
| 1952 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1953 | break; |
| 1954 | } |
| 1955 | models++; |
| 1956 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1957 | } |
| 1958 | if (id < 0) { |
| 1959 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1960 | if (quirk) { |
| 1961 | id = quirk->value; |
| 1962 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1963 | name = quirk->name; |
| 1964 | #endif |
| 1965 | } |
| 1966 | } |
| 1967 | |
| 1968 | spec->fixup_id = id; |
| 1969 | if (id >= 0) { |
| 1970 | spec->fixup_list = fixlist; |
| 1971 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1972 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1973 | } |
| 1974 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1975 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1976 | unsigned int coef_idx) |
| 1977 | { |
| 1978 | unsigned int val; |
| 1979 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1980 | coef_idx); |
| 1981 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1982 | AC_VERB_GET_PROC_COEF, 0); |
| 1983 | return val; |
| 1984 | } |
| 1985 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1986 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1987 | unsigned int coef_val) |
| 1988 | { |
| 1989 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1990 | coef_idx); |
| 1991 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1992 | coef_val); |
| 1993 | } |
| 1994 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1995 | /* set right pin controls for digital I/O */ |
| 1996 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1997 | { |
| 1998 | struct alc_spec *spec = codec->spec; |
| 1999 | int i; |
| 2000 | hda_nid_t pin; |
| 2001 | |
| 2002 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 2003 | pin = spec->autocfg.dig_out_pins[i]; |
| 2004 | if (pin) { |
| 2005 | snd_hda_codec_write(codec, pin, 0, |
| 2006 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2007 | PIN_OUT); |
| 2008 | } |
| 2009 | } |
| 2010 | pin = spec->autocfg.dig_in_pin; |
| 2011 | if (pin) |
| 2012 | snd_hda_codec_write(codec, pin, 0, |
| 2013 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2014 | PIN_IN); |
| 2015 | } |
| 2016 | |
| 2017 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 2018 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 2019 | { |
| 2020 | struct alc_spec *spec = codec->spec; |
| 2021 | int i, err; |
| 2022 | hda_nid_t dig_nid; |
| 2023 | |
| 2024 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 2025 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 2026 | err = snd_hda_get_connections(codec, |
| 2027 | spec->autocfg.dig_out_pins[i], |
| 2028 | &dig_nid, 1); |
| 2029 | if (err < 0) |
| 2030 | continue; |
| 2031 | if (!i) { |
| 2032 | spec->multiout.dig_out_nid = dig_nid; |
| 2033 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 2034 | } else { |
| 2035 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 2036 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 2037 | break; |
| 2038 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 2039 | } |
| 2040 | } |
| 2041 | |
| 2042 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 2043 | dig_nid = codec->start_nid; |
| 2044 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 2045 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 2046 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 2047 | continue; |
| 2048 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 2049 | continue; |
| 2050 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 2051 | continue; |
| 2052 | err = get_connection_index(codec, dig_nid, |
| 2053 | spec->autocfg.dig_in_pin); |
| 2054 | if (err >= 0) { |
| 2055 | spec->dig_in_nid = dig_nid; |
| 2056 | break; |
| 2057 | } |
| 2058 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 2059 | } |
| 2060 | } |
| 2061 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 2062 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2063 | * ALC888 |
| 2064 | */ |
| 2065 | |
| 2066 | /* |
| 2067 | * 2ch mode |
| 2068 | */ |
| 2069 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 2070 | /* Mic-in jack as mic in */ |
| 2071 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2072 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2073 | /* Line-in jack as Line in */ |
| 2074 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2075 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2076 | /* Line-Out as Front */ |
| 2077 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2078 | { } /* end */ |
| 2079 | }; |
| 2080 | |
| 2081 | /* |
| 2082 | * 4ch mode |
| 2083 | */ |
| 2084 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 2085 | /* Mic-in jack as mic in */ |
| 2086 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2087 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2088 | /* Line-in jack as Surround */ |
| 2089 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2090 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2091 | /* Line-Out as Front */ |
| 2092 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2093 | { } /* end */ |
| 2094 | }; |
| 2095 | |
| 2096 | /* |
| 2097 | * 6ch mode |
| 2098 | */ |
| 2099 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 2100 | /* Mic-in jack as CLFE */ |
| 2101 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2102 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2103 | /* Line-in jack as Surround */ |
| 2104 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2105 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2106 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 2107 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2108 | { } /* end */ |
| 2109 | }; |
| 2110 | |
| 2111 | /* |
| 2112 | * 8ch mode |
| 2113 | */ |
| 2114 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 2115 | /* Mic-in jack as CLFE */ |
| 2116 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2117 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2118 | /* Line-in jack as Surround */ |
| 2119 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2120 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2121 | /* Line-Out as Side */ |
| 2122 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2123 | { } /* end */ |
| 2124 | }; |
| 2125 | |
| 2126 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 2127 | { 2, alc888_4ST_ch2_intel_init }, |
| 2128 | { 4, alc888_4ST_ch4_intel_init }, |
| 2129 | { 6, alc888_4ST_ch6_intel_init }, |
| 2130 | { 8, alc888_4ST_ch8_intel_init }, |
| 2131 | }; |
| 2132 | |
| 2133 | /* |
| 2134 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 2135 | */ |
| 2136 | |
| 2137 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 2138 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2139 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2140 | /* Connect Internal HP to Front */ |
| 2141 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2142 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2143 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2144 | /* Connect Bass HP to Front */ |
| 2145 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2146 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2147 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2148 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 2149 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2150 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2151 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2152 | /* Connect Mic jack to CLFE */ |
| 2153 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2154 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2155 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2156 | /* Connect Line-in jack to Surround */ |
| 2157 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2158 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2159 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2160 | /* Connect HP out jack to Front */ |
| 2161 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2162 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2163 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2164 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2165 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2166 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2167 | {} |
| 2168 | }; |
| 2169 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2170 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2171 | { |
| 2172 | struct alc_spec *spec = codec->spec; |
| 2173 | |
| 2174 | spec->autocfg.hp_pins[0] = 0x15; |
| 2175 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2176 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2177 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2178 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2179 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2180 | spec->automute = 1; |
| 2181 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2182 | } |
| 2183 | |
| 2184 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2185 | { |
| 2186 | alc889_coef_init(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2187 | alc_hp_automute(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2188 | } |
| 2189 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2190 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2191 | { |
| 2192 | struct alc_spec *spec = codec->spec; |
| 2193 | |
| 2194 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2195 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2196 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2197 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2198 | spec->automute = 1; |
| 2199 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2200 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2201 | |
| 2202 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2203 | * ALC888 Acer Aspire 4930G model |
| 2204 | */ |
| 2205 | |
| 2206 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2207 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2208 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2209 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2211 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2212 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2213 | /* Connect Internal HP to front */ |
| 2214 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2215 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2216 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2217 | /* Connect HP out to front */ |
| 2218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2219 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2220 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2221 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2222 | { } |
| 2223 | }; |
| 2224 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2225 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2226 | * ALC888 Acer Aspire 6530G model |
| 2227 | */ |
| 2228 | |
| 2229 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2230 | /* Route to built-in subwoofer as well as speakers */ |
| 2231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2232 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2233 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2234 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2235 | /* Bias voltage on for external mic port */ |
| 2236 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2237 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2238 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2239 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2241 | /* Enable unsolicited event for HP jack */ |
| 2242 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2243 | /* Enable speaker output */ |
| 2244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2245 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2246 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2247 | /* Enable headphone output */ |
| 2248 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2250 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2251 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2252 | { } |
| 2253 | }; |
| 2254 | |
| 2255 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2256 | *ALC888 Acer Aspire 7730G model |
| 2257 | */ |
| 2258 | |
| 2259 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2260 | /* Bias voltage on for external mic port */ |
| 2261 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2262 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2263 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2264 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2266 | /* Enable unsolicited event for HP jack */ |
| 2267 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2268 | /* Enable speaker output */ |
| 2269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2271 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2272 | /* Enable headphone output */ |
| 2273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2275 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2276 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2277 | /*Enable internal subwoofer */ |
| 2278 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2279 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2280 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2281 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2282 | { } |
| 2283 | }; |
| 2284 | |
| 2285 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2286 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2287 | */ |
| 2288 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2289 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2290 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2291 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2292 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2293 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2294 | /* Enable unsolicited event for HP jack */ |
| 2295 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2296 | /* Connect Internal Front to Front */ |
| 2297 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2298 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2299 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2300 | /* Connect Internal Rear to Rear */ |
| 2301 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2302 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2303 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2304 | /* Connect Internal CLFE to CLFE */ |
| 2305 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2306 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2307 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2308 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2309 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2310 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2311 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2312 | /* Enable all DACs */ |
| 2313 | /* DAC DISABLE/MUTE 1? */ |
| 2314 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2315 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2316 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2317 | /* DAC DISABLE/MUTE 2? */ |
| 2318 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2319 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2320 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2321 | /* DMIC fix |
| 2322 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2323 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2324 | * makes the signal become a difference/sum signal instead of standard |
| 2325 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2326 | * codec replicate the sum signal to both channels, turning it into a |
| 2327 | * normal mono mic. |
| 2328 | */ |
| 2329 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2330 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2331 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2332 | { } |
| 2333 | }; |
| 2334 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2335 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2336 | /* Front mic only available on one ADC */ |
| 2337 | { |
| 2338 | .num_items = 4, |
| 2339 | .items = { |
| 2340 | { "Mic", 0x0 }, |
| 2341 | { "Line", 0x2 }, |
| 2342 | { "CD", 0x4 }, |
| 2343 | { "Front Mic", 0xb }, |
| 2344 | }, |
| 2345 | }, |
| 2346 | { |
| 2347 | .num_items = 3, |
| 2348 | .items = { |
| 2349 | { "Mic", 0x0 }, |
| 2350 | { "Line", 0x2 }, |
| 2351 | { "CD", 0x4 }, |
| 2352 | }, |
| 2353 | } |
| 2354 | }; |
| 2355 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2356 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2357 | /* Interal mic only available on one ADC */ |
| 2358 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2359 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2360 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2361 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2362 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2363 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2364 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2365 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2366 | }, |
| 2367 | }, |
| 2368 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2369 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2370 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2371 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2372 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2373 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2374 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2375 | }, |
| 2376 | } |
| 2377 | }; |
| 2378 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2379 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2380 | /* Digital mic only available on first "ADC" */ |
| 2381 | { |
| 2382 | .num_items = 5, |
| 2383 | .items = { |
| 2384 | { "Mic", 0x0 }, |
| 2385 | { "Line", 0x2 }, |
| 2386 | { "CD", 0x4 }, |
| 2387 | { "Front Mic", 0xb }, |
| 2388 | { "Input Mix", 0xa }, |
| 2389 | }, |
| 2390 | }, |
| 2391 | { |
| 2392 | .num_items = 4, |
| 2393 | .items = { |
| 2394 | { "Mic", 0x0 }, |
| 2395 | { "Line", 0x2 }, |
| 2396 | { "CD", 0x4 }, |
| 2397 | { "Input Mix", 0xa }, |
| 2398 | }, |
| 2399 | }, |
| 2400 | { |
| 2401 | .num_items = 4, |
| 2402 | .items = { |
| 2403 | { "Mic", 0x0 }, |
| 2404 | { "Line", 0x2 }, |
| 2405 | { "CD", 0x4 }, |
| 2406 | { "Input Mix", 0xa }, |
| 2407 | }, |
| 2408 | } |
| 2409 | }; |
| 2410 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2411 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2412 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2413 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2414 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2415 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2416 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2417 | HDA_OUTPUT), |
| 2418 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2419 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2420 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2421 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2422 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2423 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2424 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2425 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2426 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2428 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2429 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2430 | { } /* end */ |
| 2431 | }; |
| 2432 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2433 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2434 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2435 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2436 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2437 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2438 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2439 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2440 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2441 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2442 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2443 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2444 | 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] | 2445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2448 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2450 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2451 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2452 | { } /* end */ |
| 2453 | }; |
| 2454 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2455 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2456 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2457 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2458 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2459 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2460 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2461 | HDA_OUTPUT), |
| 2462 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2463 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2464 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2466 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2468 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2470 | { } /* end */ |
| 2471 | }; |
| 2472 | |
| 2473 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2474 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2475 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2476 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2477 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2478 | spec->autocfg.hp_pins[0] = 0x15; |
| 2479 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2480 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2481 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2482 | spec->automute = 1; |
| 2483 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2484 | } |
| 2485 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2486 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2487 | { |
| 2488 | struct alc_spec *spec = codec->spec; |
| 2489 | |
| 2490 | spec->autocfg.hp_pins[0] = 0x15; |
| 2491 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2492 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2493 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2494 | spec->automute = 1; |
| 2495 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2496 | } |
| 2497 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2498 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2499 | { |
| 2500 | struct alc_spec *spec = codec->spec; |
| 2501 | |
| 2502 | spec->autocfg.hp_pins[0] = 0x15; |
| 2503 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2504 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2505 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2506 | spec->automute = 1; |
| 2507 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2508 | } |
| 2509 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2510 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2511 | { |
| 2512 | struct alc_spec *spec = codec->spec; |
| 2513 | |
| 2514 | spec->autocfg.hp_pins[0] = 0x15; |
| 2515 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2516 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2517 | spec->autocfg.speaker_pins[2] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2518 | spec->automute = 1; |
| 2519 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2520 | } |
| 2521 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2522 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | * ALC880 3-stack model |
| 2524 | * |
| 2525 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2526 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2527 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2528 | */ |
| 2529 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2530 | static hda_nid_t alc880_dac_nids[4] = { |
| 2531 | /* front, rear, clfe, rear_surr */ |
| 2532 | 0x02, 0x05, 0x04, 0x03 |
| 2533 | }; |
| 2534 | |
| 2535 | static hda_nid_t alc880_adc_nids[3] = { |
| 2536 | /* ADC0-2 */ |
| 2537 | 0x07, 0x08, 0x09, |
| 2538 | }; |
| 2539 | |
| 2540 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2541 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2542 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2543 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2545 | /* ADC1-2 */ |
| 2546 | 0x08, 0x09, |
| 2547 | }; |
| 2548 | |
| 2549 | #define ALC880_DIGOUT_NID 0x06 |
| 2550 | #define ALC880_DIGIN_NID 0x0a |
| 2551 | |
| 2552 | static struct hda_input_mux alc880_capture_source = { |
| 2553 | .num_items = 4, |
| 2554 | .items = { |
| 2555 | { "Mic", 0x0 }, |
| 2556 | { "Front Mic", 0x3 }, |
| 2557 | { "Line", 0x2 }, |
| 2558 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2559 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2560 | }; |
| 2561 | |
| 2562 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2563 | /* 2ch mode */ |
| 2564 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2565 | /* set line-in to input, mute it */ |
| 2566 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2567 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2568 | /* set mic-in to input vref 80%, mute it */ |
| 2569 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2570 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2571 | { } /* end */ |
| 2572 | }; |
| 2573 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2574 | /* 6ch mode */ |
| 2575 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2576 | /* set line-in to output, unmute it */ |
| 2577 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2578 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2579 | /* set mic-in to output, unmute it */ |
| 2580 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2581 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2582 | { } /* end */ |
| 2583 | }; |
| 2584 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2585 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2586 | { 2, alc880_threestack_ch2_init }, |
| 2587 | { 6, alc880_threestack_ch6_init }, |
| 2588 | }; |
| 2589 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2590 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2591 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2592 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2593 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2594 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2595 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2596 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2597 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2598 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2599 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2600 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2601 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2602 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2605 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2606 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2607 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2608 | { |
| 2609 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2610 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2611 | .info = alc_ch_mode_info, |
| 2612 | .get = alc_ch_mode_get, |
| 2613 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2614 | }, |
| 2615 | { } /* end */ |
| 2616 | }; |
| 2617 | |
| 2618 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2619 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2620 | struct snd_ctl_elem_info *uinfo) |
| 2621 | { |
| 2622 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2623 | struct alc_spec *spec = codec->spec; |
| 2624 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2625 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2626 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2627 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2628 | HDA_INPUT); |
| 2629 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2630 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2631 | return err; |
| 2632 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2633 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2634 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2635 | unsigned int size, unsigned int __user *tlv) |
| 2636 | { |
| 2637 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2638 | struct alc_spec *spec = codec->spec; |
| 2639 | int err; |
| 2640 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2641 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2642 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2643 | HDA_INPUT); |
| 2644 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2645 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2646 | return err; |
| 2647 | } |
| 2648 | |
| 2649 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2650 | struct snd_ctl_elem_value *ucontrol); |
| 2651 | |
| 2652 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2653 | struct snd_ctl_elem_value *ucontrol, |
| 2654 | getput_call_t func) |
| 2655 | { |
| 2656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2657 | struct alc_spec *spec = codec->spec; |
| 2658 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2659 | int err; |
| 2660 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2661 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2662 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2663 | 3, 0, HDA_INPUT); |
| 2664 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2665 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2666 | return err; |
| 2667 | } |
| 2668 | |
| 2669 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2670 | struct snd_ctl_elem_value *ucontrol) |
| 2671 | { |
| 2672 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2673 | snd_hda_mixer_amp_volume_get); |
| 2674 | } |
| 2675 | |
| 2676 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2677 | struct snd_ctl_elem_value *ucontrol) |
| 2678 | { |
| 2679 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2680 | snd_hda_mixer_amp_volume_put); |
| 2681 | } |
| 2682 | |
| 2683 | /* capture mixer elements */ |
| 2684 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2685 | |
| 2686 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2687 | struct snd_ctl_elem_value *ucontrol) |
| 2688 | { |
| 2689 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2690 | snd_hda_mixer_amp_switch_get); |
| 2691 | } |
| 2692 | |
| 2693 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2694 | struct snd_ctl_elem_value *ucontrol) |
| 2695 | { |
| 2696 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2697 | snd_hda_mixer_amp_switch_put); |
| 2698 | } |
| 2699 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2700 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2701 | { \ |
| 2702 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2703 | .name = "Capture Switch", \ |
| 2704 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2705 | .count = num, \ |
| 2706 | .info = alc_cap_sw_info, \ |
| 2707 | .get = alc_cap_sw_get, \ |
| 2708 | .put = alc_cap_sw_put, \ |
| 2709 | }, \ |
| 2710 | { \ |
| 2711 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2712 | .name = "Capture Volume", \ |
| 2713 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2714 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2715 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2716 | .count = num, \ |
| 2717 | .info = alc_cap_vol_info, \ |
| 2718 | .get = alc_cap_vol_get, \ |
| 2719 | .put = alc_cap_vol_put, \ |
| 2720 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2721 | } |
| 2722 | |
| 2723 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2724 | { \ |
| 2725 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2726 | /* .name = "Capture Source", */ \ |
| 2727 | .name = "Input Source", \ |
| 2728 | .count = num, \ |
| 2729 | .info = alc_mux_enum_info, \ |
| 2730 | .get = alc_mux_enum_get, \ |
| 2731 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2732 | } |
| 2733 | |
| 2734 | #define DEFINE_CAPMIX(num) \ |
| 2735 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2736 | _DEFINE_CAPMIX(num), \ |
| 2737 | _DEFINE_CAPSRC(num), \ |
| 2738 | { } /* end */ \ |
| 2739 | } |
| 2740 | |
| 2741 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2742 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2743 | _DEFINE_CAPMIX(num), \ |
| 2744 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2745 | } |
| 2746 | |
| 2747 | /* up to three ADCs */ |
| 2748 | DEFINE_CAPMIX(1); |
| 2749 | DEFINE_CAPMIX(2); |
| 2750 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2751 | DEFINE_CAPMIX_NOSRC(1); |
| 2752 | DEFINE_CAPMIX_NOSRC(2); |
| 2753 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2754 | |
| 2755 | /* |
| 2756 | * ALC880 5-stack model |
| 2757 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2758 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2759 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2760 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2761 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2762 | */ |
| 2763 | |
| 2764 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2765 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2766 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2767 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2768 | { } /* end */ |
| 2769 | }; |
| 2770 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2771 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2772 | /* 6ch mode */ |
| 2773 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2774 | /* set line-in to input, mute it */ |
| 2775 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2776 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2777 | { } /* end */ |
| 2778 | }; |
| 2779 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2780 | /* 8ch mode */ |
| 2781 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2782 | /* set line-in to output, unmute it */ |
| 2783 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2784 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2785 | { } /* end */ |
| 2786 | }; |
| 2787 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2788 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2789 | { 6, alc880_fivestack_ch6_init }, |
| 2790 | { 8, alc880_fivestack_ch8_init }, |
| 2791 | }; |
| 2792 | |
| 2793 | |
| 2794 | /* |
| 2795 | * ALC880 6-stack model |
| 2796 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2797 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2798 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2799 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2800 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2801 | */ |
| 2802 | |
| 2803 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2804 | /* front, rear, clfe, rear_surr */ |
| 2805 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2806 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2807 | |
| 2808 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2809 | .num_items = 4, |
| 2810 | .items = { |
| 2811 | { "Mic", 0x0 }, |
| 2812 | { "Front Mic", 0x1 }, |
| 2813 | { "Line", 0x2 }, |
| 2814 | { "CD", 0x4 }, |
| 2815 | }, |
| 2816 | }; |
| 2817 | |
| 2818 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2819 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2820 | { 8, NULL }, |
| 2821 | }; |
| 2822 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2823 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2824 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2825 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2826 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2827 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2828 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2829 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2830 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2831 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2832 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2833 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2834 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2835 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2836 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2837 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2840 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2841 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2842 | { |
| 2843 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2844 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2845 | .info = alc_ch_mode_info, |
| 2846 | .get = alc_ch_mode_get, |
| 2847 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2848 | }, |
| 2849 | { } /* end */ |
| 2850 | }; |
| 2851 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2852 | |
| 2853 | /* |
| 2854 | * ALC880 W810 model |
| 2855 | * |
| 2856 | * W810 has rear IO for: |
| 2857 | * Front (DAC 02) |
| 2858 | * Surround (DAC 03) |
| 2859 | * Center/LFE (DAC 04) |
| 2860 | * Digital out (06) |
| 2861 | * |
| 2862 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2863 | * 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] | 2864 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2865 | * There is a variable resistor to control the speaker or headphone |
| 2866 | * volume. This is a hardware-only device without a software API. |
| 2867 | * |
| 2868 | * Plugging headphones in will disable the internal speakers. This is |
| 2869 | * implemented in hardware, not via the driver using jack sense. In |
| 2870 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2871 | * disable both the speakers and headphones. |
| 2872 | * |
| 2873 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2874 | * These may not do anything useful with this driver yet, because I |
| 2875 | * haven't setup any initialization verbs for these yet... |
| 2876 | */ |
| 2877 | |
| 2878 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2879 | /* front, rear/surround, clfe */ |
| 2880 | 0x02, 0x03, 0x04 |
| 2881 | }; |
| 2882 | |
| 2883 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2884 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2885 | { 6, NULL } |
| 2886 | }; |
| 2887 | |
| 2888 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2889 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2890 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2891 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2892 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2893 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2894 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2895 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2896 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2897 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2898 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2899 | { } /* end */ |
| 2900 | }; |
| 2901 | |
| 2902 | |
| 2903 | /* |
| 2904 | * Z710V model |
| 2905 | * |
| 2906 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2907 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2908 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2909 | */ |
| 2910 | |
| 2911 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2912 | 0x02 |
| 2913 | }; |
| 2914 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2915 | |
| 2916 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2917 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2918 | { 2, NULL } |
| 2919 | }; |
| 2920 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2921 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2922 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2923 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2924 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2925 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2926 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2927 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2929 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2930 | { } /* end */ |
| 2931 | }; |
| 2932 | |
| 2933 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2934 | /* |
| 2935 | * ALC880 F1734 model |
| 2936 | * |
| 2937 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2938 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2939 | */ |
| 2940 | |
| 2941 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2942 | 0x03 |
| 2943 | }; |
| 2944 | #define ALC880_F1734_HP_DAC 0x02 |
| 2945 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2946 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2947 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2948 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2949 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2950 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2951 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2952 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2953 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2954 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2955 | { } /* end */ |
| 2956 | }; |
| 2957 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2958 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2959 | .num_items = 2, |
| 2960 | .items = { |
| 2961 | { "Mic", 0x1 }, |
| 2962 | { "CD", 0x4 }, |
| 2963 | }, |
| 2964 | }; |
| 2965 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2966 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2967 | /* |
| 2968 | * ALC880 ASUS model |
| 2969 | * |
| 2970 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2971 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2972 | * Mic = 0x18, Line = 0x1a |
| 2973 | */ |
| 2974 | |
| 2975 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2976 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2977 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2978 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2981 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2982 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2983 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2984 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2985 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2986 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2987 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2988 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2989 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2990 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2991 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2992 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2993 | { |
| 2994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2995 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2996 | .info = alc_ch_mode_info, |
| 2997 | .get = alc_ch_mode_get, |
| 2998 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2999 | }, |
| 3000 | { } /* end */ |
| 3001 | }; |
| 3002 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3003 | /* |
| 3004 | * ALC880 ASUS W1V model |
| 3005 | * |
| 3006 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 3007 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 3008 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 3009 | */ |
| 3010 | |
| 3011 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3012 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3013 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 3014 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3015 | { } /* end */ |
| 3016 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3018 | /* TCL S700 */ |
| 3019 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 3020 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3021 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 3022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 3023 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 3024 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 3025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 3026 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 3027 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 3028 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3029 | { } /* end */ |
| 3030 | }; |
| 3031 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3032 | /* Uniwill */ |
| 3033 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3034 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3035 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3036 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3037 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3038 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3039 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3040 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3041 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3042 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3043 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 3044 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3045 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 3046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3047 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3048 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3049 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3050 | { |
| 3051 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3052 | .name = "Channel Mode", |
| 3053 | .info = alc_ch_mode_info, |
| 3054 | .get = alc_ch_mode_get, |
| 3055 | .put = alc_ch_mode_put, |
| 3056 | }, |
| 3057 | { } /* end */ |
| 3058 | }; |
| 3059 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3060 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 3061 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3062 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3063 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3064 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3065 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3066 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 3067 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3068 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 3069 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3070 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3071 | { } /* end */ |
| 3072 | }; |
| 3073 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3074 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3075 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3076 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3077 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3078 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3081 | { } /* end */ |
| 3082 | }; |
| 3083 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3084 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3085 | * virtual master controls |
| 3086 | */ |
| 3087 | |
| 3088 | /* |
| 3089 | * slave controls for virtual master |
| 3090 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3091 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3092 | "Front Playback Volume", |
| 3093 | "Surround Playback Volume", |
| 3094 | "Center Playback Volume", |
| 3095 | "LFE Playback Volume", |
| 3096 | "Side Playback Volume", |
| 3097 | "Headphone Playback Volume", |
| 3098 | "Speaker Playback Volume", |
| 3099 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3100 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 3101 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3102 | NULL, |
| 3103 | }; |
| 3104 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3105 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3106 | "Front Playback Switch", |
| 3107 | "Surround Playback Switch", |
| 3108 | "Center Playback Switch", |
| 3109 | "LFE Playback Switch", |
| 3110 | "Side Playback Switch", |
| 3111 | "Headphone Playback Switch", |
| 3112 | "Speaker Playback Switch", |
| 3113 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 3114 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 3115 | "Line-Out Playback Switch", |
| 3116 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3117 | NULL, |
| 3118 | }; |
| 3119 | |
| 3120 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3121 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3122 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3123 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3124 | #define NID_MAPPING (-1) |
| 3125 | |
| 3126 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 3127 | #define SUBDEV_HP_ (1 << 6) |
| 3128 | #define SUBDEV_LINE_ (2 << 6) |
| 3129 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 3130 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 3131 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 3132 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3133 | static void alc_free_kctls(struct hda_codec *codec); |
| 3134 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3135 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3136 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 3137 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 3138 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3139 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3140 | { } /* end */ |
| 3141 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3142 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3143 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3144 | static int alc_build_controls(struct hda_codec *codec) |
| 3145 | { |
| 3146 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 3147 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3148 | struct snd_kcontrol_new *knew; |
| 3149 | int i, j, err; |
| 3150 | unsigned int u; |
| 3151 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3152 | |
| 3153 | for (i = 0; i < spec->num_mixers; i++) { |
| 3154 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3155 | if (err < 0) |
| 3156 | return err; |
| 3157 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3158 | if (spec->cap_mixer) { |
| 3159 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3160 | if (err < 0) |
| 3161 | return err; |
| 3162 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3163 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3164 | err = snd_hda_create_spdif_out_ctls(codec, |
| 3165 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3166 | if (err < 0) |
| 3167 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3168 | if (!spec->no_analog) { |
| 3169 | err = snd_hda_create_spdif_share_sw(codec, |
| 3170 | &spec->multiout); |
| 3171 | if (err < 0) |
| 3172 | return err; |
| 3173 | spec->multiout.share_spdif = 1; |
| 3174 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3175 | } |
| 3176 | if (spec->dig_in_nid) { |
| 3177 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3178 | if (err < 0) |
| 3179 | return err; |
| 3180 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3181 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3182 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3183 | /* create beep controls if needed */ |
| 3184 | if (spec->beep_amp) { |
| 3185 | struct snd_kcontrol_new *knew; |
| 3186 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3187 | struct snd_kcontrol *kctl; |
| 3188 | kctl = snd_ctl_new1(knew, codec); |
| 3189 | if (!kctl) |
| 3190 | return -ENOMEM; |
| 3191 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3192 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3193 | if (err < 0) |
| 3194 | return err; |
| 3195 | } |
| 3196 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3197 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3198 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3199 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3200 | if (!spec->no_analog && |
| 3201 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3202 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3203 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3204 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3205 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3206 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3207 | if (err < 0) |
| 3208 | return err; |
| 3209 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3210 | if (!spec->no_analog && |
| 3211 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3212 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3213 | NULL, alc_slave_sws); |
| 3214 | if (err < 0) |
| 3215 | return err; |
| 3216 | } |
| 3217 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3218 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3219 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3220 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3221 | if (!kctl) |
| 3222 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3223 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3224 | hda_nid_t *nids = spec->capsrc_nids; |
| 3225 | if (!nids) |
| 3226 | nids = spec->adc_nids; |
| 3227 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3228 | if (err < 0) |
| 3229 | return err; |
| 3230 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3231 | } |
| 3232 | if (spec->cap_mixer) { |
| 3233 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3234 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3235 | if (kname && strcmp(knew->name, kname) == 0) |
| 3236 | continue; |
| 3237 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3238 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3239 | err = snd_hda_add_nid(codec, kctl, i, |
| 3240 | spec->adc_nids[i]); |
| 3241 | if (err < 0) |
| 3242 | return err; |
| 3243 | } |
| 3244 | } |
| 3245 | } |
| 3246 | |
| 3247 | /* other nid->control mapping */ |
| 3248 | for (i = 0; i < spec->num_mixers; i++) { |
| 3249 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3250 | if (knew->iface != NID_MAPPING) |
| 3251 | continue; |
| 3252 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3253 | if (kctl == NULL) |
| 3254 | continue; |
| 3255 | u = knew->subdevice; |
| 3256 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3257 | nid = u & 0x3f; |
| 3258 | if (nid == 0) |
| 3259 | continue; |
| 3260 | switch (u & 0xc0) { |
| 3261 | case SUBDEV_SPEAKER_: |
| 3262 | nid = spec->autocfg.speaker_pins[nid]; |
| 3263 | break; |
| 3264 | case SUBDEV_LINE_: |
| 3265 | nid = spec->autocfg.line_out_pins[nid]; |
| 3266 | break; |
| 3267 | case SUBDEV_HP_: |
| 3268 | nid = spec->autocfg.hp_pins[nid]; |
| 3269 | break; |
| 3270 | default: |
| 3271 | continue; |
| 3272 | } |
| 3273 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3274 | if (err < 0) |
| 3275 | return err; |
| 3276 | } |
| 3277 | u = knew->private_value; |
| 3278 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3279 | nid = u & 0xff; |
| 3280 | if (nid == 0) |
| 3281 | continue; |
| 3282 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3283 | if (err < 0) |
| 3284 | return err; |
| 3285 | } |
| 3286 | } |
| 3287 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3288 | |
| 3289 | alc_free_kctls(codec); /* no longer needed */ |
| 3290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3291 | return 0; |
| 3292 | } |
| 3293 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3294 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3295 | /* |
| 3296 | * initialize the codec volumes, etc |
| 3297 | */ |
| 3298 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3299 | /* |
| 3300 | * generic initialization of ADC, input mixers and output mixers |
| 3301 | */ |
| 3302 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3303 | /* |
| 3304 | * Unmute ADC0-2 and set the default input to mic-in |
| 3305 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3306 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3307 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3308 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3310 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3311 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3312 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3313 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3314 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3315 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3316 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3317 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3318 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3319 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3320 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3321 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3326 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3327 | /* |
| 3328 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3329 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3330 | /* set vol=0 to output mixers */ |
| 3331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3334 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3335 | /* set up input amps for analog loopback */ |
| 3336 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3339 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3340 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3341 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3342 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3343 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3344 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3345 | |
| 3346 | { } |
| 3347 | }; |
| 3348 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3349 | /* |
| 3350 | * 3-stack pin configuration: |
| 3351 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3352 | */ |
| 3353 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3354 | /* |
| 3355 | * preset connection lists of input pins |
| 3356 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3357 | */ |
| 3358 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3359 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3360 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3361 | |
| 3362 | /* |
| 3363 | * Set pin mode and muting |
| 3364 | */ |
| 3365 | /* set front pin widgets 0x14 for output */ |
| 3366 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3367 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3368 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3369 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3370 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3371 | /* Mic2 (as headphone out) for HP output */ |
| 3372 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3373 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3374 | /* Line In pin widget for input */ |
| 3375 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3376 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3377 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3378 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3379 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3380 | /* CD pin widget for input */ |
| 3381 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3382 | |
| 3383 | { } |
| 3384 | }; |
| 3385 | |
| 3386 | /* |
| 3387 | * 5-stack pin configuration: |
| 3388 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3389 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3390 | */ |
| 3391 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3392 | /* |
| 3393 | * preset connection lists of input pins |
| 3394 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3395 | */ |
| 3396 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3397 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3398 | |
| 3399 | /* |
| 3400 | * Set pin mode and muting |
| 3401 | */ |
| 3402 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3403 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3404 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3405 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3406 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3407 | /* unmute pins for output (no gain on this amp) */ |
| 3408 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3409 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3410 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3411 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3412 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3413 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3414 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3415 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3416 | /* Mic2 (as headphone out) for HP output */ |
| 3417 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3418 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3419 | /* Line In pin widget for input */ |
| 3420 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3421 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3422 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3423 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3424 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3425 | /* CD pin widget for input */ |
| 3426 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3427 | |
| 3428 | { } |
| 3429 | }; |
| 3430 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3431 | /* |
| 3432 | * W810 pin configuration: |
| 3433 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3434 | */ |
| 3435 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3436 | /* hphone/speaker input selector: front DAC */ |
| 3437 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3438 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3439 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3440 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3441 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3442 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3443 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3444 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3445 | |
| 3446 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3447 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3448 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3449 | { } |
| 3450 | }; |
| 3451 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3452 | /* |
| 3453 | * Z71V pin configuration: |
| 3454 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3455 | */ |
| 3456 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3457 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3458 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3459 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3460 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3461 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3462 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3463 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3464 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3465 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3466 | |
| 3467 | { } |
| 3468 | }; |
| 3469 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3470 | /* |
| 3471 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3472 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3473 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3474 | */ |
| 3475 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3476 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3477 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3478 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3480 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3481 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3482 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3483 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3484 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3485 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3486 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3487 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3488 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3489 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3490 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3491 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3492 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3493 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3494 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3495 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3496 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3497 | { } |
| 3498 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3499 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3500 | /* |
| 3501 | * Uniwill pin configuration: |
| 3502 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3503 | * line = 0x1a |
| 3504 | */ |
| 3505 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3506 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3507 | |
| 3508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3510 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3511 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3512 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3513 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3514 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3515 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3518 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3519 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3520 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3522 | |
| 3523 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3524 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3525 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3526 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3527 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3528 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3529 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3530 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3531 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3532 | |
| 3533 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3534 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3535 | |
| 3536 | { } |
| 3537 | }; |
| 3538 | |
| 3539 | /* |
| 3540 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3541 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3542 | */ |
| 3543 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3544 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3545 | |
| 3546 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3547 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3548 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3549 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3550 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3551 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3554 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3555 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3556 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3557 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3558 | |
| 3559 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3560 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3561 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3562 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3563 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3564 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3565 | |
| 3566 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3567 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3568 | |
| 3569 | { } |
| 3570 | }; |
| 3571 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3572 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3573 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3574 | { } |
| 3575 | }; |
| 3576 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3577 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3578 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3579 | { |
| 3580 | unsigned int present; |
| 3581 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3582 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3583 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3584 | bits = present ? HDA_AMP_MUTE : 0; |
| 3585 | 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] | 3586 | } |
| 3587 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3588 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3589 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3590 | struct alc_spec *spec = codec->spec; |
| 3591 | |
| 3592 | spec->autocfg.hp_pins[0] = 0x14; |
| 3593 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3594 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3595 | spec->automute = 1; |
| 3596 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3597 | } |
| 3598 | |
| 3599 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3600 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3601 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3602 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3603 | } |
| 3604 | |
| 3605 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3606 | unsigned int res) |
| 3607 | { |
| 3608 | /* Looks like the unsol event is incompatible with the standard |
| 3609 | * definition. 4bit tag is placed at 28 bit! |
| 3610 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3611 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3612 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3613 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3614 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3615 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3616 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3617 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3618 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3619 | } |
| 3620 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3621 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3622 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3623 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3624 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3625 | spec->autocfg.hp_pins[0] = 0x14; |
| 3626 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3627 | spec->automute = 1; |
| 3628 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3629 | } |
| 3630 | |
| 3631 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3632 | { |
| 3633 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3634 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3635 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3636 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3637 | present &= HDA_AMP_VOLMASK; |
| 3638 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3639 | HDA_AMP_VOLMASK, present); |
| 3640 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3641 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3642 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3643 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3644 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3645 | unsigned int res) |
| 3646 | { |
| 3647 | /* Looks like the unsol event is incompatible with the standard |
| 3648 | * definition. 4bit tag is placed at 28 bit! |
| 3649 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3650 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3651 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3652 | else |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3653 | alc_sku_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3654 | } |
| 3655 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3656 | /* |
| 3657 | * F1734 pin configuration: |
| 3658 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3659 | */ |
| 3660 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3661 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3662 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3663 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3664 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3665 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3666 | |
| 3667 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3669 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3670 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3671 | |
| 3672 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3673 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3674 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3675 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3676 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3677 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3678 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3679 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3680 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3681 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3682 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3683 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3684 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3685 | { } |
| 3686 | }; |
| 3687 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3688 | /* |
| 3689 | * ASUS pin configuration: |
| 3690 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3691 | */ |
| 3692 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3693 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3694 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3695 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3696 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3697 | |
| 3698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3700 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3701 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3702 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3704 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3705 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3706 | |
| 3707 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3709 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3710 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3711 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3712 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3713 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3714 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3715 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3716 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3717 | { } |
| 3718 | }; |
| 3719 | |
| 3720 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3721 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3722 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3723 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3725 | /* Clevo m520g init */ |
| 3726 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3727 | /* headphone output */ |
| 3728 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3729 | /* line-out */ |
| 3730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3731 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3732 | /* Line-in */ |
| 3733 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3734 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3735 | /* CD */ |
| 3736 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3737 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3738 | /* Mic1 (rear panel) */ |
| 3739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3741 | /* Mic2 (front panel) */ |
| 3742 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3743 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3744 | /* headphone */ |
| 3745 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3746 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3747 | /* change to EAPD mode */ |
| 3748 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3749 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3750 | |
| 3751 | { } |
| 3752 | }; |
| 3753 | |
| 3754 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3755 | /* change to EAPD mode */ |
| 3756 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3757 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3758 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3759 | /* Headphone output */ |
| 3760 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3761 | /* Front output*/ |
| 3762 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3763 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3764 | |
| 3765 | /* Line In pin widget for input */ |
| 3766 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3767 | /* CD pin widget for input */ |
| 3768 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3769 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3770 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3771 | |
| 3772 | /* change to EAPD mode */ |
| 3773 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3774 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3775 | |
| 3776 | { } |
| 3777 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3778 | |
| 3779 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3780 | * LG m1 express dual |
| 3781 | * |
| 3782 | * Pin assignment: |
| 3783 | * Rear Line-In/Out (blue): 0x14 |
| 3784 | * Build-in Mic-In: 0x15 |
| 3785 | * Speaker-out: 0x17 |
| 3786 | * HP-Out (green): 0x1b |
| 3787 | * Mic-In/Out (red): 0x19 |
| 3788 | * SPDIF-Out: 0x1e |
| 3789 | */ |
| 3790 | |
| 3791 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3792 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3793 | 0x05, 0x02, 0x03 |
| 3794 | }; |
| 3795 | |
| 3796 | /* seems analog CD is not working */ |
| 3797 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3798 | .num_items = 3, |
| 3799 | .items = { |
| 3800 | { "Mic", 0x1 }, |
| 3801 | { "Line", 0x5 }, |
| 3802 | { "Internal Mic", 0x6 }, |
| 3803 | }, |
| 3804 | }; |
| 3805 | |
| 3806 | /* 2,4,6 channel modes */ |
| 3807 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3808 | /* set line-in and mic-in to input */ |
| 3809 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3810 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3811 | { } |
| 3812 | }; |
| 3813 | |
| 3814 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3815 | /* set line-in to out and mic-in to input */ |
| 3816 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3817 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3818 | { } |
| 3819 | }; |
| 3820 | |
| 3821 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3822 | /* set line-in and mic-in to output */ |
| 3823 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3824 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3825 | { } |
| 3826 | }; |
| 3827 | |
| 3828 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3829 | { 2, alc880_lg_ch2_init }, |
| 3830 | { 4, alc880_lg_ch4_init }, |
| 3831 | { 6, alc880_lg_ch6_init }, |
| 3832 | }; |
| 3833 | |
| 3834 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3835 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3836 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3837 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3838 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3839 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3840 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3841 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3842 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3845 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3846 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3847 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3848 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3849 | { |
| 3850 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3851 | .name = "Channel Mode", |
| 3852 | .info = alc_ch_mode_info, |
| 3853 | .get = alc_ch_mode_get, |
| 3854 | .put = alc_ch_mode_put, |
| 3855 | }, |
| 3856 | { } /* end */ |
| 3857 | }; |
| 3858 | |
| 3859 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3860 | /* set capture source to mic-in */ |
| 3861 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3862 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3863 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3864 | /* mute all amp mixer inputs */ |
| 3865 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3866 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3867 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3868 | /* line-in to input */ |
| 3869 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3870 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3871 | /* built-in mic */ |
| 3872 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3873 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3874 | /* speaker-out */ |
| 3875 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3876 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3877 | /* mic-in to input */ |
| 3878 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3879 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3880 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3881 | /* HP-out */ |
| 3882 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3883 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3884 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3885 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3886 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3887 | { } |
| 3888 | }; |
| 3889 | |
| 3890 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3891 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3892 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3893 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3894 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3895 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3896 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3897 | spec->automute = 1; |
| 3898 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3899 | } |
| 3900 | |
| 3901 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3902 | * LG LW20 |
| 3903 | * |
| 3904 | * Pin assignment: |
| 3905 | * Speaker-out: 0x14 |
| 3906 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3907 | * Built-in Mic-In: 0x19 |
| 3908 | * Line-In: 0x1b |
| 3909 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3910 | * SPDIF-Out: 0x1e |
| 3911 | */ |
| 3912 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3913 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3914 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3915 | .items = { |
| 3916 | { "Mic", 0x0 }, |
| 3917 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3918 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3919 | }, |
| 3920 | }; |
| 3921 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3922 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3923 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3924 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3925 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3926 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3927 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3928 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3929 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3930 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3931 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3932 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3933 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3934 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3937 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3938 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3939 | { |
| 3940 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3941 | .name = "Channel Mode", |
| 3942 | .info = alc_ch_mode_info, |
| 3943 | .get = alc_ch_mode_get, |
| 3944 | .put = alc_ch_mode_put, |
| 3945 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3946 | { } /* end */ |
| 3947 | }; |
| 3948 | |
| 3949 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3950 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3951 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3952 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3953 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3954 | /* set capture source to mic-in */ |
| 3955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3956 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3957 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3958 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3959 | /* speaker-out */ |
| 3960 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3961 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3962 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3963 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3964 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3965 | /* mic-in to input */ |
| 3966 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3967 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3968 | /* built-in mic */ |
| 3969 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3970 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3971 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3972 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3973 | { } |
| 3974 | }; |
| 3975 | |
| 3976 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3977 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3978 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3979 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3980 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3981 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3982 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3983 | spec->automute = 1; |
| 3984 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3985 | } |
| 3986 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3987 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3988 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3989 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3992 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3993 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3994 | { } /* end */ |
| 3995 | }; |
| 3996 | |
| 3997 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3998 | .num_items = 2, |
| 3999 | .items = { |
| 4000 | { "Mic", 0x0 }, |
| 4001 | { "Internal Mic", 0x1 }, |
| 4002 | }, |
| 4003 | }; |
| 4004 | |
| 4005 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 4006 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 4007 | |
| 4008 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4009 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4010 | |
| 4011 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4012 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4013 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4014 | /* Mic2 (as headphone out) for HP output */ |
| 4015 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4016 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4017 | /* Internal Speaker */ |
| 4018 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4019 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4020 | |
| 4021 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4022 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 4023 | |
| 4024 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4025 | { } |
| 4026 | }; |
| 4027 | |
| 4028 | /* toggle speaker-output according to the hp-jack state */ |
| 4029 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 4030 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4031 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4032 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4033 | /* toggle EAPD */ |
| 4034 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4035 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 4036 | else |
| 4037 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 4038 | } |
| 4039 | |
| 4040 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 4041 | unsigned int res) |
| 4042 | { |
| 4043 | /* Looks like the unsol event is incompatible with the standard |
| 4044 | * definition. 4bit tag is placed at 28 bit! |
| 4045 | */ |
| 4046 | if ((res >> 28) == ALC880_HP_EVENT) |
| 4047 | alc880_medion_rim_automute(codec); |
| 4048 | } |
| 4049 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4050 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4051 | { |
| 4052 | struct alc_spec *spec = codec->spec; |
| 4053 | |
| 4054 | spec->autocfg.hp_pins[0] = 0x14; |
| 4055 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4056 | spec->automute = 1; |
| 4057 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4058 | } |
| 4059 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4060 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4061 | static struct hda_amp_list alc880_loopbacks[] = { |
| 4062 | { 0x0b, HDA_INPUT, 0 }, |
| 4063 | { 0x0b, HDA_INPUT, 1 }, |
| 4064 | { 0x0b, HDA_INPUT, 2 }, |
| 4065 | { 0x0b, HDA_INPUT, 3 }, |
| 4066 | { 0x0b, HDA_INPUT, 4 }, |
| 4067 | { } /* end */ |
| 4068 | }; |
| 4069 | |
| 4070 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 4071 | { 0x0b, HDA_INPUT, 1 }, |
| 4072 | { 0x0b, HDA_INPUT, 6 }, |
| 4073 | { 0x0b, HDA_INPUT, 7 }, |
| 4074 | { } /* end */ |
| 4075 | }; |
| 4076 | #endif |
| 4077 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4078 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4079 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4080 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4081 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 4082 | static void alc_init_special_input_src(struct hda_codec *codec); |
| 4083 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4084 | static int alc_init(struct hda_codec *codec) |
| 4085 | { |
| 4086 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4087 | unsigned int i; |
| 4088 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 4089 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4090 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 4091 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4092 | for (i = 0; i < spec->num_init_verbs; i++) |
| 4093 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 4094 | alc_init_special_input_src(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4095 | |
| 4096 | if (spec->init_hook) |
| 4097 | spec->init_hook(codec); |
| 4098 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 4099 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 4100 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4101 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4102 | return 0; |
| 4103 | } |
| 4104 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4105 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4106 | { |
| 4107 | struct alc_spec *spec = codec->spec; |
| 4108 | |
| 4109 | if (spec->unsol_event) |
| 4110 | spec->unsol_event(codec, res); |
| 4111 | } |
| 4112 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4113 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4114 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 4115 | { |
| 4116 | struct alc_spec *spec = codec->spec; |
| 4117 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 4118 | } |
| 4119 | #endif |
| 4120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4121 | /* |
| 4122 | * Analog playback callbacks |
| 4123 | */ |
| 4124 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4125 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4126 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4127 | { |
| 4128 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 4129 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 4130 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4131 | } |
| 4132 | |
| 4133 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4134 | struct hda_codec *codec, |
| 4135 | unsigned int stream_tag, |
| 4136 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4137 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4138 | { |
| 4139 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4140 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 4141 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4142 | } |
| 4143 | |
| 4144 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4145 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4146 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4147 | { |
| 4148 | struct alc_spec *spec = codec->spec; |
| 4149 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 4150 | } |
| 4151 | |
| 4152 | /* |
| 4153 | * Digital out |
| 4154 | */ |
| 4155 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4156 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4157 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4158 | { |
| 4159 | struct alc_spec *spec = codec->spec; |
| 4160 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 4161 | } |
| 4162 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4163 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4164 | struct hda_codec *codec, |
| 4165 | unsigned int stream_tag, |
| 4166 | unsigned int format, |
| 4167 | struct snd_pcm_substream *substream) |
| 4168 | { |
| 4169 | struct alc_spec *spec = codec->spec; |
| 4170 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 4171 | stream_tag, format, substream); |
| 4172 | } |
| 4173 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4174 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4175 | struct hda_codec *codec, |
| 4176 | struct snd_pcm_substream *substream) |
| 4177 | { |
| 4178 | struct alc_spec *spec = codec->spec; |
| 4179 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 4180 | } |
| 4181 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4182 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 4183 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4184 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4185 | { |
| 4186 | struct alc_spec *spec = codec->spec; |
| 4187 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4188 | } |
| 4189 | |
| 4190 | /* |
| 4191 | * Analog capture |
| 4192 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4193 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4194 | struct hda_codec *codec, |
| 4195 | unsigned int stream_tag, |
| 4196 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4197 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4198 | { |
| 4199 | struct alc_spec *spec = codec->spec; |
| 4200 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4201 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4202 | stream_tag, 0, format); |
| 4203 | return 0; |
| 4204 | } |
| 4205 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4206 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4207 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4208 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4209 | { |
| 4210 | struct alc_spec *spec = codec->spec; |
| 4211 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4212 | snd_hda_codec_cleanup_stream(codec, |
| 4213 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4214 | return 0; |
| 4215 | } |
| 4216 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4217 | /* analog capture with dynamic dual-adc changes */ |
| 4218 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4219 | struct hda_codec *codec, |
| 4220 | unsigned int stream_tag, |
| 4221 | unsigned int format, |
| 4222 | struct snd_pcm_substream *substream) |
| 4223 | { |
| 4224 | struct alc_spec *spec = codec->spec; |
| 4225 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4226 | spec->cur_adc_stream_tag = stream_tag; |
| 4227 | spec->cur_adc_format = format; |
| 4228 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4229 | return 0; |
| 4230 | } |
| 4231 | |
| 4232 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4233 | struct hda_codec *codec, |
| 4234 | struct snd_pcm_substream *substream) |
| 4235 | { |
| 4236 | struct alc_spec *spec = codec->spec; |
| 4237 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4238 | spec->cur_adc = 0; |
| 4239 | return 0; |
| 4240 | } |
| 4241 | |
| 4242 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4243 | .substreams = 1, |
| 4244 | .channels_min = 2, |
| 4245 | .channels_max = 2, |
| 4246 | .nid = 0, /* fill later */ |
| 4247 | .ops = { |
| 4248 | .prepare = dualmic_capture_pcm_prepare, |
| 4249 | .cleanup = dualmic_capture_pcm_cleanup |
| 4250 | }, |
| 4251 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4252 | |
| 4253 | /* |
| 4254 | */ |
| 4255 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4256 | .substreams = 1, |
| 4257 | .channels_min = 2, |
| 4258 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4259 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4260 | .ops = { |
| 4261 | .open = alc880_playback_pcm_open, |
| 4262 | .prepare = alc880_playback_pcm_prepare, |
| 4263 | .cleanup = alc880_playback_pcm_cleanup |
| 4264 | }, |
| 4265 | }; |
| 4266 | |
| 4267 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4268 | .substreams = 1, |
| 4269 | .channels_min = 2, |
| 4270 | .channels_max = 2, |
| 4271 | /* NID is set in alc_build_pcms */ |
| 4272 | }; |
| 4273 | |
| 4274 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4275 | .substreams = 1, |
| 4276 | .channels_min = 2, |
| 4277 | .channels_max = 2, |
| 4278 | /* NID is set in alc_build_pcms */ |
| 4279 | }; |
| 4280 | |
| 4281 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4282 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4283 | .channels_min = 2, |
| 4284 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4285 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4286 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4287 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4288 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4289 | }, |
| 4290 | }; |
| 4291 | |
| 4292 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4293 | .substreams = 1, |
| 4294 | .channels_min = 2, |
| 4295 | .channels_max = 2, |
| 4296 | /* NID is set in alc_build_pcms */ |
| 4297 | .ops = { |
| 4298 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4299 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4300 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4301 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4302 | }, |
| 4303 | }; |
| 4304 | |
| 4305 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4306 | .substreams = 1, |
| 4307 | .channels_min = 2, |
| 4308 | .channels_max = 2, |
| 4309 | /* NID is set in alc_build_pcms */ |
| 4310 | }; |
| 4311 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4312 | /* 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] | 4313 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4314 | .substreams = 0, |
| 4315 | .channels_min = 0, |
| 4316 | .channels_max = 0, |
| 4317 | }; |
| 4318 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4319 | static int alc_build_pcms(struct hda_codec *codec) |
| 4320 | { |
| 4321 | struct alc_spec *spec = codec->spec; |
| 4322 | struct hda_pcm *info = spec->pcm_rec; |
| 4323 | int i; |
| 4324 | |
| 4325 | codec->num_pcms = 1; |
| 4326 | codec->pcm_info = info; |
| 4327 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4328 | if (spec->no_analog) |
| 4329 | goto skip_analog; |
| 4330 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4331 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4332 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4333 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4334 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4335 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4336 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4337 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4338 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4339 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4340 | } |
| 4341 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4342 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4343 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4344 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4345 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4346 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4347 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4348 | if (spec->channel_mode) { |
| 4349 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4350 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4351 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4352 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4353 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4354 | } |
| 4355 | } |
| 4356 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4357 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4358 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4359 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4360 | snprintf(spec->stream_name_digital, |
| 4361 | sizeof(spec->stream_name_digital), |
| 4362 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4363 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4364 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4365 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4366 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4367 | if (spec->dig_out_type) |
| 4368 | info->pcm_type = spec->dig_out_type; |
| 4369 | else |
| 4370 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4371 | if (spec->multiout.dig_out_nid && |
| 4372 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4373 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4374 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4375 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4376 | if (spec->dig_in_nid && |
| 4377 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4378 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4379 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4380 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4381 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4382 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4383 | } |
| 4384 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4385 | if (spec->no_analog) |
| 4386 | return 0; |
| 4387 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4388 | /* If the use of more than one ADC is requested for the current |
| 4389 | * model, configure a second analog capture-only PCM. |
| 4390 | */ |
| 4391 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4392 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4393 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4394 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4395 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4396 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4397 | if (spec->alt_dac_nid) { |
| 4398 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4399 | *spec->stream_analog_alt_playback; |
| 4400 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4401 | spec->alt_dac_nid; |
| 4402 | } else { |
| 4403 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4404 | alc_pcm_null_stream; |
| 4405 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4406 | } |
| 4407 | if (spec->num_adc_nids > 1) { |
| 4408 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4409 | *spec->stream_analog_alt_capture; |
| 4410 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4411 | spec->adc_nids[1]; |
| 4412 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4413 | spec->num_adc_nids - 1; |
| 4414 | } else { |
| 4415 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4416 | alc_pcm_null_stream; |
| 4417 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4418 | } |
| 4419 | } |
| 4420 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4421 | return 0; |
| 4422 | } |
| 4423 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4424 | static inline void alc_shutup(struct hda_codec *codec) |
| 4425 | { |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4426 | struct alc_spec *spec = codec->spec; |
| 4427 | |
| 4428 | if (spec && spec->shutup) |
| 4429 | spec->shutup(codec); |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4430 | snd_hda_shutup_pins(codec); |
| 4431 | } |
| 4432 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4433 | static void alc_free_kctls(struct hda_codec *codec) |
| 4434 | { |
| 4435 | struct alc_spec *spec = codec->spec; |
| 4436 | |
| 4437 | if (spec->kctls.list) { |
| 4438 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4439 | int i; |
| 4440 | for (i = 0; i < spec->kctls.used; i++) |
| 4441 | kfree(kctl[i].name); |
| 4442 | } |
| 4443 | snd_array_free(&spec->kctls); |
| 4444 | } |
| 4445 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4446 | static void alc_free(struct hda_codec *codec) |
| 4447 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4448 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4449 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4450 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4451 | return; |
| 4452 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4453 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4454 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4455 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4456 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4457 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4458 | } |
| 4459 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4460 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4461 | static void alc_power_eapd(struct hda_codec *codec) |
| 4462 | { |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 4463 | alc_auto_setup_eapd(codec, false); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4464 | } |
| 4465 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4466 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4467 | { |
| 4468 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4469 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4470 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4471 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4472 | return 0; |
| 4473 | } |
| 4474 | #endif |
| 4475 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4476 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4477 | static int alc_resume(struct hda_codec *codec) |
| 4478 | { |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4479 | msleep(150); /* to avoid pop noise */ |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4480 | codec->patch_ops.init(codec); |
| 4481 | snd_hda_codec_resume_amp(codec); |
| 4482 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4483 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4484 | return 0; |
| 4485 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4486 | #endif |
| 4487 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4488 | /* |
| 4489 | */ |
| 4490 | static struct hda_codec_ops alc_patch_ops = { |
| 4491 | .build_controls = alc_build_controls, |
| 4492 | .build_pcms = alc_build_pcms, |
| 4493 | .init = alc_init, |
| 4494 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4495 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4496 | #ifdef SND_HDA_NEEDS_RESUME |
| 4497 | .resume = alc_resume, |
| 4498 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4499 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4500 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4501 | .check_power_status = alc_check_power_status, |
| 4502 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4503 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4504 | }; |
| 4505 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4506 | /* replace the codec chip_name with the given string */ |
| 4507 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4508 | { |
| 4509 | kfree(codec->chip_name); |
| 4510 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4511 | if (!codec->chip_name) { |
| 4512 | alc_free(codec); |
| 4513 | return -ENOMEM; |
| 4514 | } |
| 4515 | return 0; |
| 4516 | } |
| 4517 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4518 | /* |
| 4519 | * Test configuration for debugging |
| 4520 | * |
| 4521 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4522 | * enum controls. |
| 4523 | */ |
| 4524 | #ifdef CONFIG_SND_DEBUG |
| 4525 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4526 | 0x02, 0x03, 0x04, 0x05 |
| 4527 | }; |
| 4528 | |
| 4529 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4530 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4531 | .items = { |
| 4532 | { "In-1", 0x0 }, |
| 4533 | { "In-2", 0x1 }, |
| 4534 | { "In-3", 0x2 }, |
| 4535 | { "In-4", 0x3 }, |
| 4536 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4537 | { "Front", 0x5 }, |
| 4538 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4539 | }, |
| 4540 | }; |
| 4541 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4542 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4543 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4544 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4545 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4546 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4547 | }; |
| 4548 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4549 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4550 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4551 | { |
| 4552 | static char *texts[] = { |
| 4553 | "N/A", "Line Out", "HP Out", |
| 4554 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4555 | }; |
| 4556 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4557 | uinfo->count = 1; |
| 4558 | uinfo->value.enumerated.items = 8; |
| 4559 | if (uinfo->value.enumerated.item >= 8) |
| 4560 | uinfo->value.enumerated.item = 7; |
| 4561 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4562 | return 0; |
| 4563 | } |
| 4564 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4565 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4566 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4567 | { |
| 4568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4569 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4570 | unsigned int pin_ctl, item = 0; |
| 4571 | |
| 4572 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4573 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4574 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4575 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4576 | item = 2; |
| 4577 | else |
| 4578 | item = 1; |
| 4579 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4580 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4581 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4582 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4583 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4584 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4585 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4586 | } |
| 4587 | } |
| 4588 | ucontrol->value.enumerated.item[0] = item; |
| 4589 | return 0; |
| 4590 | } |
| 4591 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4592 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4593 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4594 | { |
| 4595 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4596 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4597 | static unsigned int ctls[] = { |
| 4598 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4599 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4600 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4601 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4602 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4603 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4604 | }; |
| 4605 | unsigned int old_ctl, new_ctl; |
| 4606 | |
| 4607 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4608 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4609 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4610 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4611 | int val; |
| 4612 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4613 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4614 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4615 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4616 | HDA_AMP_MUTE : 0; |
| 4617 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4618 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4619 | return 1; |
| 4620 | } |
| 4621 | return 0; |
| 4622 | } |
| 4623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4624 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4625 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4626 | { |
| 4627 | static char *texts[] = { |
| 4628 | "Front", "Surround", "CLFE", "Side" |
| 4629 | }; |
| 4630 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4631 | uinfo->count = 1; |
| 4632 | uinfo->value.enumerated.items = 4; |
| 4633 | if (uinfo->value.enumerated.item >= 4) |
| 4634 | uinfo->value.enumerated.item = 3; |
| 4635 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4636 | return 0; |
| 4637 | } |
| 4638 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4639 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4640 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4641 | { |
| 4642 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4643 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4644 | unsigned int sel; |
| 4645 | |
| 4646 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4647 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4648 | return 0; |
| 4649 | } |
| 4650 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4651 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4652 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4653 | { |
| 4654 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4655 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4656 | unsigned int sel; |
| 4657 | |
| 4658 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4659 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4660 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4661 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4662 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4663 | return 1; |
| 4664 | } |
| 4665 | return 0; |
| 4666 | } |
| 4667 | |
| 4668 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4669 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4670 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4671 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4672 | .info = alc_test_pin_ctl_info, \ |
| 4673 | .get = alc_test_pin_ctl_get, \ |
| 4674 | .put = alc_test_pin_ctl_put, \ |
| 4675 | .private_value = nid \ |
| 4676 | } |
| 4677 | |
| 4678 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4680 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4681 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4682 | .info = alc_test_pin_src_info, \ |
| 4683 | .get = alc_test_pin_src_get, \ |
| 4684 | .put = alc_test_pin_src_put, \ |
| 4685 | .private_value = nid \ |
| 4686 | } |
| 4687 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4688 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4689 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4690 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4691 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4692 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4693 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4694 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4695 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4696 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4697 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4698 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4699 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4700 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4701 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4702 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4703 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4704 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4705 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4706 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4707 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4708 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4709 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4710 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4711 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4712 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4713 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4714 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4715 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4716 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4717 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4718 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4719 | { |
| 4720 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4721 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4722 | .info = alc_ch_mode_info, |
| 4723 | .get = alc_ch_mode_get, |
| 4724 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4725 | }, |
| 4726 | { } /* end */ |
| 4727 | }; |
| 4728 | |
| 4729 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4730 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4731 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4732 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4733 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4734 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4735 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4737 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4738 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4739 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4740 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4741 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4742 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4743 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4744 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4745 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4746 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4747 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4748 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4749 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4750 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4752 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4753 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4754 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4755 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4756 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4757 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4758 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4759 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4760 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4761 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4762 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4763 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4764 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4765 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4766 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4767 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4768 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4769 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4770 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4771 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4772 | /* Analog input/passthru */ |
| 4773 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4774 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4775 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4776 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4777 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4778 | { } |
| 4779 | }; |
| 4780 | #endif |
| 4781 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4782 | /* |
| 4783 | */ |
| 4784 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4785 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4786 | [ALC880_3ST] = "3stack", |
| 4787 | [ALC880_TCL_S700] = "tcl", |
| 4788 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4789 | [ALC880_CLEVO] = "clevo", |
| 4790 | [ALC880_5ST] = "5stack", |
| 4791 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4792 | [ALC880_W810] = "w810", |
| 4793 | [ALC880_Z71V] = "z71v", |
| 4794 | [ALC880_6ST] = "6stack", |
| 4795 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4796 | [ALC880_ASUS] = "asus", |
| 4797 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4798 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4799 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4800 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4801 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4802 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4803 | [ALC880_F1734] = "F1734", |
| 4804 | [ALC880_LG] = "lg", |
| 4805 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4806 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4807 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4808 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4809 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4810 | [ALC880_AUTO] = "auto", |
| 4811 | }; |
| 4812 | |
| 4813 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4814 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4815 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4816 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4817 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4818 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4819 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4820 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4821 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4822 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4823 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4824 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4825 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4826 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4827 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4828 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4829 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4830 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4831 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4832 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4833 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4834 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4835 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4836 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4837 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4838 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4839 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4840 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4841 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4842 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4843 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4844 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4845 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4846 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4847 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4848 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4849 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4850 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4851 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4852 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4853 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Justin P. Mattock | a2e2bc2 | 2011-02-24 22:16:02 -0800 | [diff] [blame] | 4854 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4855 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4856 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4857 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4858 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4859 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4860 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4861 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4862 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4863 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4864 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4865 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4866 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4867 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4868 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4869 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4870 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4871 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4872 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4873 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4874 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4875 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4876 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4877 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4878 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4879 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4880 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4881 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4882 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4883 | /* default Intel */ |
| 4884 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4885 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4886 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4887 | {} |
| 4888 | }; |
| 4889 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4890 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4891 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4892 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4893 | static struct alc_config_preset alc880_presets[] = { |
| 4894 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4895 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4896 | .init_verbs = { alc880_volume_init_verbs, |
| 4897 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4898 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4899 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4900 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4901 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4902 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4903 | .input_mux = &alc880_capture_source, |
| 4904 | }, |
| 4905 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4906 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4907 | .init_verbs = { alc880_volume_init_verbs, |
| 4908 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4909 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4910 | .dac_nids = alc880_dac_nids, |
| 4911 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4912 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4913 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4914 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4915 | .input_mux = &alc880_capture_source, |
| 4916 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4917 | [ALC880_TCL_S700] = { |
| 4918 | .mixers = { alc880_tcl_s700_mixer }, |
| 4919 | .init_verbs = { alc880_volume_init_verbs, |
| 4920 | alc880_pin_tcl_S700_init_verbs, |
| 4921 | alc880_gpio2_init_verbs }, |
| 4922 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4923 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4924 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4925 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4926 | .hp_nid = 0x03, |
| 4927 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4928 | .channel_mode = alc880_2_jack_modes, |
| 4929 | .input_mux = &alc880_capture_source, |
| 4930 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4931 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4932 | .mixers = { alc880_three_stack_mixer, |
| 4933 | alc880_five_stack_mixer}, |
| 4934 | .init_verbs = { alc880_volume_init_verbs, |
| 4935 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4936 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4937 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4938 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4939 | .channel_mode = alc880_fivestack_modes, |
| 4940 | .input_mux = &alc880_capture_source, |
| 4941 | }, |
| 4942 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4943 | .mixers = { alc880_three_stack_mixer, |
| 4944 | alc880_five_stack_mixer }, |
| 4945 | .init_verbs = { alc880_volume_init_verbs, |
| 4946 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4947 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4948 | .dac_nids = alc880_dac_nids, |
| 4949 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4950 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4951 | .channel_mode = alc880_fivestack_modes, |
| 4952 | .input_mux = &alc880_capture_source, |
| 4953 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4954 | [ALC880_6ST] = { |
| 4955 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4956 | .init_verbs = { alc880_volume_init_verbs, |
| 4957 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4958 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4959 | .dac_nids = alc880_6st_dac_nids, |
| 4960 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4961 | .channel_mode = alc880_sixstack_modes, |
| 4962 | .input_mux = &alc880_6stack_capture_source, |
| 4963 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4964 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4965 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4966 | .init_verbs = { alc880_volume_init_verbs, |
| 4967 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4968 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4969 | .dac_nids = alc880_6st_dac_nids, |
| 4970 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4971 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4972 | .channel_mode = alc880_sixstack_modes, |
| 4973 | .input_mux = &alc880_6stack_capture_source, |
| 4974 | }, |
| 4975 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4976 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4977 | .init_verbs = { alc880_volume_init_verbs, |
| 4978 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4979 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4980 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4981 | .dac_nids = alc880_w810_dac_nids, |
| 4982 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4983 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4984 | .channel_mode = alc880_w810_modes, |
| 4985 | .input_mux = &alc880_capture_source, |
| 4986 | }, |
| 4987 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4988 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4989 | .init_verbs = { alc880_volume_init_verbs, |
| 4990 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4991 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4992 | .dac_nids = alc880_z71v_dac_nids, |
| 4993 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4994 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4995 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4996 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4997 | .input_mux = &alc880_capture_source, |
| 4998 | }, |
| 4999 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5000 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5001 | .init_verbs = { alc880_volume_init_verbs, |
| 5002 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5003 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 5004 | .dac_nids = alc880_f1734_dac_nids, |
| 5005 | .hp_nid = 0x02, |
| 5006 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5007 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 5008 | .input_mux = &alc880_f1734_capture_source, |
| 5009 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5010 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5011 | .init_hook = alc_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5012 | }, |
| 5013 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5014 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5015 | .init_verbs = { alc880_volume_init_verbs, |
| 5016 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5017 | alc880_gpio1_init_verbs }, |
| 5018 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5019 | .dac_nids = alc880_asus_dac_nids, |
| 5020 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5021 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5022 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5023 | .input_mux = &alc880_capture_source, |
| 5024 | }, |
| 5025 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5026 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5027 | .init_verbs = { alc880_volume_init_verbs, |
| 5028 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5029 | alc880_gpio1_init_verbs }, |
| 5030 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5031 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5032 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5033 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5034 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5035 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5036 | .input_mux = &alc880_capture_source, |
| 5037 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5038 | [ALC880_ASUS_DIG2] = { |
| 5039 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5040 | .init_verbs = { alc880_volume_init_verbs, |
| 5041 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5042 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 5043 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5044 | .dac_nids = alc880_asus_dac_nids, |
| 5045 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5046 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5047 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5048 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5049 | .input_mux = &alc880_capture_source, |
| 5050 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5051 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5052 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5053 | .init_verbs = { alc880_volume_init_verbs, |
| 5054 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5055 | alc880_gpio1_init_verbs }, |
| 5056 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5057 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5058 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5059 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5060 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5061 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5062 | .input_mux = &alc880_capture_source, |
| 5063 | }, |
| 5064 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5065 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5066 | .init_verbs = { alc880_volume_init_verbs, |
| 5067 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5068 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5069 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5070 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5071 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5072 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5073 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5074 | .input_mux = &alc880_capture_source, |
| 5075 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5076 | [ALC880_UNIWILL] = { |
| 5077 | .mixers = { alc880_uniwill_mixer }, |
| 5078 | .init_verbs = { alc880_volume_init_verbs, |
| 5079 | alc880_uniwill_init_verbs }, |
| 5080 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5081 | .dac_nids = alc880_asus_dac_nids, |
| 5082 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5083 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5084 | .channel_mode = alc880_threestack_modes, |
| 5085 | .need_dac_fix = 1, |
| 5086 | .input_mux = &alc880_capture_source, |
| 5087 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5088 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 5089 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5090 | }, |
| 5091 | [ALC880_UNIWILL_P53] = { |
| 5092 | .mixers = { alc880_uniwill_p53_mixer }, |
| 5093 | .init_verbs = { alc880_volume_init_verbs, |
| 5094 | alc880_uniwill_p53_init_verbs }, |
| 5095 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5096 | .dac_nids = alc880_asus_dac_nids, |
| 5097 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5098 | .channel_mode = alc880_threestack_modes, |
| 5099 | .input_mux = &alc880_capture_source, |
| 5100 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5101 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5102 | .init_hook = alc_hp_automute, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5103 | }, |
| 5104 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5105 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5106 | .init_verbs = { alc880_volume_init_verbs, |
| 5107 | alc880_uniwill_p53_init_verbs, |
| 5108 | alc880_beep_init_verbs }, |
| 5109 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5110 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 5111 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5112 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5113 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5114 | .input_mux = &alc880_capture_source, |
| 5115 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5116 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5117 | .init_hook = alc_hp_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5118 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5119 | [ALC880_CLEVO] = { |
| 5120 | .mixers = { alc880_three_stack_mixer }, |
| 5121 | .init_verbs = { alc880_volume_init_verbs, |
| 5122 | alc880_pin_clevo_init_verbs }, |
| 5123 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5124 | .dac_nids = alc880_dac_nids, |
| 5125 | .hp_nid = 0x03, |
| 5126 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5127 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5128 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5129 | .input_mux = &alc880_capture_source, |
| 5130 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5131 | [ALC880_LG] = { |
| 5132 | .mixers = { alc880_lg_mixer }, |
| 5133 | .init_verbs = { alc880_volume_init_verbs, |
| 5134 | alc880_lg_init_verbs }, |
| 5135 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 5136 | .dac_nids = alc880_lg_dac_nids, |
| 5137 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5138 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 5139 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5140 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5141 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5142 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5143 | .setup = alc880_lg_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5144 | .init_hook = alc_hp_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5145 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5146 | .loopbacks = alc880_lg_loopbacks, |
| 5147 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5148 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5149 | [ALC880_LG_LW] = { |
| 5150 | .mixers = { alc880_lg_lw_mixer }, |
| 5151 | .init_verbs = { alc880_volume_init_verbs, |
| 5152 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5153 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5154 | .dac_nids = alc880_dac_nids, |
| 5155 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5156 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5157 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5158 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5159 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5160 | .setup = alc880_lg_lw_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5161 | .init_hook = alc_hp_automute, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5162 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5163 | [ALC880_MEDION_RIM] = { |
| 5164 | .mixers = { alc880_medion_rim_mixer }, |
| 5165 | .init_verbs = { alc880_volume_init_verbs, |
| 5166 | alc880_medion_rim_init_verbs, |
| 5167 | alc_gpio2_init_verbs }, |
| 5168 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5169 | .dac_nids = alc880_dac_nids, |
| 5170 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5171 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5172 | .channel_mode = alc880_2_jack_modes, |
| 5173 | .input_mux = &alc880_medion_rim_capture_source, |
| 5174 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5175 | .setup = alc880_medion_rim_setup, |
| 5176 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5177 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5178 | #ifdef CONFIG_SND_DEBUG |
| 5179 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5180 | .mixers = { alc880_test_mixer }, |
| 5181 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5182 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5183 | .dac_nids = alc880_test_dac_nids, |
| 5184 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5185 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5186 | .channel_mode = alc880_test_modes, |
| 5187 | .input_mux = &alc880_test_capture_source, |
| 5188 | }, |
| 5189 | #endif |
| 5190 | }; |
| 5191 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5192 | /* |
| 5193 | * Automatic parse of I/O pins from the BIOS configuration |
| 5194 | */ |
| 5195 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5196 | enum { |
| 5197 | ALC_CTL_WIDGET_VOL, |
| 5198 | ALC_CTL_WIDGET_MUTE, |
| 5199 | ALC_CTL_BIND_MUTE, |
| 5200 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5201 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5202 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5203 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5204 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5205 | }; |
| 5206 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5207 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) |
| 5208 | { |
| 5209 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
| 5210 | return snd_array_new(&spec->kctls); |
| 5211 | } |
| 5212 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5213 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5214 | 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] | 5215 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5216 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5217 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5218 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5219 | knew = alc_kcontrol_new(spec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5220 | if (!knew) |
| 5221 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5222 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5223 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5224 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5225 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5226 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5227 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5228 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5229 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5230 | return 0; |
| 5231 | } |
| 5232 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5233 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5234 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5235 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5236 | { |
| 5237 | char name[32]; |
| 5238 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5239 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5240 | } |
| 5241 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5242 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5243 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5244 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5245 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5246 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5247 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5248 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5249 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5250 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5251 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5252 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5253 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5254 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5255 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5256 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5257 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5258 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5259 | #define ALC880_PIN_CD_NID 0x1c |
| 5260 | |
| 5261 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5262 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5263 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5264 | { |
| 5265 | hda_nid_t nid; |
| 5266 | int assigned[4]; |
| 5267 | int i, j; |
| 5268 | |
| 5269 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5270 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5271 | |
| 5272 | /* check the pins hardwired to audio widget */ |
| 5273 | for (i = 0; i < cfg->line_outs; i++) { |
| 5274 | nid = cfg->line_out_pins[i]; |
| 5275 | if (alc880_is_fixed_pin(nid)) { |
| 5276 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5277 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5278 | assigned[idx] = 1; |
| 5279 | } |
| 5280 | } |
| 5281 | /* left pins can be connect to any audio widget */ |
| 5282 | for (i = 0; i < cfg->line_outs; i++) { |
| 5283 | nid = cfg->line_out_pins[i]; |
| 5284 | if (alc880_is_fixed_pin(nid)) |
| 5285 | continue; |
| 5286 | /* search for an empty channel */ |
| 5287 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5288 | if (!assigned[j]) { |
| 5289 | spec->multiout.dac_nids[i] = |
| 5290 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5291 | assigned[j] = 1; |
| 5292 | break; |
| 5293 | } |
| 5294 | } |
| 5295 | } |
| 5296 | spec->multiout.num_dacs = cfg->line_outs; |
| 5297 | return 0; |
| 5298 | } |
| 5299 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5300 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5301 | bool can_be_master) |
| 5302 | { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5303 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 5304 | |
| 5305 | if (cfg->line_outs == 1 && !spec->multi_ios && |
| 5306 | !cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5307 | return "Master"; |
| 5308 | |
| 5309 | switch (cfg->line_out_type) { |
| 5310 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5311 | if (cfg->line_outs == 1) |
| 5312 | return "Speaker"; |
| 5313 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5314 | case AUTO_PIN_HP_OUT: |
| 5315 | return "Headphone"; |
| 5316 | default: |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5317 | if (cfg->line_outs == 1 && !spec->multi_ios) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5318 | return "PCM"; |
| 5319 | break; |
| 5320 | } |
| 5321 | return NULL; |
| 5322 | } |
| 5323 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5324 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5325 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5326 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5327 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5328 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5329 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5330 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5331 | const char *pfx = alc_get_line_out_pfx(spec, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5332 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5333 | int i, err, noutputs; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5334 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5335 | noutputs = cfg->line_outs; |
| 5336 | if (spec->multi_ios > 0) |
| 5337 | noutputs += spec->multi_ios; |
| 5338 | |
| 5339 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5340 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5341 | continue; |
| 5342 | 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] | 5343 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5344 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5345 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5346 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5347 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5348 | HDA_OUTPUT)); |
| 5349 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5350 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5351 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5352 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5353 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5354 | HDA_OUTPUT)); |
| 5355 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5356 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5357 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5358 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5359 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5360 | HDA_INPUT)); |
| 5361 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5362 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5363 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5364 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5365 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5366 | HDA_INPUT)); |
| 5367 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5368 | return err; |
| 5369 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5370 | const char *name = pfx; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5371 | int index = i; |
| 5372 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5373 | name = chname[i]; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5374 | index = 0; |
| 5375 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5376 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5377 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5378 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5379 | HDA_OUTPUT)); |
| 5380 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5381 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5382 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5383 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5384 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5385 | HDA_INPUT)); |
| 5386 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5387 | return err; |
| 5388 | } |
| 5389 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5390 | return 0; |
| 5391 | } |
| 5392 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5393 | /* add playback controls for speaker and HP outputs */ |
| 5394 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5395 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5396 | { |
| 5397 | hda_nid_t nid; |
| 5398 | int err; |
| 5399 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5400 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5401 | return 0; |
| 5402 | |
| 5403 | if (alc880_is_fixed_pin(pin)) { |
| 5404 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5405 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5406 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5407 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5408 | else |
| 5409 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5410 | /* control HP volume/switch on the output mixer amp */ |
| 5411 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5412 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5413 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5414 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5415 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5416 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5417 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5418 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5419 | return err; |
| 5420 | } else if (alc880_is_multi_pin(pin)) { |
| 5421 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5422 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5423 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5424 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5425 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5426 | return err; |
| 5427 | } |
| 5428 | return 0; |
| 5429 | } |
| 5430 | |
| 5431 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5432 | 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] | 5433 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5434 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5435 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5436 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5437 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5438 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5439 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5440 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5441 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5442 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5443 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5444 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5445 | return err; |
| 5446 | return 0; |
| 5447 | } |
| 5448 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5449 | 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] | 5450 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5451 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5452 | return (pincap & AC_PINCAP_IN) != 0; |
| 5453 | } |
| 5454 | |
| 5455 | /* create playback/capture controls for input pins */ |
| 5456 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5457 | const struct auto_pin_cfg *cfg, |
| 5458 | hda_nid_t mixer, |
| 5459 | hda_nid_t cap1, hda_nid_t cap2) |
| 5460 | { |
| 5461 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5462 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5463 | int i, err, idx, type_idx = 0; |
| 5464 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5465 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5466 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5467 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5468 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5469 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5470 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5471 | if (!alc_is_input_pin(codec, pin)) |
| 5472 | continue; |
| 5473 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5474 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5475 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5476 | type_idx++; |
| 5477 | else |
| 5478 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5479 | prev_label = label; |
| 5480 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5481 | if (mixer) { |
| 5482 | idx = get_connection_index(codec, mixer, pin); |
| 5483 | if (idx >= 0) { |
| 5484 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5485 | label, type_idx, |
| 5486 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5487 | if (err < 0) |
| 5488 | return err; |
| 5489 | } |
| 5490 | } |
| 5491 | |
| 5492 | if (!cap1) |
| 5493 | continue; |
| 5494 | idx = get_connection_index(codec, cap1, pin); |
| 5495 | if (idx < 0 && cap2) |
| 5496 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5497 | if (idx >= 0) |
| 5498 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5499 | } |
| 5500 | return 0; |
| 5501 | } |
| 5502 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5503 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5504 | const struct auto_pin_cfg *cfg) |
| 5505 | { |
| 5506 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5507 | } |
| 5508 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5509 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5510 | unsigned int pin_type) |
| 5511 | { |
| 5512 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5513 | pin_type); |
| 5514 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5515 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5516 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5517 | } |
| 5518 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5519 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5520 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5521 | int dac_idx) |
| 5522 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5523 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5524 | /* need the manual connection? */ |
| 5525 | if (alc880_is_multi_pin(nid)) { |
| 5526 | struct alc_spec *spec = codec->spec; |
| 5527 | int idx = alc880_multi_pin_idx(nid); |
| 5528 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5529 | AC_VERB_SET_CONNECT_SEL, |
| 5530 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5531 | } |
| 5532 | } |
| 5533 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5534 | static int get_pin_type(int line_out_type) |
| 5535 | { |
| 5536 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5537 | return PIN_HP; |
| 5538 | else |
| 5539 | return PIN_OUT; |
| 5540 | } |
| 5541 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5542 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5543 | { |
| 5544 | struct alc_spec *spec = codec->spec; |
| 5545 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5546 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5547 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5548 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5549 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5550 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5551 | } |
| 5552 | } |
| 5553 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5554 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5555 | { |
| 5556 | struct alc_spec *spec = codec->spec; |
| 5557 | hda_nid_t pin; |
| 5558 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5559 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5560 | if (pin) /* connect to front */ |
| 5561 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5562 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5563 | if (pin) /* connect to front */ |
| 5564 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5565 | } |
| 5566 | |
| 5567 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5568 | { |
| 5569 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5570 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5571 | int i; |
| 5572 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5573 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5574 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5575 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5576 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5577 | if (nid != ALC880_PIN_CD_NID && |
| 5578 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5579 | snd_hda_codec_write(codec, nid, 0, |
| 5580 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5581 | AMP_OUT_MUTE); |
| 5582 | } |
| 5583 | } |
| 5584 | } |
| 5585 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5586 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5587 | { |
| 5588 | struct alc_spec *spec = codec->spec; |
| 5589 | int c; |
| 5590 | |
| 5591 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5592 | unsigned int mux_idx; |
| 5593 | const struct hda_input_mux *imux; |
| 5594 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5595 | imux = &spec->input_mux[mux_idx]; |
| 5596 | if (!imux->num_items && mux_idx > 0) |
| 5597 | imux = &spec->input_mux[0]; |
| 5598 | if (imux) |
| 5599 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5600 | AC_VERB_SET_CONNECT_SEL, |
| 5601 | imux->items[0].index); |
| 5602 | } |
| 5603 | } |
| 5604 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5605 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec); |
| 5606 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5607 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5608 | /* return 1 if successful, 0 if the proper config is not found, |
| 5609 | * or a negative error code |
| 5610 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5611 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5612 | { |
| 5613 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5614 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5615 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5616 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5617 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5618 | alc880_ignore); |
| 5619 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5620 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5621 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5622 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5623 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5624 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5625 | if (err < 0) |
| 5626 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5627 | err = alc_auto_add_multi_channel_mode(codec); |
| 5628 | if (err < 0) |
| 5629 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5630 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5631 | if (err < 0) |
| 5632 | return err; |
| 5633 | err = alc880_auto_create_extra_out(spec, |
| 5634 | spec->autocfg.speaker_pins[0], |
| 5635 | "Speaker"); |
| 5636 | if (err < 0) |
| 5637 | return err; |
| 5638 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5639 | "Headphone"); |
| 5640 | if (err < 0) |
| 5641 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5642 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5643 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5644 | return err; |
| 5645 | |
| 5646 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5647 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5648 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5649 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5650 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5651 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5652 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5653 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5654 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5655 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5656 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5657 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5658 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5659 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5660 | return 1; |
| 5661 | } |
| 5662 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5663 | /* additional initialization for auto-configuration model */ |
| 5664 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5665 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5666 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5667 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5668 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5669 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5670 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5671 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5672 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5673 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5674 | } |
| 5675 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5676 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5677 | * one of two digital mic pins, e.g. on ALC272 |
| 5678 | */ |
| 5679 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5680 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5681 | struct alc_spec *spec = codec->spec; |
| 5682 | int i; |
| 5683 | |
| 5684 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5685 | hda_nid_t cap = spec->capsrc_nids ? |
| 5686 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5687 | int iidx, eidx; |
| 5688 | |
| 5689 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5690 | if (iidx < 0) |
| 5691 | continue; |
| 5692 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5693 | if (eidx < 0) |
| 5694 | continue; |
| 5695 | spec->int_mic.mux_idx = iidx; |
| 5696 | spec->ext_mic.mux_idx = eidx; |
| 5697 | if (spec->capsrc_nids) |
| 5698 | spec->capsrc_nids += i; |
| 5699 | spec->adc_nids += i; |
| 5700 | spec->num_adc_nids = 1; |
| 5701 | return; |
| 5702 | } |
| 5703 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5704 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5705 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5706 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5707 | } |
| 5708 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5709 | /* select or unmute the given capsrc route */ |
| 5710 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5711 | int idx) |
| 5712 | { |
| 5713 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5714 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5715 | HDA_AMP_MUTE, 0); |
| 5716 | } else { |
| 5717 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5718 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5719 | } |
| 5720 | } |
| 5721 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5722 | /* set the default connection to that pin */ |
| 5723 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5724 | { |
| 5725 | struct alc_spec *spec = codec->spec; |
| 5726 | int i; |
| 5727 | |
| 5728 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5729 | hda_nid_t cap = spec->capsrc_nids ? |
| 5730 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5731 | int idx; |
| 5732 | |
| 5733 | idx = get_connection_index(codec, cap, pin); |
| 5734 | if (idx < 0) |
| 5735 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5736 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5737 | return i; /* return the found index */ |
| 5738 | } |
| 5739 | return -1; /* not found */ |
| 5740 | } |
| 5741 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5742 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5743 | static void fixup_single_adc(struct hda_codec *codec) |
| 5744 | { |
| 5745 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5746 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5747 | int i; |
| 5748 | |
| 5749 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5750 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5751 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5752 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5753 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5754 | /* use only this ADC */ |
| 5755 | if (spec->capsrc_nids) |
| 5756 | spec->capsrc_nids += i; |
| 5757 | spec->adc_nids += i; |
| 5758 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5759 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5760 | } |
| 5761 | } |
| 5762 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5763 | /* initialize dual adcs */ |
| 5764 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5765 | { |
| 5766 | struct alc_spec *spec = codec->spec; |
| 5767 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5768 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5769 | } |
| 5770 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5771 | /* initialize some special cases for input sources */ |
| 5772 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5773 | { |
| 5774 | struct alc_spec *spec = codec->spec; |
| 5775 | if (spec->dual_adc_switch) |
| 5776 | fixup_dual_adc_switch(codec); |
| 5777 | else if (spec->single_input_src) |
| 5778 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5779 | } |
| 5780 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5781 | static void set_capture_mixer(struct hda_codec *codec) |
| 5782 | { |
| 5783 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5784 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5785 | { alc_capture_mixer_nosrc1, |
| 5786 | alc_capture_mixer_nosrc2, |
| 5787 | alc_capture_mixer_nosrc3 }, |
| 5788 | { alc_capture_mixer1, |
| 5789 | alc_capture_mixer2, |
| 5790 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5791 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5792 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5793 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5794 | int num_adcs = spec->num_adc_nids; |
| 5795 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5796 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5797 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5798 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5799 | else if (spec->input_mux) { |
| 5800 | if (spec->input_mux->num_items > 1) |
| 5801 | mux = 1; |
| 5802 | else if (spec->input_mux->num_items == 1) |
| 5803 | fixup_single_adc(codec); |
| 5804 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5805 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5806 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5807 | } |
| 5808 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5809 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5810 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5811 | int num_nids) |
| 5812 | { |
| 5813 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5814 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5815 | int n; |
| 5816 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5817 | |
| 5818 | for (n = 0; n < num_nids; n++) { |
| 5819 | hda_nid_t adc, cap; |
| 5820 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5821 | int nconns, i, j; |
| 5822 | |
| 5823 | adc = nids[n]; |
| 5824 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5825 | continue; |
| 5826 | cap = adc; |
| 5827 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5828 | ARRAY_SIZE(conn)); |
| 5829 | if (nconns == 1) { |
| 5830 | cap = conn[0]; |
| 5831 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5832 | ARRAY_SIZE(conn)); |
| 5833 | } |
| 5834 | if (nconns <= 0) |
| 5835 | continue; |
| 5836 | if (!fallback_adc) { |
| 5837 | fallback_adc = adc; |
| 5838 | fallback_cap = cap; |
| 5839 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5840 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5841 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5842 | for (j = 0; j < nconns; j++) { |
| 5843 | if (conn[j] == nid) |
| 5844 | break; |
| 5845 | } |
| 5846 | if (j >= nconns) |
| 5847 | break; |
| 5848 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5849 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5850 | int num_adcs = spec->num_adc_nids; |
| 5851 | spec->private_adc_nids[num_adcs] = adc; |
| 5852 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5853 | spec->num_adc_nids++; |
| 5854 | spec->adc_nids = spec->private_adc_nids; |
| 5855 | if (adc != cap) |
| 5856 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5857 | } |
| 5858 | } |
| 5859 | if (!spec->num_adc_nids) { |
| 5860 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5861 | " using fallback 0x%x\n", |
| 5862 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5863 | spec->private_adc_nids[0] = fallback_adc; |
| 5864 | spec->adc_nids = spec->private_adc_nids; |
| 5865 | if (fallback_adc != fallback_cap) { |
| 5866 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5867 | spec->capsrc_nids = spec->private_adc_nids; |
| 5868 | } |
| 5869 | } |
| 5870 | } |
| 5871 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5872 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5873 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5874 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5875 | |
| 5876 | static struct snd_pci_quirk beep_white_list[] = { |
| 5877 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5878 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5879 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5880 | {} |
| 5881 | }; |
| 5882 | |
| 5883 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5884 | { |
| 5885 | struct alc_spec *spec = codec->spec; |
| 5886 | const struct snd_pci_quirk *q; |
| 5887 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5888 | if (q) |
| 5889 | return q->value; |
| 5890 | return spec->cdefine.enable_pcbeep; |
| 5891 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5892 | #else |
| 5893 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5894 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5895 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5896 | |
| 5897 | /* |
| 5898 | * OK, here we have finally the patch for ALC880 |
| 5899 | */ |
| 5900 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5901 | static int patch_alc880(struct hda_codec *codec) |
| 5902 | { |
| 5903 | struct alc_spec *spec; |
| 5904 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5905 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5906 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5907 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5908 | if (spec == NULL) |
| 5909 | return -ENOMEM; |
| 5910 | |
| 5911 | codec->spec = spec; |
| 5912 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5913 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5914 | alc880_models, |
| 5915 | alc880_cfg_tbl); |
| 5916 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5917 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5918 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5919 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5920 | } |
| 5921 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5922 | if (board_config == ALC880_AUTO) { |
| 5923 | /* automatic parse from the BIOS config */ |
| 5924 | err = alc880_parse_auto_config(codec); |
| 5925 | if (err < 0) { |
| 5926 | alc_free(codec); |
| 5927 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5928 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5929 | printk(KERN_INFO |
| 5930 | "hda_codec: Cannot set up configuration " |
| 5931 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5932 | board_config = ALC880_3ST; |
| 5933 | } |
| 5934 | } |
| 5935 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5936 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5937 | if (err < 0) { |
| 5938 | alc_free(codec); |
| 5939 | return err; |
| 5940 | } |
| 5941 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5942 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5943 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5944 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5945 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5946 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5947 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5948 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5949 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5950 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5951 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5952 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5953 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5954 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5955 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5956 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5957 | if (wcap != AC_WID_AUD_IN) { |
| 5958 | spec->adc_nids = alc880_adc_nids_alt; |
| 5959 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5960 | } else { |
| 5961 | spec->adc_nids = alc880_adc_nids; |
| 5962 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5963 | } |
| 5964 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5965 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5966 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5967 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5968 | spec->vmaster_nid = 0x0c; |
| 5969 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5970 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5971 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5972 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5973 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5974 | if (!spec->loopback.amplist) |
| 5975 | spec->loopback.amplist = alc880_loopbacks; |
| 5976 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5977 | |
| 5978 | return 0; |
| 5979 | } |
| 5980 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5981 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5982 | /* |
| 5983 | * ALC260 support |
| 5984 | */ |
| 5985 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5986 | static hda_nid_t alc260_dac_nids[1] = { |
| 5987 | /* front */ |
| 5988 | 0x02, |
| 5989 | }; |
| 5990 | |
| 5991 | static hda_nid_t alc260_adc_nids[1] = { |
| 5992 | /* ADC0 */ |
| 5993 | 0x04, |
| 5994 | }; |
| 5995 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5996 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5997 | /* ADC1 */ |
| 5998 | 0x05, |
| 5999 | }; |
| 6000 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6001 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 6002 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 6003 | */ |
| 6004 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6005 | /* ADC0, ADC1 */ |
| 6006 | 0x04, 0x05 |
| 6007 | }; |
| 6008 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6009 | #define ALC260_DIGOUT_NID 0x03 |
| 6010 | #define ALC260_DIGIN_NID 0x06 |
| 6011 | |
| 6012 | static struct hda_input_mux alc260_capture_source = { |
| 6013 | .num_items = 4, |
| 6014 | .items = { |
| 6015 | { "Mic", 0x0 }, |
| 6016 | { "Front Mic", 0x1 }, |
| 6017 | { "Line", 0x2 }, |
| 6018 | { "CD", 0x4 }, |
| 6019 | }, |
| 6020 | }; |
| 6021 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6022 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6023 | * headphone jack and the internal CD lines since these are the only pins at |
| 6024 | * which audio can appear. For flexibility, also allow the option of |
| 6025 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 6026 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6027 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6028 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 6029 | { |
| 6030 | .num_items = 3, |
| 6031 | .items = { |
| 6032 | { "Mic/Line", 0x0 }, |
| 6033 | { "CD", 0x4 }, |
| 6034 | { "Headphone", 0x2 }, |
| 6035 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6036 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6037 | { |
| 6038 | .num_items = 4, |
| 6039 | .items = { |
| 6040 | { "Mic/Line", 0x0 }, |
| 6041 | { "CD", 0x4 }, |
| 6042 | { "Headphone", 0x2 }, |
| 6043 | { "Mixer", 0x5 }, |
| 6044 | }, |
| 6045 | }, |
| 6046 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6047 | }; |
| 6048 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6049 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 6050 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6051 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6052 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 6053 | { |
| 6054 | .num_items = 4, |
| 6055 | .items = { |
| 6056 | { "Mic", 0x0 }, |
| 6057 | { "Line", 0x2 }, |
| 6058 | { "CD", 0x4 }, |
| 6059 | { "Headphone", 0x5 }, |
| 6060 | }, |
| 6061 | }, |
| 6062 | { |
| 6063 | .num_items = 5, |
| 6064 | .items = { |
| 6065 | { "Mic", 0x0 }, |
| 6066 | { "Line", 0x2 }, |
| 6067 | { "CD", 0x4 }, |
| 6068 | { "Headphone", 0x6 }, |
| 6069 | { "Mixer", 0x5 }, |
| 6070 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6071 | }, |
| 6072 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6073 | |
| 6074 | /* Maxdata Favorit 100XS */ |
| 6075 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 6076 | { |
| 6077 | .num_items = 2, |
| 6078 | .items = { |
| 6079 | { "Line/Mic", 0x0 }, |
| 6080 | { "CD", 0x4 }, |
| 6081 | }, |
| 6082 | }, |
| 6083 | { |
| 6084 | .num_items = 3, |
| 6085 | .items = { |
| 6086 | { "Line/Mic", 0x0 }, |
| 6087 | { "CD", 0x4 }, |
| 6088 | { "Mixer", 0x5 }, |
| 6089 | }, |
| 6090 | }, |
| 6091 | }; |
| 6092 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6093 | /* |
| 6094 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 6095 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 6096 | * element which allows changing the channel mode, so the verb list is |
| 6097 | * never used. |
| 6098 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6099 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6100 | { 2, NULL }, |
| 6101 | }; |
| 6102 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6103 | |
| 6104 | /* Mixer combinations |
| 6105 | * |
| 6106 | * basic: base_output + input + pc_beep + capture |
| 6107 | * HP: base_output + input + capture_alt |
| 6108 | * HP_3013: hp_3013 + input + capture |
| 6109 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6110 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6111 | */ |
| 6112 | |
| 6113 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6114 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6115 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6116 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6117 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6118 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6119 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6120 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6121 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6122 | |
| 6123 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6124 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6125 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6126 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6127 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6128 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6129 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6130 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6131 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6132 | { } /* end */ |
| 6133 | }; |
| 6134 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6135 | /* update HP, line and mono out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6136 | static void alc260_hp_master_update(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6137 | { |
| 6138 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6139 | |
| 6140 | /* change HP pins */ |
| 6141 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 6142 | spec->autocfg.hp_pins, spec->master_mute, true); |
| 6143 | update_speakers(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6144 | } |
| 6145 | |
| 6146 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 6147 | struct snd_ctl_elem_value *ucontrol) |
| 6148 | { |
| 6149 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6150 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6151 | *ucontrol->value.integer.value = !spec->master_mute; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6152 | return 0; |
| 6153 | } |
| 6154 | |
| 6155 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6156 | struct snd_ctl_elem_value *ucontrol) |
| 6157 | { |
| 6158 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6159 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6160 | int val = !*ucontrol->value.integer.value; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6161 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6162 | if (val == spec->master_mute) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6163 | return 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6164 | spec->master_mute = val; |
| 6165 | alc260_hp_master_update(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6166 | return 1; |
| 6167 | } |
| 6168 | |
| 6169 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 6170 | { |
| 6171 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6172 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6173 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6174 | .info = snd_ctl_boolean_mono_info, |
| 6175 | .get = alc260_hp_master_sw_get, |
| 6176 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6177 | }, |
| 6178 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6179 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6180 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6181 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6182 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6183 | HDA_OUTPUT), |
| 6184 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6185 | { } /* end */ |
| 6186 | }; |
| 6187 | |
| 6188 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 6189 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6190 | {}, |
| 6191 | }; |
| 6192 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6193 | static void alc260_hp_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6194 | { |
| 6195 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6196 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6197 | spec->autocfg.hp_pins[0] = 0x0f; |
| 6198 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6199 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6200 | spec->automute = 1; |
| 6201 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6202 | } |
| 6203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6204 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6205 | { |
| 6206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6207 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6208 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6209 | .info = snd_ctl_boolean_mono_info, |
| 6210 | .get = alc260_hp_master_sw_get, |
| 6211 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6212 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6213 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6214 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6215 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6216 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6217 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6218 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6219 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6220 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6221 | { } /* end */ |
| 6222 | }; |
| 6223 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6224 | static void alc260_hp_3013_setup(struct hda_codec *codec) |
| 6225 | { |
| 6226 | struct alc_spec *spec = codec->spec; |
| 6227 | |
| 6228 | spec->autocfg.hp_pins[0] = 0x15; |
| 6229 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6230 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6231 | spec->automute = 1; |
| 6232 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 6233 | } |
| 6234 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6235 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6236 | .ops = &snd_hda_bind_vol, |
| 6237 | .values = { |
| 6238 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6239 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6240 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6241 | 0 |
| 6242 | }, |
| 6243 | }; |
| 6244 | |
| 6245 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6246 | .ops = &snd_hda_bind_sw, |
| 6247 | .values = { |
| 6248 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6249 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6250 | 0 |
| 6251 | }, |
| 6252 | }; |
| 6253 | |
| 6254 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6255 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6256 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6257 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6258 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6259 | { } /* end */ |
| 6260 | }; |
| 6261 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6262 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6263 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6264 | {}, |
| 6265 | }; |
| 6266 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6267 | static void alc260_hp_3012_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6268 | { |
| 6269 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6270 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6271 | spec->autocfg.hp_pins[0] = 0x10; |
| 6272 | spec->autocfg.speaker_pins[0] = 0x0f; |
| 6273 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6274 | spec->autocfg.speaker_pins[2] = 0x15; |
| 6275 | spec->automute = 1; |
| 6276 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6277 | } |
| 6278 | |
| 6279 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6280 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6281 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6282 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6283 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6284 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6285 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6286 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6287 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6288 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6289 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6290 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6291 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6292 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6293 | { } /* end */ |
| 6294 | }; |
| 6295 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6296 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6297 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6298 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6299 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6300 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6301 | * revisions available in early 2006. Therefore for now allow the |
| 6302 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6303 | * that the lack of mic bias for this NID is intentional we could change the |
| 6304 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6305 | * |
| 6306 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6307 | * don't appear to make the mic bias available from the "line" jack, even |
| 6308 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6309 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6310 | * and the output jack. If this turns out to be the case for all such |
| 6311 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6312 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6313 | * |
| 6314 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6315 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6316 | * controls for such models. On models without a "mono speaker" the control |
| 6317 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6318 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6319 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6320 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6321 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6322 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6323 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6324 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6325 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6326 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6327 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6328 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6331 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6333 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6334 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6335 | { } /* end */ |
| 6336 | }; |
| 6337 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6338 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6339 | */ |
| 6340 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6341 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6342 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6343 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6344 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6345 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6346 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6347 | { } /* end */ |
| 6348 | }; |
| 6349 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6350 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6351 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6352 | */ |
| 6353 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6354 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6355 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6356 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6357 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6358 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6359 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6360 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6361 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6362 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6363 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6364 | { } /* end */ |
| 6365 | }; |
| 6366 | |
| 6367 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6368 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6369 | */ |
| 6370 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6371 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6372 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6373 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6374 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6375 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6376 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6377 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6378 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6379 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6380 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6381 | { } /* end */ |
| 6382 | }; |
| 6383 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6384 | /* |
| 6385 | * initialization verbs |
| 6386 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6387 | static struct hda_verb alc260_init_verbs[] = { |
| 6388 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6389 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6390 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6391 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6392 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6393 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6394 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6395 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6396 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6397 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6398 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6399 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6400 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6401 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6402 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6403 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6404 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6405 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6406 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6407 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6408 | /* set connection select to line in (default select for this ADC) */ |
| 6409 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6410 | /* mute capture amp left and right */ |
| 6411 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6412 | /* set connection select to line in (default select for this ADC) */ |
| 6413 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6414 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6415 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6416 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6417 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6418 | /* set vol=0 HP mixer amp left and right */ |
| 6419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6420 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6421 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6422 | /* set vol=0 Mono mixer amp left and right */ |
| 6423 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6424 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6425 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6426 | /* unmute LINE-2 out pin */ |
| 6427 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6428 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6429 | * Line In 2 = 0x03 |
| 6430 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6431 | /* mute analog inputs */ |
| 6432 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6434 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6435 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6437 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6438 | /* mute Front out path */ |
| 6439 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6440 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6441 | /* mute Headphone out path */ |
| 6442 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6443 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6444 | /* mute Mono out path */ |
| 6445 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6446 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6447 | { } |
| 6448 | }; |
| 6449 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6450 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6451 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6452 | /* Headphone and output */ |
| 6453 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6454 | /* mono output */ |
| 6455 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6456 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6457 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6458 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6459 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6460 | /* Line In pin widget for input */ |
| 6461 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6462 | /* Line-2 pin widget for output */ |
| 6463 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6464 | /* CD pin widget for input */ |
| 6465 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6466 | /* unmute amp left and right */ |
| 6467 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6468 | /* set connection select to line in (default select for this ADC) */ |
| 6469 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6470 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6471 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6472 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6473 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6474 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6475 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6476 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6477 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6478 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6479 | * Line In 2 = 0x03 |
| 6480 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6481 | /* mute analog inputs */ |
| 6482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6487 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6488 | /* Unmute Front out path */ |
| 6489 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6491 | /* Unmute Headphone out path */ |
| 6492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6493 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6494 | /* Unmute Mono out path */ |
| 6495 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6496 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6497 | { } |
| 6498 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6499 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6500 | |
| 6501 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6502 | /* Line out and output */ |
| 6503 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6504 | /* mono output */ |
| 6505 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6506 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6507 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6508 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6509 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6510 | /* Line In pin widget for input */ |
| 6511 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6512 | /* Headphone pin widget for output */ |
| 6513 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6514 | /* CD pin widget for input */ |
| 6515 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6516 | /* unmute amp left and right */ |
| 6517 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6518 | /* set connection select to line in (default select for this ADC) */ |
| 6519 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6520 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6521 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6522 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6523 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6524 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6525 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6526 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6527 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6528 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6529 | * Line In 2 = 0x03 |
| 6530 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6531 | /* mute analog inputs */ |
| 6532 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6533 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6534 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6535 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6536 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6537 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6538 | /* Unmute Front out path */ |
| 6539 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6540 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6541 | /* Unmute Headphone out path */ |
| 6542 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6543 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6544 | /* Unmute Mono out path */ |
| 6545 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6546 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6547 | { } |
| 6548 | }; |
| 6549 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6550 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6551 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6552 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6553 | */ |
| 6554 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6555 | /* Disable all GPIOs */ |
| 6556 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6557 | /* Internal speaker is connected to headphone pin */ |
| 6558 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6559 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6560 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6561 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6562 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6563 | /* Ensure all other unused pins are disabled and muted. */ |
| 6564 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6565 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6566 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6567 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6568 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6569 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6570 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6571 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6572 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6573 | /* Disable digital (SPDIF) pins */ |
| 6574 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6575 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6576 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6577 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6578 | * when acting as an output. |
| 6579 | */ |
| 6580 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6581 | |
| 6582 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6583 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6584 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6585 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6586 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6587 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6588 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6589 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6590 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6591 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6592 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6593 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6594 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6595 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6596 | * If the pin mode is changed by the user the pin mode control will |
| 6597 | * take care of enabling the pin's input/output buffers as needed. |
| 6598 | * Therefore there's no need to enable the input buffer at this |
| 6599 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6600 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6601 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6602 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6603 | * mixer ctrl) |
| 6604 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6605 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6606 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6607 | /* Mute capture amp left and right */ |
| 6608 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6609 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6610 | * in (on mic1 pin) |
| 6611 | */ |
| 6612 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6613 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6614 | /* Do the same for the second ADC: mute capture input amp and |
| 6615 | * set ADC connection to line in (on mic1 pin) |
| 6616 | */ |
| 6617 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6618 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6619 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6620 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6621 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6622 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6623 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6624 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6625 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6626 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6627 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6628 | {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] | 6629 | |
| 6630 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6631 | }; |
| 6632 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6633 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6634 | * similar laptops (adapted from Fujitsu init verbs). |
| 6635 | */ |
| 6636 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6637 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6638 | * the headphone jack. Turn this on and rely on the standard mute |
| 6639 | * methods whenever the user wants to turn these outputs off. |
| 6640 | */ |
| 6641 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6642 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6643 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6644 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6645 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6646 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6647 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6648 | /* Line In jack is connected to Line1 pin */ |
| 6649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6650 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6651 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6652 | /* Ensure all other unused pins are disabled and muted. */ |
| 6653 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6654 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6655 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6656 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6657 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6658 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6659 | /* Disable digital (SPDIF) pins */ |
| 6660 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6661 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6662 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6663 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6664 | * bus when acting as outputs. |
| 6665 | */ |
| 6666 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6667 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6668 | |
| 6669 | /* Start with output sum widgets muted and their output gains at min */ |
| 6670 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6671 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6672 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6673 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6674 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6675 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6676 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6677 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6678 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6679 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6680 | /* Unmute Line-out pin widget amp left and right |
| 6681 | * (no equiv mixer ctrl) |
| 6682 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6683 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6684 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6685 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6686 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6687 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6688 | * will take care of enabling the pin's input/output buffers as needed. |
| 6689 | * Therefore there's no need to enable the input buffer at this |
| 6690 | * stage. |
| 6691 | */ |
| 6692 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6693 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6694 | |
| 6695 | /* Mute capture amp left and right */ |
| 6696 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6697 | /* Set ADC connection select to match default mixer setting - mic |
| 6698 | * (on mic1 pin) |
| 6699 | */ |
| 6700 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6701 | |
| 6702 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6703 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6704 | */ |
| 6705 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6706 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6707 | |
| 6708 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6709 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6711 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6713 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6714 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6715 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6716 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6717 | |
| 6718 | { } |
| 6719 | }; |
| 6720 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6721 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6722 | * (adapted from Acer init verbs). |
| 6723 | */ |
| 6724 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6725 | /* GPIO 0 enables the output jack. |
| 6726 | * Turn this on and rely on the standard mute |
| 6727 | * methods whenever the user wants to turn these outputs off. |
| 6728 | */ |
| 6729 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6730 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6731 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6732 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6733 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6734 | /* Ensure all other unused pins are disabled and muted. */ |
| 6735 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6736 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6737 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6738 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6739 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6740 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6741 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6742 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6743 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6745 | /* Disable digital (SPDIF) pins */ |
| 6746 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6747 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6748 | |
| 6749 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6750 | * bus when acting as outputs. |
| 6751 | */ |
| 6752 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6753 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6754 | |
| 6755 | /* Start with output sum widgets muted and their output gains at min */ |
| 6756 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6757 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6758 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6759 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6760 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6761 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6762 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6763 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6764 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6765 | |
| 6766 | /* Unmute Line-out pin widget amp left and right |
| 6767 | * (no equiv mixer ctrl) |
| 6768 | */ |
| 6769 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6770 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6771 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6772 | * will take care of enabling the pin's input/output buffers as needed. |
| 6773 | * Therefore there's no need to enable the input buffer at this |
| 6774 | * stage. |
| 6775 | */ |
| 6776 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6777 | |
| 6778 | /* Mute capture amp left and right */ |
| 6779 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6780 | /* Set ADC connection select to match default mixer setting - mic |
| 6781 | * (on mic1 pin) |
| 6782 | */ |
| 6783 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6784 | |
| 6785 | /* Do similar with the second ADC: mute capture input amp and |
| 6786 | * set ADC connection to mic to match ALSA's default state. |
| 6787 | */ |
| 6788 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6789 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6790 | |
| 6791 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6792 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6794 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6795 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6796 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6797 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6798 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6799 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6800 | |
| 6801 | { } |
| 6802 | }; |
| 6803 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6804 | static struct hda_verb alc260_will_verbs[] = { |
| 6805 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6806 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6807 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6808 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6809 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6810 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6811 | {} |
| 6812 | }; |
| 6813 | |
| 6814 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6815 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6816 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6817 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6818 | |
| 6819 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6820 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6821 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6822 | |
| 6823 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6824 | {} |
| 6825 | }; |
| 6826 | |
| 6827 | /* toggle speaker-output according to the hp-jack state */ |
| 6828 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6829 | { |
| 6830 | unsigned int present; |
| 6831 | |
| 6832 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6833 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6834 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6835 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6836 | AC_VERB_SET_GPIO_DATA, 1); |
| 6837 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6838 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6839 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6840 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6841 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6842 | AC_VERB_SET_GPIO_DATA, 0); |
| 6843 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6844 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6845 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6846 | } |
| 6847 | } |
| 6848 | |
| 6849 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6850 | unsigned int res) |
| 6851 | { |
| 6852 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6853 | alc260_replacer_672v_automute(codec); |
| 6854 | } |
| 6855 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6856 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6857 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6858 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6859 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6860 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6861 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6862 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6863 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6864 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6865 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6866 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6867 | {} |
| 6868 | }; |
| 6869 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6870 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6871 | * configuration. |
| 6872 | */ |
| 6873 | #ifdef CONFIG_SND_DEBUG |
| 6874 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6875 | 0x02, |
| 6876 | }; |
| 6877 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6878 | 0x04, 0x05, |
| 6879 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6880 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6881 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6882 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6883 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6884 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6885 | { |
| 6886 | .num_items = 7, |
| 6887 | .items = { |
| 6888 | { "MIC1 pin", 0x0 }, |
| 6889 | { "MIC2 pin", 0x1 }, |
| 6890 | { "LINE1 pin", 0x2 }, |
| 6891 | { "LINE2 pin", 0x3 }, |
| 6892 | { "CD pin", 0x4 }, |
| 6893 | { "LINE-OUT pin", 0x5 }, |
| 6894 | { "HP-OUT pin", 0x6 }, |
| 6895 | }, |
| 6896 | }, |
| 6897 | { |
| 6898 | .num_items = 8, |
| 6899 | .items = { |
| 6900 | { "MIC1 pin", 0x0 }, |
| 6901 | { "MIC2 pin", 0x1 }, |
| 6902 | { "LINE1 pin", 0x2 }, |
| 6903 | { "LINE2 pin", 0x3 }, |
| 6904 | { "CD pin", 0x4 }, |
| 6905 | { "Mixer", 0x5 }, |
| 6906 | { "LINE-OUT pin", 0x6 }, |
| 6907 | { "HP-OUT pin", 0x7 }, |
| 6908 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6909 | }, |
| 6910 | }; |
| 6911 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6912 | /* Output driver widgets */ |
| 6913 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6914 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6915 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6916 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6917 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6918 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6919 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6920 | /* Modes for retasking pin widgets |
| 6921 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6922 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6923 | * mention this restriction. At this stage it's not clear whether |
| 6924 | * this behaviour is intentional or is a hardware bug in chip |
| 6925 | * revisions available at least up until early 2006. Therefore for |
| 6926 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6927 | * choices, but if it turns out that the lack of mic bias for these |
| 6928 | * NIDs is intentional we could change their modes from |
| 6929 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6930 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6931 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6932 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6933 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6934 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6935 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6936 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6937 | |
| 6938 | /* Loopback mixer controls */ |
| 6939 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6942 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6943 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6944 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6945 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6946 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6948 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6949 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6950 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6951 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6952 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6953 | |
| 6954 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6955 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6956 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6957 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6958 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6959 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6960 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6961 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6962 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6963 | */ |
| 6964 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6965 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6966 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6967 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6968 | * this output to turn on an external amplifier. |
| 6969 | */ |
| 6970 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6971 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6972 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6973 | { } /* end */ |
| 6974 | }; |
| 6975 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6976 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6977 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6978 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6979 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6980 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6981 | /* Enable retasking pins as output, initially without power amp */ |
| 6982 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6983 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6984 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6985 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6986 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6987 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6988 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6989 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6990 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6991 | * payload also sets the generation to 0, output to be in "consumer" |
| 6992 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6993 | * control. |
| 6994 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6995 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6996 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6997 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6998 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6999 | * OUT1 sum bus when acting as an output. |
| 7000 | */ |
| 7001 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7002 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7003 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7004 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7005 | |
| 7006 | /* Start with output sum widgets muted and their output gains at min */ |
| 7007 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7008 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7009 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7012 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7013 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7014 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7015 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7016 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 7017 | /* Unmute retasking pin widget output buffers since the default |
| 7018 | * state appears to be output. As the pin mode is changed by the |
| 7019 | * user the pin mode control will take care of enabling the pin's |
| 7020 | * input/output buffers as needed. |
| 7021 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7022 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7023 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7024 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7025 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7026 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7027 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7028 | /* Also unmute the mono-out pin widget */ |
| 7029 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7030 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7031 | /* Mute capture amp left and right */ |
| 7032 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 7033 | /* Set ADC connection select to match default mixer setting (mic1 |
| 7034 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7035 | */ |
| 7036 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7037 | |
| 7038 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 7039 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7040 | */ |
| 7041 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7042 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7043 | |
| 7044 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 7045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 7046 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 7047 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 7048 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 7049 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 7050 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 7051 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 7052 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 7053 | |
| 7054 | { } |
| 7055 | }; |
| 7056 | #endif |
| 7057 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7058 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 7059 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7060 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7061 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 7062 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 7063 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7064 | /* |
| 7065 | * for BIOS auto-configuration |
| 7066 | */ |
| 7067 | |
| 7068 | 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] | 7069 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7070 | { |
| 7071 | hda_nid_t nid_vol; |
| 7072 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7073 | int err; |
| 7074 | |
| 7075 | if (nid >= 0x0f && nid < 0x11) { |
| 7076 | nid_vol = nid - 0x7; |
| 7077 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 7078 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 7079 | } else if (nid == 0x11) { |
| 7080 | nid_vol = nid - 0x7; |
| 7081 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 7082 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 7083 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 7084 | nid_vol = 0x08; |
| 7085 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 7086 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 7087 | } else |
| 7088 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7089 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7090 | if (!(*vol_bits & (1 << nid_vol))) { |
| 7091 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7092 | 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] | 7093 | if (err < 0) |
| 7094 | return err; |
| 7095 | *vol_bits |= (1 << nid_vol); |
| 7096 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7097 | 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] | 7098 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7099 | return err; |
| 7100 | return 1; |
| 7101 | } |
| 7102 | |
| 7103 | /* add playback controls from the parsed DAC table */ |
| 7104 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7105 | const struct auto_pin_cfg *cfg) |
| 7106 | { |
| 7107 | hda_nid_t nid; |
| 7108 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7109 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7110 | |
| 7111 | spec->multiout.num_dacs = 1; |
| 7112 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7113 | spec->multiout.dac_nids[0] = 0x02; |
| 7114 | |
| 7115 | nid = cfg->line_out_pins[0]; |
| 7116 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 7117 | const char *pfx; |
| 7118 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 7119 | pfx = "Master"; |
| 7120 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 7121 | pfx = "Speaker"; |
| 7122 | else |
| 7123 | pfx = "Front"; |
| 7124 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7125 | if (err < 0) |
| 7126 | return err; |
| 7127 | } |
| 7128 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7129 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7130 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7131 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7132 | if (err < 0) |
| 7133 | return err; |
| 7134 | } |
| 7135 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7136 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7137 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7138 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 7139 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7140 | if (err < 0) |
| 7141 | return err; |
| 7142 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7143 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7144 | } |
| 7145 | |
| 7146 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7147 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7148 | const struct auto_pin_cfg *cfg) |
| 7149 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7150 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7151 | } |
| 7152 | |
| 7153 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7154 | hda_nid_t nid, int pin_type, |
| 7155 | int sel_idx) |
| 7156 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7157 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7158 | /* need the manual connection? */ |
| 7159 | if (nid >= 0x12) { |
| 7160 | int idx = nid - 0x12; |
| 7161 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7162 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7163 | } |
| 7164 | } |
| 7165 | |
| 7166 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7167 | { |
| 7168 | struct alc_spec *spec = codec->spec; |
| 7169 | hda_nid_t nid; |
| 7170 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7171 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7172 | if (nid) { |
| 7173 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7174 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7175 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7176 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7177 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7178 | if (nid) |
| 7179 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7180 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7181 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7182 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7183 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7184 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7185 | |
| 7186 | #define ALC260_PIN_CD_NID 0x16 |
| 7187 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 7188 | { |
| 7189 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7190 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | int i; |
| 7192 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7193 | for (i = 0; i < cfg->num_inputs; i++) { |
| 7194 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7195 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 7196 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 7197 | if (nid != ALC260_PIN_CD_NID && |
| 7198 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7199 | snd_hda_codec_write(codec, nid, 0, |
| 7200 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7201 | AMP_OUT_MUTE); |
| 7202 | } |
| 7203 | } |
| 7204 | } |
| 7205 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7206 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7207 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7208 | /* |
| 7209 | * generic initialization of ADC, input mixers and output mixers |
| 7210 | */ |
| 7211 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7212 | /* |
| 7213 | * Unmute ADC0-1 and set the default input to mic-in |
| 7214 | */ |
| 7215 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7216 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7217 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7218 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7219 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7220 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7221 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7222 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7223 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7224 | */ |
| 7225 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7226 | /* mute analog inputs */ |
| 7227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7231 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7232 | |
| 7233 | /* |
| 7234 | * Set up output mixers (0x08 - 0x0a) |
| 7235 | */ |
| 7236 | /* set vol=0 to output mixers */ |
| 7237 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7238 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7239 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7240 | /* set up input amps for analog loopback */ |
| 7241 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7243 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7245 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7246 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7247 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7249 | { } |
| 7250 | }; |
| 7251 | |
| 7252 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7253 | { |
| 7254 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7255 | int err; |
| 7256 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7257 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7258 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7259 | alc260_ignore); |
| 7260 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7261 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7262 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7263 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7264 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7265 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7266 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7267 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7268 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7269 | return err; |
| 7270 | |
| 7271 | spec->multiout.max_channels = 2; |
| 7272 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7273 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7274 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7275 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7276 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7277 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7278 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7279 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7280 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7281 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7282 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7283 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7284 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7285 | return 1; |
| 7286 | } |
| 7287 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7288 | /* additional initialization for auto-configuration model */ |
| 7289 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7290 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7291 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7292 | alc260_auto_init_multi_out(codec); |
| 7293 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7294 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7295 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7296 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7297 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7298 | } |
| 7299 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7300 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7301 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7302 | { 0x07, HDA_INPUT, 0 }, |
| 7303 | { 0x07, HDA_INPUT, 1 }, |
| 7304 | { 0x07, HDA_INPUT, 2 }, |
| 7305 | { 0x07, HDA_INPUT, 3 }, |
| 7306 | { 0x07, HDA_INPUT, 4 }, |
| 7307 | { } /* end */ |
| 7308 | }; |
| 7309 | #endif |
| 7310 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7311 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7312 | * Pin config fixes |
| 7313 | */ |
| 7314 | enum { |
| 7315 | PINFIX_HP_DC5750, |
| 7316 | }; |
| 7317 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7318 | static const struct alc_fixup alc260_fixups[] = { |
| 7319 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7320 | .type = ALC_FIXUP_PINS, |
| 7321 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7322 | { 0x11, 0x90130110 }, /* speaker */ |
| 7323 | { } |
| 7324 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7325 | }, |
| 7326 | }; |
| 7327 | |
| 7328 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7329 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7330 | {} |
| 7331 | }; |
| 7332 | |
| 7333 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7334 | * ALC260 configurations |
| 7335 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7336 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7337 | [ALC260_BASIC] = "basic", |
| 7338 | [ALC260_HP] = "hp", |
| 7339 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7340 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7341 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7342 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7343 | [ALC260_WILL] = "will", |
| 7344 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7345 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7346 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7347 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7348 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7349 | [ALC260_AUTO] = "auto", |
| 7350 | }; |
| 7351 | |
| 7352 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7353 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7354 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7355 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7356 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7357 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7358 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7359 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7360 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7361 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7362 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7363 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7364 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7365 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7366 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7367 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7368 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7369 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7370 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7371 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7372 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7373 | {} |
| 7374 | }; |
| 7375 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7376 | static struct alc_config_preset alc260_presets[] = { |
| 7377 | [ALC260_BASIC] = { |
| 7378 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7379 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7380 | .init_verbs = { alc260_init_verbs }, |
| 7381 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7382 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7383 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7384 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7385 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7386 | .channel_mode = alc260_modes, |
| 7387 | .input_mux = &alc260_capture_source, |
| 7388 | }, |
| 7389 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7390 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7391 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7392 | .init_verbs = { alc260_init_verbs, |
| 7393 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7394 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7395 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7396 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7397 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7398 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7399 | .channel_mode = alc260_modes, |
| 7400 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7401 | .unsol_event = alc_sku_unsol_event, |
| 7402 | .setup = alc260_hp_setup, |
| 7403 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7404 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7405 | [ALC260_HP_DC7600] = { |
| 7406 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7407 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7408 | .init_verbs = { alc260_init_verbs, |
| 7409 | alc260_hp_dc7600_verbs }, |
| 7410 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7411 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7412 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7413 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7414 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7415 | .channel_mode = alc260_modes, |
| 7416 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7417 | .unsol_event = alc_sku_unsol_event, |
| 7418 | .setup = alc260_hp_3012_setup, |
| 7419 | .init_hook = alc_inithook, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7420 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7421 | [ALC260_HP_3013] = { |
| 7422 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7423 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7424 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7425 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7426 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7427 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7428 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7429 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7430 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7431 | .channel_mode = alc260_modes, |
| 7432 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7433 | .unsol_event = alc_sku_unsol_event, |
| 7434 | .setup = alc260_hp_3013_setup, |
| 7435 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7436 | }, |
| 7437 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7438 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7439 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7440 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7441 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7442 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7443 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7444 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7445 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7446 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7447 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7448 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7449 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7450 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7451 | .init_verbs = { alc260_acer_init_verbs }, |
| 7452 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7453 | .dac_nids = alc260_dac_nids, |
| 7454 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7455 | .adc_nids = alc260_dual_adc_nids, |
| 7456 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7457 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7458 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7459 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7460 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7461 | [ALC260_FAVORIT100] = { |
| 7462 | .mixers = { alc260_favorit100_mixer }, |
| 7463 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7464 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7465 | .dac_nids = alc260_dac_nids, |
| 7466 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7467 | .adc_nids = alc260_dual_adc_nids, |
| 7468 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7469 | .channel_mode = alc260_modes, |
| 7470 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7471 | .input_mux = alc260_favorit100_capture_sources, |
| 7472 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7473 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7474 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7475 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7476 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7477 | .dac_nids = alc260_dac_nids, |
| 7478 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7479 | .adc_nids = alc260_adc_nids, |
| 7480 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7481 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7482 | .channel_mode = alc260_modes, |
| 7483 | .input_mux = &alc260_capture_source, |
| 7484 | }, |
| 7485 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7486 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7487 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7488 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7489 | .dac_nids = alc260_dac_nids, |
| 7490 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7491 | .adc_nids = alc260_adc_nids, |
| 7492 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7493 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7494 | .channel_mode = alc260_modes, |
| 7495 | .input_mux = &alc260_capture_source, |
| 7496 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7497 | .init_hook = alc260_replacer_672v_automute, |
| 7498 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7499 | #ifdef CONFIG_SND_DEBUG |
| 7500 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7501 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7502 | .init_verbs = { alc260_test_init_verbs }, |
| 7503 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7504 | .dac_nids = alc260_test_dac_nids, |
| 7505 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7506 | .adc_nids = alc260_test_adc_nids, |
| 7507 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7508 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7509 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7510 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7511 | }, |
| 7512 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7513 | }; |
| 7514 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7515 | static int patch_alc260(struct hda_codec *codec) |
| 7516 | { |
| 7517 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7518 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7519 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7520 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7521 | if (spec == NULL) |
| 7522 | return -ENOMEM; |
| 7523 | |
| 7524 | codec->spec = spec; |
| 7525 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7526 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7527 | alc260_models, |
| 7528 | alc260_cfg_tbl); |
| 7529 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7530 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7531 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7532 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7533 | } |
| 7534 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7535 | if (board_config == ALC260_AUTO) { |
| 7536 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7537 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7538 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7539 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7540 | if (board_config == ALC260_AUTO) { |
| 7541 | /* automatic parse from the BIOS config */ |
| 7542 | err = alc260_parse_auto_config(codec); |
| 7543 | if (err < 0) { |
| 7544 | alc_free(codec); |
| 7545 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7546 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7547 | printk(KERN_INFO |
| 7548 | "hda_codec: Cannot set up configuration " |
| 7549 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7550 | board_config = ALC260_BASIC; |
| 7551 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7552 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7553 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7554 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7555 | if (err < 0) { |
| 7556 | alc_free(codec); |
| 7557 | return err; |
| 7558 | } |
| 7559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7560 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7561 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7562 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7563 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7564 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7565 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7566 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7567 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7568 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7569 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7570 | if (!spec->adc_nids && spec->input_mux) { |
| 7571 | /* check whether NID 0x04 is valid */ |
| 7572 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7573 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7574 | /* get type */ |
| 7575 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7576 | spec->adc_nids = alc260_adc_nids_alt; |
| 7577 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7578 | } else { |
| 7579 | spec->adc_nids = alc260_adc_nids; |
| 7580 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7581 | } |
| 7582 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7583 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7584 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7585 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7586 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7587 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7588 | spec->vmaster_nid = 0x08; |
| 7589 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7590 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7591 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7592 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 7593 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7594 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7595 | if (!spec->loopback.amplist) |
| 7596 | spec->loopback.amplist = alc260_loopbacks; |
| 7597 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7598 | |
| 7599 | return 0; |
| 7600 | } |
| 7601 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7602 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7603 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7604 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7605 | * |
| 7606 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7607 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7608 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7609 | * 6-channel independent captures. |
| 7610 | * |
| 7611 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7612 | * driver yet). |
| 7613 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7614 | #define ALC882_DIGOUT_NID 0x06 |
| 7615 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7616 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7617 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7618 | #define ALC1200_DIGOUT_NID 0x10 |
| 7619 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7620 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7621 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7622 | { 8, NULL } |
| 7623 | }; |
| 7624 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7625 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7626 | static hda_nid_t alc882_dac_nids[4] = { |
| 7627 | /* front, rear, clfe, rear_surr */ |
| 7628 | 0x02, 0x03, 0x04, 0x05 |
| 7629 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7630 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7631 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7632 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7633 | #define alc882_adc_nids alc880_adc_nids |
| 7634 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7635 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7636 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7637 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7638 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7639 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7640 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7641 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7642 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7643 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7644 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7645 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7646 | /* input MUX */ |
| 7647 | /* FIXME: should be a matrix-type input source selection */ |
| 7648 | |
| 7649 | static struct hda_input_mux alc882_capture_source = { |
| 7650 | .num_items = 4, |
| 7651 | .items = { |
| 7652 | { "Mic", 0x0 }, |
| 7653 | { "Front Mic", 0x1 }, |
| 7654 | { "Line", 0x2 }, |
| 7655 | { "CD", 0x4 }, |
| 7656 | }, |
| 7657 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7658 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7659 | #define alc883_capture_source alc882_capture_source |
| 7660 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7661 | static struct hda_input_mux alc889_capture_source = { |
| 7662 | .num_items = 3, |
| 7663 | .items = { |
| 7664 | { "Front Mic", 0x0 }, |
| 7665 | { "Mic", 0x3 }, |
| 7666 | { "Line", 0x2 }, |
| 7667 | }, |
| 7668 | }; |
| 7669 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7670 | static struct hda_input_mux mb5_capture_source = { |
| 7671 | .num_items = 3, |
| 7672 | .items = { |
| 7673 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7674 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7675 | { "CD", 0x4 }, |
| 7676 | }, |
| 7677 | }; |
| 7678 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7679 | static struct hda_input_mux macmini3_capture_source = { |
| 7680 | .num_items = 2, |
| 7681 | .items = { |
| 7682 | { "Line", 0x2 }, |
| 7683 | { "CD", 0x4 }, |
| 7684 | }, |
| 7685 | }; |
| 7686 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7687 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7688 | .num_items = 4, |
| 7689 | .items = { |
| 7690 | { "Mic", 0x1 }, |
| 7691 | { "Front Mic", 0x0 }, |
| 7692 | { "Line", 0x2 }, |
| 7693 | { "CD", 0x4 }, |
| 7694 | }, |
| 7695 | }; |
| 7696 | |
| 7697 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7698 | .num_items = 2, |
| 7699 | .items = { |
| 7700 | { "Mic", 0x1 }, |
| 7701 | { "Line", 0x2 }, |
| 7702 | }, |
| 7703 | }; |
| 7704 | |
| 7705 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7706 | .num_items = 4, |
| 7707 | .items = { |
| 7708 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7709 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7710 | { "Line", 0x2 }, |
| 7711 | { "CD", 0x4 }, |
| 7712 | }, |
| 7713 | }; |
| 7714 | |
| 7715 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7716 | .num_items = 2, |
| 7717 | .items = { |
| 7718 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7719 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7720 | }, |
| 7721 | }; |
| 7722 | |
| 7723 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7724 | .num_items = 3, |
| 7725 | .items = { |
| 7726 | { "Mic", 0x0 }, |
| 7727 | { "Front Mic", 0x1 }, |
| 7728 | { "Line", 0x4 }, |
| 7729 | }, |
| 7730 | }; |
| 7731 | |
| 7732 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7733 | .num_items = 2, |
| 7734 | .items = { |
| 7735 | { "Mic", 0x0 }, |
| 7736 | { "Line", 0x2 }, |
| 7737 | }, |
| 7738 | }; |
| 7739 | |
| 7740 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7741 | .num_items = 2, |
| 7742 | .items = { |
| 7743 | { "Mic", 0x0 }, |
| 7744 | /* Front Mic (0x01) unused */ |
| 7745 | { "Line", 0x2 }, |
| 7746 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7747 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7748 | }, |
| 7749 | }; |
| 7750 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7751 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7752 | .num_items = 2, |
| 7753 | .items = { |
| 7754 | { "Mic", 0x01 }, |
| 7755 | { "Line", 0x2 }, /* Not sure! */ |
| 7756 | }, |
| 7757 | }; |
| 7758 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7759 | /* |
| 7760 | * 2ch mode |
| 7761 | */ |
| 7762 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7763 | { 2, NULL } |
| 7764 | }; |
| 7765 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7766 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7767 | * 2ch mode |
| 7768 | */ |
| 7769 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7770 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7771 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7772 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7773 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7774 | { } /* end */ |
| 7775 | }; |
| 7776 | |
| 7777 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7778 | * 4ch mode |
| 7779 | */ |
| 7780 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7781 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7782 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7783 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7784 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7785 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7786 | { } /* end */ |
| 7787 | }; |
| 7788 | |
| 7789 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7790 | * 6ch mode |
| 7791 | */ |
| 7792 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7793 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7794 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7795 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7796 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7797 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7798 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7799 | { } /* end */ |
| 7800 | }; |
| 7801 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7802 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7803 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7804 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7805 | { 6, alc882_3ST_ch6_init }, |
| 7806 | }; |
| 7807 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7808 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7809 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7810 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7811 | * 2ch mode |
| 7812 | */ |
| 7813 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7814 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7815 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7816 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7817 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7818 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7819 | { } /* end */ |
| 7820 | }; |
| 7821 | |
| 7822 | /* |
| 7823 | * 4ch mode |
| 7824 | */ |
| 7825 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7826 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7827 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7828 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7829 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7830 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7831 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7832 | { } /* end */ |
| 7833 | }; |
| 7834 | |
| 7835 | /* |
| 7836 | * 6ch mode |
| 7837 | */ |
| 7838 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7839 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7840 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7841 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7842 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7843 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7844 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7845 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7846 | { } /* end */ |
| 7847 | }; |
| 7848 | |
| 7849 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7850 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7851 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7852 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7853 | }; |
| 7854 | |
| 7855 | |
| 7856 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7857 | * 6ch mode |
| 7858 | */ |
| 7859 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7860 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7861 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7862 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7863 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7864 | { } /* end */ |
| 7865 | }; |
| 7866 | |
| 7867 | /* |
| 7868 | * 8ch mode |
| 7869 | */ |
| 7870 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7871 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7872 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7873 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7874 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7875 | { } /* end */ |
| 7876 | }; |
| 7877 | |
| 7878 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7879 | { 6, alc882_sixstack_ch6_init }, |
| 7880 | { 8, alc882_sixstack_ch8_init }, |
| 7881 | }; |
| 7882 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7883 | |
| 7884 | /* Macbook Air 2,1 */ |
| 7885 | |
| 7886 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7887 | { 2, NULL }, |
| 7888 | }; |
| 7889 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7890 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7891 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7892 | */ |
| 7893 | |
| 7894 | /* |
| 7895 | * 2ch mode |
| 7896 | */ |
| 7897 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7898 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7899 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7900 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7901 | { } /* end */ |
| 7902 | }; |
| 7903 | |
| 7904 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7905 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7906 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7907 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7908 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7909 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7910 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7911 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7912 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7913 | { } /* end */ |
| 7914 | }; |
| 7915 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7916 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7917 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7918 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7919 | }; |
| 7920 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7921 | /* |
| 7922 | * 2ch |
| 7923 | * Speakers/Woofer/HP = Front |
| 7924 | * LineIn = Input |
| 7925 | */ |
| 7926 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7929 | { } /* end */ |
| 7930 | }; |
| 7931 | |
| 7932 | /* |
| 7933 | * 6ch mode |
| 7934 | * Speakers/HP = Front |
| 7935 | * Woofer = LFE |
| 7936 | * LineIn = Surround |
| 7937 | */ |
| 7938 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7941 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7942 | { } /* end */ |
| 7943 | }; |
| 7944 | |
| 7945 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7946 | { 2, alc885_mb5_ch2_init }, |
| 7947 | { 6, alc885_mb5_ch6_init }, |
| 7948 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7949 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7950 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7951 | |
| 7952 | /* |
| 7953 | * 2ch mode |
| 7954 | */ |
| 7955 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7956 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7957 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7958 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7959 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7960 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7961 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7962 | { } /* end */ |
| 7963 | }; |
| 7964 | |
| 7965 | /* |
| 7966 | * 4ch mode |
| 7967 | */ |
| 7968 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7969 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7970 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7971 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7972 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7973 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7974 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7975 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7976 | { } /* end */ |
| 7977 | }; |
| 7978 | |
| 7979 | /* |
| 7980 | * 6ch mode |
| 7981 | */ |
| 7982 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7983 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7984 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7985 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7986 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7987 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7988 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7989 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7990 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7991 | { } /* end */ |
| 7992 | }; |
| 7993 | |
| 7994 | /* |
| 7995 | * 8ch mode |
| 7996 | */ |
| 7997 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7998 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7999 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8000 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8001 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8002 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8003 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8004 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8005 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8006 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8007 | { } /* end */ |
| 8008 | }; |
| 8009 | |
| 8010 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 8011 | { 2, alc883_4ST_ch2_init }, |
| 8012 | { 4, alc883_4ST_ch4_init }, |
| 8013 | { 6, alc883_4ST_ch6_init }, |
| 8014 | { 8, alc883_4ST_ch8_init }, |
| 8015 | }; |
| 8016 | |
| 8017 | |
| 8018 | /* |
| 8019 | * 2ch mode |
| 8020 | */ |
| 8021 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 8022 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8023 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8026 | { } /* end */ |
| 8027 | }; |
| 8028 | |
| 8029 | /* |
| 8030 | * 4ch mode |
| 8031 | */ |
| 8032 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 8033 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8034 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8035 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8036 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8037 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8038 | { } /* end */ |
| 8039 | }; |
| 8040 | |
| 8041 | /* |
| 8042 | * 6ch mode |
| 8043 | */ |
| 8044 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 8045 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8046 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8047 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8048 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8049 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8050 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8051 | { } /* end */ |
| 8052 | }; |
| 8053 | |
| 8054 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 8055 | { 2, alc883_3ST_ch2_intel_init }, |
| 8056 | { 4, alc883_3ST_ch4_intel_init }, |
| 8057 | { 6, alc883_3ST_ch6_intel_init }, |
| 8058 | }; |
| 8059 | |
| 8060 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8061 | * 2ch mode |
| 8062 | */ |
| 8063 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 8064 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8065 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8066 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8067 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8068 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8069 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8070 | { } /* end */ |
| 8071 | }; |
| 8072 | |
| 8073 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8074 | * 6ch mode |
| 8075 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8076 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8077 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8078 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8079 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8080 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8081 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8082 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8083 | { } /* end */ |
| 8084 | }; |
| 8085 | |
| 8086 | /* |
| 8087 | * 8ch mode |
| 8088 | */ |
| 8089 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8090 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8091 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8092 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8093 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8094 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8095 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8096 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8097 | { } /* end */ |
| 8098 | }; |
| 8099 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8100 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 8101 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8102 | { 6, alc889_ch6_intel_init }, |
| 8103 | { 8, alc889_ch8_intel_init }, |
| 8104 | }; |
| 8105 | |
| 8106 | /* |
| 8107 | * 6ch mode |
| 8108 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8109 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 8110 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8111 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8112 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8113 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8114 | { } /* end */ |
| 8115 | }; |
| 8116 | |
| 8117 | /* |
| 8118 | * 8ch mode |
| 8119 | */ |
| 8120 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 8121 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8122 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8123 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8124 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8125 | { } /* end */ |
| 8126 | }; |
| 8127 | |
| 8128 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 8129 | { 6, alc883_sixstack_ch6_init }, |
| 8130 | { 8, alc883_sixstack_ch8_init }, |
| 8131 | }; |
| 8132 | |
| 8133 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8134 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 8135 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 8136 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 8137 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8138 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8139 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8140 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8141 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8142 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8143 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8144 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8145 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8146 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8147 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8148 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8149 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8150 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8151 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8152 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8153 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8154 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8156 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8157 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8158 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8159 | { } /* end */ |
| 8160 | }; |
| 8161 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8162 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8163 | |
| 8164 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 8165 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8166 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8167 | { } |
| 8168 | }; |
| 8169 | |
| 8170 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8171 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8172 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8173 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8174 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8175 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8176 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8177 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8178 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8180 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8181 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8182 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8183 | { } /* end */ |
| 8184 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8185 | |
| 8186 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8187 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8188 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8189 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8190 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8191 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8192 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8193 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8194 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8196 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8198 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8199 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8200 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8201 | { } /* end */ |
| 8202 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8203 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8204 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 8205 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8206 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8207 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8208 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8209 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8210 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8211 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8212 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8214 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8215 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8216 | { } /* end */ |
| 8217 | }; |
| 8218 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8219 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8220 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8221 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8222 | { } /* end */ |
| 8223 | }; |
| 8224 | |
| 8225 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8226 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8227 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8228 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8229 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8230 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8231 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8232 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8233 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8234 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8236 | { } /* end */ |
| 8237 | }; |
| 8238 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8239 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8240 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8241 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8242 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8243 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8244 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8245 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8246 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8247 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8249 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8250 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8251 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8252 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8253 | { } /* end */ |
| 8254 | }; |
| 8255 | |
| 8256 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8257 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8258 | */ |
| 8259 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8260 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8261 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8262 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8263 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8265 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8266 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8267 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8268 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8269 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8270 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8271 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8272 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8273 | { } /* end */ |
| 8274 | }; |
| 8275 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8276 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8277 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8278 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8279 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8280 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8281 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8282 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8283 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8284 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8285 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8286 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8287 | { } /* end */ |
| 8288 | }; |
| 8289 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8290 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8291 | { |
| 8292 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8293 | .name = "Channel Mode", |
| 8294 | .info = alc_ch_mode_info, |
| 8295 | .get = alc_ch_mode_get, |
| 8296 | .put = alc_ch_mode_put, |
| 8297 | }, |
| 8298 | { } /* end */ |
| 8299 | }; |
| 8300 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8301 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8302 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8303 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8304 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8305 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8306 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8307 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8308 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8309 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8311 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8312 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8313 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8314 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8315 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8316 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8317 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8318 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8319 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8321 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8323 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8324 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8325 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8326 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8327 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8328 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8329 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8330 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8331 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8332 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8333 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8334 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8335 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8336 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8337 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8338 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8339 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8340 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8341 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8342 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8343 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8344 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8345 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8346 | |
| 8347 | /* FIXME: use matrix-type input source selection */ |
| 8348 | /* 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] | 8349 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8350 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8351 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8352 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8353 | /* ADC2: mute amp left and right */ |
| 8354 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8355 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8356 | /* ADC3: mute amp left and right */ |
| 8357 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8358 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8359 | |
| 8360 | { } |
| 8361 | }; |
| 8362 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8363 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8364 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8365 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8366 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8367 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8368 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8369 | /* ADC1: mute amp left and right */ |
| 8370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8371 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8372 | { } |
| 8373 | }; |
| 8374 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8375 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8376 | /* change to EAPD mode */ |
| 8377 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8378 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8379 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8380 | }; |
| 8381 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8382 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8383 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8384 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8385 | { } |
| 8386 | }; |
| 8387 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8388 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8389 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8390 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8391 | {} |
| 8392 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8393 | |
| 8394 | static struct hda_verb alc885_init_verbs[] = { |
| 8395 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8398 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8400 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8401 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8402 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8403 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8404 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8405 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8406 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8407 | |
| 8408 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8410 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8411 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8412 | /* Front Pin: output 0 (0x0c) */ |
| 8413 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8414 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8415 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8416 | /* Rear Pin: output 1 (0x0d) */ |
| 8417 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8418 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8419 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8420 | /* CLFE Pin: output 2 (0x0e) */ |
| 8421 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8422 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8423 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8424 | /* Side Pin: output 3 (0x0f) */ |
| 8425 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8426 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8427 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8428 | /* Mic (rear) pin: input vref at 80% */ |
| 8429 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8430 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8431 | /* Front Mic pin: input vref at 80% */ |
| 8432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8433 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8434 | /* Line In pin: input */ |
| 8435 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8436 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8437 | |
| 8438 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8439 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8441 | /* Input mixer2 */ |
| 8442 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8443 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8444 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8445 | /* ADC2: mute amp left and right */ |
| 8446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8447 | /* ADC3: mute amp left and right */ |
| 8448 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8449 | |
| 8450 | { } |
| 8451 | }; |
| 8452 | |
| 8453 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8454 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8455 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8457 | { } |
| 8458 | }; |
| 8459 | |
| 8460 | |
| 8461 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8462 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8463 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8464 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8465 | { } |
| 8466 | }; |
| 8467 | |
| 8468 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8469 | #define alc883_init_verbs alc882_base_init_verbs |
| 8470 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8471 | /* Mac Pro test */ |
| 8472 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8473 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8474 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8475 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8476 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8477 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8478 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8479 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8480 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8481 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8482 | { } /* end */ |
| 8483 | }; |
| 8484 | |
| 8485 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8486 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8487 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8489 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8490 | /* Front Pin: output 0 (0x0c) */ |
| 8491 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8493 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8494 | /* Front Mic pin: input vref at 80% */ |
| 8495 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8496 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8497 | /* Speaker: output */ |
| 8498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8499 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8500 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8501 | /* Headphone output (output 0 - 0x0c) */ |
| 8502 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8503 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8504 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8505 | |
| 8506 | /* FIXME: use matrix-type input source selection */ |
| 8507 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8508 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8509 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8510 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8511 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8512 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8513 | /* Input mixer2 */ |
| 8514 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8515 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8516 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8517 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8518 | /* Input mixer3 */ |
| 8519 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8520 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8521 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8522 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8523 | /* ADC1: mute amp left and right */ |
| 8524 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8525 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8526 | /* ADC2: mute amp left and right */ |
| 8527 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8528 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8529 | /* ADC3: mute amp left and right */ |
| 8530 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8531 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8532 | |
| 8533 | { } |
| 8534 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8535 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8536 | /* Macbook 5,1 */ |
| 8537 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8538 | /* DACs */ |
| 8539 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8540 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8541 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8542 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8543 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8544 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8545 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8547 | /* Surround mixer */ |
| 8548 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8549 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8550 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8551 | /* LFE mixer */ |
| 8552 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8553 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8554 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8555 | /* HP mixer */ |
| 8556 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8557 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8558 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8559 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8560 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8561 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8562 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8563 | /* LFE Pin (0x0e) */ |
| 8564 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8565 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8566 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8567 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8568 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8569 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8570 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8571 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8572 | /* Front Mic pin: input vref at 80% */ |
| 8573 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8574 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8575 | /* Line In pin */ |
| 8576 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8577 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8578 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8579 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8580 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8581 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8582 | { } |
| 8583 | }; |
| 8584 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8585 | /* Macmini 3,1 */ |
| 8586 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8587 | /* DACs */ |
| 8588 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8589 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8590 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8591 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8592 | /* Front mixer */ |
| 8593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8595 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8596 | /* Surround mixer */ |
| 8597 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8598 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8600 | /* LFE mixer */ |
| 8601 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8603 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8604 | /* HP mixer */ |
| 8605 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8606 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8607 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8608 | /* Front Pin (0x0c) */ |
| 8609 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8610 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8611 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8612 | /* LFE Pin (0x0e) */ |
| 8613 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8614 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8615 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8616 | /* HP Pin (0x0f) */ |
| 8617 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8618 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8619 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8620 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8621 | /* Line In pin */ |
| 8622 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8624 | |
| 8625 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8626 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8627 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8629 | { } |
| 8630 | }; |
| 8631 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8632 | |
| 8633 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8634 | /*Internal and HP Speaker Mixer*/ |
| 8635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8636 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8637 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8638 | /*Internal Speaker Pin (0x0c)*/ |
| 8639 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8640 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8641 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8642 | /* HP Pin: output 0 (0x0e) */ |
| 8643 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8644 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8645 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8646 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8647 | /* Line in (is hp when jack connected)*/ |
| 8648 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8649 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8650 | |
| 8651 | { } |
| 8652 | }; |
| 8653 | |
| 8654 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8655 | /* Macbook Pro rev3 */ |
| 8656 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8657 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8658 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8659 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8660 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8661 | /* Rear mixer */ |
| 8662 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8663 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8664 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8665 | /* HP mixer */ |
| 8666 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8667 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8668 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8669 | /* Front Pin: output 0 (0x0c) */ |
| 8670 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8671 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8672 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8673 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8674 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8675 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8676 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8677 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8678 | /* Mic (rear) pin: input vref at 80% */ |
| 8679 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8680 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8681 | /* Front Mic pin: input vref at 80% */ |
| 8682 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8683 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8684 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8685 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8686 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8687 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8688 | |
| 8689 | /* FIXME: use matrix-type input source selection */ |
| 8690 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8691 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8692 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8693 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8694 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8695 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8696 | /* Input mixer2 */ |
| 8697 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8698 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8699 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8700 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8701 | /* Input mixer3 */ |
| 8702 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8703 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8704 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8705 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8706 | /* ADC1: mute amp left and right */ |
| 8707 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8708 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8709 | /* ADC2: mute amp left and right */ |
| 8710 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8711 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8712 | /* ADC3: mute amp left and right */ |
| 8713 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8714 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8715 | |
| 8716 | { } |
| 8717 | }; |
| 8718 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8719 | /* iMac 9,1 */ |
| 8720 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8721 | /* Internal Speaker Pin (0x0c) */ |
| 8722 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8723 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8724 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8725 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8726 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8727 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8728 | /* HP Pin: Rear */ |
| 8729 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8730 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8731 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8732 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8733 | /* Line in Rear */ |
| 8734 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8735 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8736 | /* Front Mic pin: input vref at 80% */ |
| 8737 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8738 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8739 | /* Rear mixer */ |
| 8740 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8741 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8742 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8743 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8747 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8752 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8753 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8754 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8755 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8756 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8757 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8758 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8762 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8763 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8764 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8765 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8766 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8767 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8768 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8769 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8770 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8771 | { } |
| 8772 | }; |
| 8773 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8774 | /* iMac 24 mixer. */ |
| 8775 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8776 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8777 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8778 | { } /* end */ |
| 8779 | }; |
| 8780 | |
| 8781 | /* iMac 24 init verbs. */ |
| 8782 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8783 | /* Internal speakers: output 0 (0x0c) */ |
| 8784 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8785 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8786 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8787 | /* Internal speakers: output 0 (0x0c) */ |
| 8788 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8789 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8790 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8791 | /* Headphone: output 0 (0x0c) */ |
| 8792 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8793 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8794 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8795 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8796 | /* Front Mic: input vref at 80% */ |
| 8797 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8798 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8799 | { } |
| 8800 | }; |
| 8801 | |
| 8802 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8803 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8804 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8805 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8806 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8807 | spec->autocfg.hp_pins[0] = 0x14; |
| 8808 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8809 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8810 | spec->automute = 1; |
| 8811 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8812 | } |
| 8813 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8814 | #define alc885_mb5_setup alc885_imac24_setup |
| 8815 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8816 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8817 | /* Macbook Air 2,1 */ |
| 8818 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8819 | { |
| 8820 | struct alc_spec *spec = codec->spec; |
| 8821 | |
| 8822 | spec->autocfg.hp_pins[0] = 0x14; |
| 8823 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8824 | spec->automute = 1; |
| 8825 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8826 | } |
| 8827 | |
| 8828 | |
| 8829 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8830 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8831 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8832 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8833 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8834 | spec->autocfg.hp_pins[0] = 0x15; |
| 8835 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8836 | spec->automute = 1; |
| 8837 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8838 | } |
| 8839 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8840 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8841 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8842 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8843 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8844 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8845 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8846 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8847 | spec->automute = 1; |
| 8848 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8849 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8850 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8851 | static struct hda_verb alc882_targa_verbs[] = { |
| 8852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8854 | |
| 8855 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8856 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8857 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8858 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8859 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8860 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8861 | |
| 8862 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8863 | { } /* end */ |
| 8864 | }; |
| 8865 | |
| 8866 | /* toggle speaker-output according to the hp-jack state */ |
| 8867 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8868 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8869 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8870 | alc_hp_automute(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8871 | 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] | 8872 | spec->jack_present ? 1 : 3); |
| 8873 | } |
| 8874 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8875 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8876 | { |
| 8877 | struct alc_spec *spec = codec->spec; |
| 8878 | |
| 8879 | spec->autocfg.hp_pins[0] = 0x14; |
| 8880 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8881 | spec->automute = 1; |
| 8882 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8883 | } |
| 8884 | |
| 8885 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8886 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8887 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8888 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8889 | } |
| 8890 | |
| 8891 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8893 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8894 | |
| 8895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8896 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8897 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8898 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8899 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8900 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8901 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8902 | |
| 8903 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8904 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8905 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8906 | { } /* end */ |
| 8907 | }; |
| 8908 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8909 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8910 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8912 | |
| 8913 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8914 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8915 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8916 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8917 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8918 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8919 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8920 | |
| 8921 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8922 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8923 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8924 | { } /* end */ |
| 8925 | }; |
| 8926 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8927 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8928 | { |
| 8929 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8930 | |
| 8931 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8932 | AC_VERB_GET_GPIO_DATA, 0); |
| 8933 | |
| 8934 | if (!muted) |
| 8935 | gpiostate |= (1 << pin); |
| 8936 | else |
| 8937 | gpiostate &= ~(1 << pin); |
| 8938 | |
| 8939 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8940 | AC_VERB_GET_GPIO_MASK, 0); |
| 8941 | gpiomask |= (1 << pin); |
| 8942 | |
| 8943 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8944 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8945 | gpiodir |= (1 << pin); |
| 8946 | |
| 8947 | |
| 8948 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8949 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8950 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8951 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8952 | |
| 8953 | msleep(1); |
| 8954 | |
| 8955 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8956 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8957 | } |
| 8958 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8959 | /* set up GPIO at initialization */ |
| 8960 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8961 | { |
| 8962 | alc882_gpio_mute(codec, 0, 0); |
| 8963 | alc882_gpio_mute(codec, 1, 0); |
| 8964 | } |
| 8965 | |
| 8966 | /* set up GPIO and update auto-muting at initialization */ |
| 8967 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8968 | { |
| 8969 | alc885_macpro_init_hook(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8970 | alc_hp_automute(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8971 | } |
| 8972 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8973 | /* |
| 8974 | * generic initialization of ADC, input mixers and output mixers |
| 8975 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8976 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8977 | /* |
| 8978 | * Unmute ADC0-2 and set the default input to mic-in |
| 8979 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8980 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8981 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8982 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8983 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8984 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8985 | /* |
| 8986 | * Set up output mixers (0x0c - 0x0f) |
| 8987 | */ |
| 8988 | /* set vol=0 to output mixers */ |
| 8989 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8990 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8991 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8992 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8993 | /* set up input amps for analog loopback */ |
| 8994 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8995 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8996 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8997 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8998 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8999 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9000 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9001 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9002 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9003 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9004 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9005 | |
| 9006 | /* FIXME: use matrix-type input source selection */ |
| 9007 | /* 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] | 9008 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 9009 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9010 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 9011 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9012 | { } |
| 9013 | }; |
| 9014 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9015 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 9016 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 9017 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 9018 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9019 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 9020 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 9021 | { } /* end */ |
| 9022 | }; |
| 9023 | |
| 9024 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 9025 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 9026 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 9027 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9028 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 9029 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 9030 | { } /* end */ |
| 9031 | }; |
| 9032 | |
| 9033 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 9034 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 9035 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 9036 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9037 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 9038 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 9039 | { } /* end */ |
| 9040 | }; |
| 9041 | |
| 9042 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 9043 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 9044 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 9045 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 9046 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 9047 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 9048 | { } /* end */ |
| 9049 | }; |
| 9050 | |
| 9051 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 9052 | { 2, alc889A_mb31_ch2_init }, |
| 9053 | { 4, alc889A_mb31_ch4_init }, |
| 9054 | { 5, alc889A_mb31_ch5_init }, |
| 9055 | { 6, alc889A_mb31_ch6_init }, |
| 9056 | }; |
| 9057 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9058 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 9059 | /* eanable EAPD on medion laptop */ |
| 9060 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9061 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9062 | { } |
| 9063 | }; |
| 9064 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9065 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9066 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9067 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 9068 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9069 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9070 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9071 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9072 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9073 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9074 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9075 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9076 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9077 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9078 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9079 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9080 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9081 | { } /* end */ |
| 9082 | }; |
| 9083 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9084 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9085 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9086 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9087 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9088 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9089 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9090 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9091 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9092 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9093 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9094 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9095 | { } /* end */ |
| 9096 | }; |
| 9097 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9098 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 9099 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9100 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9101 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9102 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9103 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9104 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9106 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9107 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9108 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9109 | { } /* end */ |
| 9110 | }; |
| 9111 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9112 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 9113 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9114 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9115 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9116 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9117 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9118 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9119 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9120 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9121 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9122 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9123 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9124 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9125 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9126 | { } /* end */ |
| 9127 | }; |
| 9128 | |
| 9129 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 9130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9131 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9132 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9133 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9134 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9135 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9136 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9137 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9138 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9139 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9140 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9141 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9142 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9144 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9145 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9146 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9147 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9148 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9149 | { } /* end */ |
| 9150 | }; |
| 9151 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9152 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 9153 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9154 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9155 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9156 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9157 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9158 | HDA_OUTPUT), |
| 9159 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9160 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9161 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9162 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9163 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9164 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9165 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9166 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9168 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9170 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9171 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9172 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9173 | { } /* end */ |
| 9174 | }; |
| 9175 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9176 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 9177 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9178 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9179 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9180 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9181 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9182 | HDA_OUTPUT), |
| 9183 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9184 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9185 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9186 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9187 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9188 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9189 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9190 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9191 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9192 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9194 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9195 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9196 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9197 | { } /* end */ |
| 9198 | }; |
| 9199 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9200 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9201 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9202 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9203 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9204 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9205 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9206 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9207 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9208 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9209 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9210 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9211 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9212 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9213 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9214 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9215 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9217 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9218 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9219 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9220 | { } /* end */ |
| 9221 | }; |
| 9222 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9223 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9224 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9225 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9227 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9228 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9229 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9230 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9231 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9232 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9233 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9234 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9235 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9237 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9239 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9240 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9241 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9242 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9243 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9244 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9245 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9246 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9248 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9249 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9250 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9251 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9252 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9254 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9255 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9256 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9257 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9258 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9259 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9260 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9261 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9262 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9263 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9264 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9265 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9266 | { } /* end */ |
| 9267 | }; |
| 9268 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9269 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9270 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9271 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9272 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9273 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9274 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9276 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9277 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9278 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9279 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9280 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9281 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9282 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9283 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9284 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9285 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9286 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9288 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9289 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9290 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9291 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9292 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9293 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9294 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9295 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9296 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9297 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9298 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9299 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9300 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9301 | { } /* end */ |
| 9302 | }; |
| 9303 | |
| 9304 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9305 | /* Unmute front mixer */ |
| 9306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9308 | |
| 9309 | /* Set speaker pin to front mixer */ |
| 9310 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9311 | |
| 9312 | /* Init headphone pin */ |
| 9313 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9314 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9315 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9316 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9317 | |
| 9318 | { } /* end */ |
| 9319 | }; |
| 9320 | |
| 9321 | /* toggle speaker-output according to the hp-jack state */ |
| 9322 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9323 | { |
| 9324 | struct alc_spec *spec = codec->spec; |
| 9325 | |
| 9326 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9327 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9328 | spec->automute = 1; |
| 9329 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9330 | } |
| 9331 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9332 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9333 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9334 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9335 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9336 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9337 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9338 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9339 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9340 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9341 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9342 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9343 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9344 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9345 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9346 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9347 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9348 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9349 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9350 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9352 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9354 | { } /* end */ |
| 9355 | }; |
| 9356 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9357 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9358 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9359 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9360 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9361 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9362 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9363 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9364 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9365 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9366 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9367 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9368 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9369 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9370 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9371 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9372 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9373 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9374 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9375 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9376 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9377 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9378 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9379 | { } /* end */ |
| 9380 | }; |
| 9381 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9382 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9383 | /* Output mixers */ |
| 9384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9385 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9386 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9387 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9388 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9389 | HDA_OUTPUT), |
| 9390 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9391 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9392 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9393 | /* Output switches */ |
| 9394 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9395 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9396 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9397 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9398 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9399 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9400 | /* Input mixers */ |
| 9401 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9403 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9404 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9405 | { } /* end */ |
| 9406 | }; |
| 9407 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9408 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9409 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9410 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9411 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9412 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9413 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9414 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9415 | { } /* end */ |
| 9416 | }; |
| 9417 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9418 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9419 | .ops = &snd_hda_bind_vol, |
| 9420 | .values = { |
| 9421 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9422 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9423 | 0 |
| 9424 | }, |
| 9425 | }; |
| 9426 | |
| 9427 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9428 | .ops = &snd_hda_bind_sw, |
| 9429 | .values = { |
| 9430 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9431 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9432 | 0 |
| 9433 | }, |
| 9434 | }; |
| 9435 | |
| 9436 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9438 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9439 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9440 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9441 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9442 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9443 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9445 | { } /* end */ |
| 9446 | }; |
| 9447 | |
| 9448 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9449 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9450 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9451 | { |
| 9452 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9453 | /* .name = "Capture Source", */ |
| 9454 | .name = "Input Source", |
| 9455 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9456 | .info = alc_mux_enum_info, |
| 9457 | .get = alc_mux_enum_get, |
| 9458 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9459 | }, |
| 9460 | { } /* end */ |
| 9461 | }; |
| 9462 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9463 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9464 | { |
| 9465 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9466 | .name = "Channel Mode", |
| 9467 | .info = alc_ch_mode_info, |
| 9468 | .get = alc_ch_mode_get, |
| 9469 | .put = alc_ch_mode_put, |
| 9470 | }, |
| 9471 | { } /* end */ |
| 9472 | }; |
| 9473 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9474 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9475 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9476 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9477 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9478 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9479 | spec->autocfg.hp_pins[0] = 0x15; |
| 9480 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9481 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9482 | spec->automute = 1; |
| 9483 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9484 | } |
| 9485 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9486 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9487 | /* HP */ |
| 9488 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9490 | /* Subwoofer */ |
| 9491 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9492 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9493 | |
| 9494 | /* enable unsolicited event */ |
| 9495 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9496 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9497 | |
| 9498 | { } /* end */ |
| 9499 | }; |
| 9500 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9501 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9502 | /* HP */ |
| 9503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9505 | /* Int speaker */ |
| 9506 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9507 | |
| 9508 | /* enable unsolicited event */ |
| 9509 | /* |
| 9510 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9511 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9512 | */ |
| 9513 | |
| 9514 | { } /* end */ |
| 9515 | }; |
| 9516 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9517 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9518 | /* HP */ |
| 9519 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9521 | /* Int speaker */ |
| 9522 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9523 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9524 | |
| 9525 | /* enable unsolicited event */ |
| 9526 | {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] | 9527 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9528 | |
| 9529 | { } /* end */ |
| 9530 | }; |
| 9531 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9532 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9533 | /* HP */ |
| 9534 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9536 | /* Subwoofer */ |
| 9537 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9538 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9539 | |
| 9540 | /* enable unsolicited event */ |
| 9541 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9542 | |
| 9543 | { } /* end */ |
| 9544 | }; |
| 9545 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9546 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9547 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9549 | |
| 9550 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9551 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9552 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9553 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9554 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9555 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9556 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9557 | /* Connect Mic jack to CLFE */ |
| 9558 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9559 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9560 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9561 | /* Connect Line-in jack to Surround */ |
| 9562 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9563 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9564 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9565 | /* Connect HP out jack to Front */ |
| 9566 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9567 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9568 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9569 | |
| 9570 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9571 | |
| 9572 | { } /* end */ |
| 9573 | }; |
| 9574 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9575 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9576 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9577 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9578 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9579 | { } /* end */ |
| 9580 | }; |
| 9581 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9582 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9583 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9585 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9586 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9587 | { } /* end */ |
| 9588 | }; |
| 9589 | |
| 9590 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9593 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9594 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9595 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9596 | { } /* end */ |
| 9597 | }; |
| 9598 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9599 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9602 | |
| 9603 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9604 | |
| 9605 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9606 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9607 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9608 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9609 | { } /* end */ |
| 9610 | }; |
| 9611 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9612 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9613 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9614 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9615 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9616 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9617 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9618 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9619 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9620 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9621 | { } /* end */ |
| 9622 | }; |
| 9623 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9624 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9625 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9626 | { } |
| 9627 | }; |
| 9628 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9629 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9630 | /* HP */ |
| 9631 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9633 | |
| 9634 | /* enable unsolicited event */ |
| 9635 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9636 | |
| 9637 | { } /* end */ |
| 9638 | }; |
| 9639 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9640 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9641 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9642 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9643 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9644 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9645 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9646 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9647 | spec->autocfg.speaker_pins[2] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9648 | spec->automute = 1; |
| 9649 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9650 | } |
| 9651 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9652 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9653 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9654 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9655 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9656 | {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] | 9657 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9658 | }; |
| 9659 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9660 | /* |
| 9661 | * 2ch mode |
| 9662 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9663 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9664 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9665 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9666 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9667 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9668 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9669 | }; |
| 9670 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9671 | /* |
| 9672 | * 4ch mode |
| 9673 | */ |
| 9674 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9675 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9676 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9677 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9678 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9679 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9680 | { } /* end */ |
| 9681 | }; |
| 9682 | |
| 9683 | /* |
| 9684 | * 6ch mode |
| 9685 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9686 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9687 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9688 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9689 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9690 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9691 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9692 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9693 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9694 | }; |
| 9695 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9696 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9697 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9698 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9699 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9700 | }; |
| 9701 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9702 | static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9703 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9704 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9705 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9706 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9707 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9708 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9709 | spec->automute = 1; |
| 9710 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9711 | } |
| 9712 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9713 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9714 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9715 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9716 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9717 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9718 | spec->autocfg.hp_pins[0] = 0x14; |
| 9719 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9720 | spec->automute = 1; |
| 9721 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9722 | } |
| 9723 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9724 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9725 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9726 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9727 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9728 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9729 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9730 | struct alc_spec *spec = codec->spec; |
| 9731 | |
| 9732 | spec->autocfg.hp_pins[0] = 0x15; |
| 9733 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9734 | spec->automute = 1; |
| 9735 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9736 | } |
| 9737 | |
| 9738 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9739 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9740 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9741 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9742 | } |
| 9743 | |
| 9744 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9745 | unsigned int res) |
| 9746 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9747 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9748 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9749 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9750 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9751 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9752 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9753 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9754 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9755 | } |
| 9756 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9757 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9758 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9759 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9760 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9761 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9762 | spec->autocfg.hp_pins[0] = 0x14; |
| 9763 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9764 | spec->automute = 1; |
| 9765 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9766 | } |
| 9767 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9768 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9769 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9770 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9771 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9772 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9773 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9774 | spec->automute = 1; |
| 9775 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9776 | } |
| 9777 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9778 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9779 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9780 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9781 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9782 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9783 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9784 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9785 | spec->automute = 1; |
| 9786 | spec->detect_line = 1; |
| 9787 | spec->automute_lines = 1; |
| 9788 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9789 | } |
| 9790 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9791 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9792 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9793 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9794 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9795 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9796 | spec->autocfg.hp_pins[0] = 0x14; |
| 9797 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9798 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9799 | spec->automute = 1; |
| 9800 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9801 | } |
| 9802 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9803 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9804 | /* HP Pin: output 0 (0x0c) */ |
| 9805 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9806 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9807 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9808 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9809 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9810 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9811 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9812 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9813 | /* eanable EAPD on medion laptop */ |
| 9814 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9815 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9816 | /* enable unsolicited event */ |
| 9817 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9818 | { } |
| 9819 | }; |
| 9820 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9821 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9822 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9823 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9824 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9825 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9826 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9827 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9828 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9829 | spec->autocfg.speaker_pins[3] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9830 | spec->automute = 1; |
| 9831 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9832 | } |
| 9833 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9834 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9835 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9836 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9837 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9838 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9839 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9840 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9841 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9842 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9843 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9844 | spec->automute = 1; |
| 9845 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9846 | } |
| 9847 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9848 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9849 | { |
| 9850 | struct alc_spec *spec = codec->spec; |
| 9851 | |
| 9852 | spec->autocfg.hp_pins[0] = 0x15; |
| 9853 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9854 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9855 | spec->automute = 1; |
| 9856 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9857 | } |
| 9858 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9859 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9860 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9861 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9862 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9863 | /* enable unsolicited event */ |
| 9864 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9865 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9866 | { } /* end */ |
| 9867 | }; |
| 9868 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9869 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9870 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9871 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9872 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9873 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9874 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9875 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9876 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9877 | spec->ext_mic.pin = 0x18; |
| 9878 | spec->int_mic.pin = 0x19; |
| 9879 | spec->ext_mic.mux_idx = 0; |
| 9880 | spec->int_mic.mux_idx = 1; |
| 9881 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9882 | spec->automute = 1; |
| 9883 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9884 | } |
| 9885 | |
| 9886 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9887 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9888 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9891 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9892 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9893 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9894 | /* enable unsolicited event */ |
| 9895 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9896 | { } /* end */ |
| 9897 | }; |
| 9898 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9899 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9900 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9901 | struct alc_spec *spec = codec->spec; |
| 9902 | |
| 9903 | spec->autocfg.hp_pins[0] = 0x14; |
| 9904 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9905 | alc_hp_automute(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9906 | } |
| 9907 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9908 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9909 | /* Init rear pin (used as headphone output) */ |
| 9910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9911 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9912 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9913 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9914 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9915 | /* Init line 2 pin (used as headphone out by default) */ |
| 9916 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9917 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9918 | { } /* end */ |
| 9919 | }; |
| 9920 | |
| 9921 | /* Mute speakers according to the headphone jack state */ |
| 9922 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9923 | { |
| 9924 | unsigned int present; |
| 9925 | |
| 9926 | /* Mute only in 2ch or 4ch mode */ |
| 9927 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9928 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9929 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9930 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9931 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9932 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9933 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9934 | } |
| 9935 | } |
| 9936 | |
| 9937 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9938 | { |
| 9939 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9940 | alc889A_mb31_automute(codec); |
| 9941 | } |
| 9942 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9943 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9944 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9945 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9946 | #endif |
| 9947 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9948 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9949 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9950 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9951 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9952 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9953 | |
| 9954 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9955 | ALC1200_DIGOUT_NID, 0, |
| 9956 | }; |
| 9957 | |
| 9958 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9959 | ALC883_DIGOUT_NID, 0, |
| 9960 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9961 | |
| 9962 | /* |
| 9963 | * configuration and preset |
| 9964 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9965 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9966 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9967 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9968 | [ALC882_ARIMA] = "arima", |
| 9969 | [ALC882_W2JC] = "w2jc", |
| 9970 | [ALC882_TARGA] = "targa", |
| 9971 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9972 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9973 | [ALC885_MACPRO] = "macpro", |
| 9974 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9975 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9976 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9977 | [ALC885_MBP3] = "mbp3", |
| 9978 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9979 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9980 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9981 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9982 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9983 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9984 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9985 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9986 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9987 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9988 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9989 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9990 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9991 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9992 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9993 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9994 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9995 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9996 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9997 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9998 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9999 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10000 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10001 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10002 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10003 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10004 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10005 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10006 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10007 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10008 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10009 | [ALC889A_INTEL] = "intel-alc889a", |
| 10010 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10011 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10012 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10013 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10014 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10015 | }; |
| 10016 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10017 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 10018 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 10019 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10020 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 10021 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 10022 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10023 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 10024 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 10025 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10026 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 10027 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 10028 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 10029 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10030 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 10031 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 10032 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 10033 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10034 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 10035 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 10036 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 10037 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 10038 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10039 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10040 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 10041 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 10042 | /* default Acer -- disabled as it causes more problems. |
| 10043 | * model=auto should work fine now |
| 10044 | */ |
| 10045 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10046 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10047 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10048 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 10049 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10050 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 10051 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 10052 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 10053 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 10054 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10055 | |
| 10056 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 10057 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 10058 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 10059 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10060 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 10061 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 10062 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10063 | 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] | 10064 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10065 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10066 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10067 | |
| 10068 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 10069 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10070 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10071 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10072 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 10073 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10074 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10075 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10076 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10077 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 10078 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 10079 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10080 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 10081 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10082 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10083 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 10084 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10085 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 10086 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 10087 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 10088 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 10089 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 10090 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 10091 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10092 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 10093 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 10094 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 10095 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10096 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10097 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 10098 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 10099 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 10100 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 10101 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 10102 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 10103 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 10104 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 10105 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10106 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 10107 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10108 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10109 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 10110 | 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] | 10111 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 10112 | 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] | 10113 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10114 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 10115 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10116 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10117 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 10118 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 10119 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 10120 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10121 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10122 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10123 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10124 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 10125 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10126 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 10127 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 10128 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10129 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10130 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10131 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 10132 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10133 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10134 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 10135 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 10136 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 10137 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10138 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10139 | {} |
| 10140 | }; |
| 10141 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10142 | /* codec SSID table for Intel Mac */ |
| 10143 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 10144 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 10145 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 10146 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 10147 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 10148 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 10149 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 10150 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 10151 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 10152 | 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] | 10153 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 10154 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10155 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10156 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10157 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10158 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10159 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10160 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10161 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10162 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10163 | */ |
| 10164 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10165 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10166 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10167 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10168 | }; |
| 10169 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10170 | static struct alc_config_preset alc882_presets[] = { |
| 10171 | [ALC882_3ST_DIG] = { |
| 10172 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10173 | .init_verbs = { alc882_base_init_verbs, |
| 10174 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10175 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10176 | .dac_nids = alc882_dac_nids, |
| 10177 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10178 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10179 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10180 | .channel_mode = alc882_ch_modes, |
| 10181 | .need_dac_fix = 1, |
| 10182 | .input_mux = &alc882_capture_source, |
| 10183 | }, |
| 10184 | [ALC882_6ST_DIG] = { |
| 10185 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10186 | .init_verbs = { alc882_base_init_verbs, |
| 10187 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10188 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10189 | .dac_nids = alc882_dac_nids, |
| 10190 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10191 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10192 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10193 | .channel_mode = alc882_sixstack_modes, |
| 10194 | .input_mux = &alc882_capture_source, |
| 10195 | }, |
| 10196 | [ALC882_ARIMA] = { |
| 10197 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10198 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10199 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10200 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10201 | .dac_nids = alc882_dac_nids, |
| 10202 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10203 | .channel_mode = alc882_sixstack_modes, |
| 10204 | .input_mux = &alc882_capture_source, |
| 10205 | }, |
| 10206 | [ALC882_W2JC] = { |
| 10207 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10208 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10209 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10210 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10211 | .dac_nids = alc882_dac_nids, |
| 10212 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10213 | .channel_mode = alc880_threestack_modes, |
| 10214 | .need_dac_fix = 1, |
| 10215 | .input_mux = &alc882_capture_source, |
| 10216 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10217 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10218 | [ALC885_MBA21] = { |
| 10219 | .mixers = { alc885_mba21_mixer }, |
| 10220 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10221 | .num_dacs = 2, |
| 10222 | .dac_nids = alc882_dac_nids, |
| 10223 | .channel_mode = alc885_mba21_ch_modes, |
| 10224 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10225 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10226 | .unsol_event = alc_sku_unsol_event, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10227 | .setup = alc885_mba21_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10228 | .init_hook = alc_hp_automute, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10229 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10230 | [ALC885_MBP3] = { |
| 10231 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10232 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10233 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10234 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10235 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10236 | .hp_nid = 0x04, |
| 10237 | .channel_mode = alc885_mbp_4ch_modes, |
| 10238 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10239 | .input_mux = &alc882_capture_source, |
| 10240 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10241 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10242 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10243 | .setup = alc885_mbp3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10244 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10245 | }, |
| 10246 | [ALC885_MB5] = { |
| 10247 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10248 | .init_verbs = { alc885_mb5_init_verbs, |
| 10249 | alc880_gpio1_init_verbs }, |
| 10250 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10251 | .dac_nids = alc882_dac_nids, |
| 10252 | .channel_mode = alc885_mb5_6ch_modes, |
| 10253 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10254 | .input_mux = &mb5_capture_source, |
| 10255 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10256 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10257 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10258 | .setup = alc885_mb5_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10259 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10260 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10261 | [ALC885_MACMINI3] = { |
| 10262 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10263 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10264 | alc880_gpio1_init_verbs }, |
| 10265 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10266 | .dac_nids = alc882_dac_nids, |
| 10267 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10268 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10269 | .input_mux = &macmini3_capture_source, |
| 10270 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10271 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10272 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10273 | .setup = alc885_macmini3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10274 | .init_hook = alc_hp_automute, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10275 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10276 | [ALC885_MACPRO] = { |
| 10277 | .mixers = { alc882_macpro_mixer }, |
| 10278 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10279 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10280 | .dac_nids = alc882_dac_nids, |
| 10281 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10282 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10283 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10284 | .channel_mode = alc882_ch_modes, |
| 10285 | .input_mux = &alc882_capture_source, |
| 10286 | .init_hook = alc885_macpro_init_hook, |
| 10287 | }, |
| 10288 | [ALC885_IMAC24] = { |
| 10289 | .mixers = { alc885_imac24_mixer }, |
| 10290 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10291 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10292 | .dac_nids = alc882_dac_nids, |
| 10293 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10294 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10295 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10296 | .channel_mode = alc882_ch_modes, |
| 10297 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10298 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10299 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10300 | .init_hook = alc885_imac24_init_hook, |
| 10301 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10302 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10303 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10304 | .init_verbs = { alc885_imac91_init_verbs, |
| 10305 | alc880_gpio1_init_verbs }, |
| 10306 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10307 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10308 | .channel_mode = alc885_mba21_ch_modes, |
| 10309 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10310 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10311 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10312 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10313 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10314 | .setup = alc885_imac91_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10315 | .init_hook = alc_hp_automute, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10316 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10317 | [ALC882_TARGA] = { |
| 10318 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10319 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10320 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10321 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10322 | .dac_nids = alc882_dac_nids, |
| 10323 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10324 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10325 | .adc_nids = alc882_adc_nids, |
| 10326 | .capsrc_nids = alc882_capsrc_nids, |
| 10327 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10328 | .channel_mode = alc882_3ST_6ch_modes, |
| 10329 | .need_dac_fix = 1, |
| 10330 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10331 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10332 | .setup = alc882_targa_setup, |
| 10333 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10334 | }, |
| 10335 | [ALC882_ASUS_A7J] = { |
| 10336 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10337 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10338 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10339 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10340 | .dac_nids = alc882_dac_nids, |
| 10341 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10342 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10343 | .adc_nids = alc882_adc_nids, |
| 10344 | .capsrc_nids = alc882_capsrc_nids, |
| 10345 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10346 | .channel_mode = alc882_3ST_6ch_modes, |
| 10347 | .need_dac_fix = 1, |
| 10348 | .input_mux = &alc882_capture_source, |
| 10349 | }, |
| 10350 | [ALC882_ASUS_A7M] = { |
| 10351 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10352 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10353 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10354 | alc882_asus_a7m_verbs }, |
| 10355 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10356 | .dac_nids = alc882_dac_nids, |
| 10357 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10358 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10359 | .channel_mode = alc880_threestack_modes, |
| 10360 | .need_dac_fix = 1, |
| 10361 | .input_mux = &alc882_capture_source, |
| 10362 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10363 | [ALC883_3ST_2ch_DIG] = { |
| 10364 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10365 | .init_verbs = { alc883_init_verbs }, |
| 10366 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10367 | .dac_nids = alc883_dac_nids, |
| 10368 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10369 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10370 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10371 | .channel_mode = alc883_3ST_2ch_modes, |
| 10372 | .input_mux = &alc883_capture_source, |
| 10373 | }, |
| 10374 | [ALC883_3ST_6ch_DIG] = { |
| 10375 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10376 | .init_verbs = { alc883_init_verbs }, |
| 10377 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10378 | .dac_nids = alc883_dac_nids, |
| 10379 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10380 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10381 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10382 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10383 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10384 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10385 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10386 | [ALC883_3ST_6ch] = { |
| 10387 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10388 | .init_verbs = { alc883_init_verbs }, |
| 10389 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10390 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10391 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10392 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10393 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10394 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10395 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10396 | [ALC883_3ST_6ch_INTEL] = { |
| 10397 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10398 | .init_verbs = { alc883_init_verbs }, |
| 10399 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10400 | .dac_nids = alc883_dac_nids, |
| 10401 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10402 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10403 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10404 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10405 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10406 | .need_dac_fix = 1, |
| 10407 | .input_mux = &alc883_3stack_6ch_intel, |
| 10408 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10409 | [ALC889A_INTEL] = { |
| 10410 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10411 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10412 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10413 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10414 | .dac_nids = alc883_dac_nids, |
| 10415 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10416 | .adc_nids = alc889_adc_nids, |
| 10417 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10418 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10419 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10420 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10421 | .channel_mode = alc889_8ch_intel_modes, |
| 10422 | .capsrc_nids = alc889_capsrc_nids, |
| 10423 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10424 | .setup = alc889_automute_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10425 | .init_hook = alc_hp_automute, |
| 10426 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10427 | .need_dac_fix = 1, |
| 10428 | }, |
| 10429 | [ALC889_INTEL] = { |
| 10430 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10431 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10432 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10433 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10434 | .dac_nids = alc883_dac_nids, |
| 10435 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10436 | .adc_nids = alc889_adc_nids, |
| 10437 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10438 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10439 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10440 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10441 | .channel_mode = alc889_8ch_intel_modes, |
| 10442 | .capsrc_nids = alc889_capsrc_nids, |
| 10443 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10444 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10445 | .init_hook = alc889_intel_init_hook, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10446 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10447 | .need_dac_fix = 1, |
| 10448 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10449 | [ALC883_6ST_DIG] = { |
| 10450 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10451 | .init_verbs = { alc883_init_verbs }, |
| 10452 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10453 | .dac_nids = alc883_dac_nids, |
| 10454 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10455 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10456 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10457 | .channel_mode = alc883_sixstack_modes, |
| 10458 | .input_mux = &alc883_capture_source, |
| 10459 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10460 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10461 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10462 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10463 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10464 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10465 | .dac_nids = alc883_dac_nids, |
| 10466 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10467 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10468 | .channel_mode = alc883_3ST_6ch_modes, |
| 10469 | .need_dac_fix = 1, |
| 10470 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10471 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10472 | .setup = alc882_targa_setup, |
| 10473 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10474 | }, |
| 10475 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10476 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10477 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10478 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10479 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10480 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10481 | .adc_nids = alc883_adc_nids_alt, |
| 10482 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10483 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10484 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10485 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10486 | .channel_mode = alc883_3ST_2ch_modes, |
| 10487 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10488 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10489 | .setup = alc882_targa_setup, |
| 10490 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10491 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10492 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10493 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10494 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10495 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10496 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10497 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10498 | .dac_nids = alc883_dac_nids, |
| 10499 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10500 | .adc_nids = alc883_adc_nids_rev, |
| 10501 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10502 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10503 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10504 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10505 | .channel_mode = alc883_4ST_8ch_modes, |
| 10506 | .need_dac_fix = 1, |
| 10507 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10508 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10509 | .setup = alc882_targa_setup, |
| 10510 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10511 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10512 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10513 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10514 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10515 | * and the headphone jack. Turn this on and rely on the |
| 10516 | * standard mute methods whenever the user wants to turn |
| 10517 | * these outputs off. |
| 10518 | */ |
| 10519 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10520 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10521 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10522 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10523 | .channel_mode = alc883_3ST_2ch_modes, |
| 10524 | .input_mux = &alc883_capture_source, |
| 10525 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10526 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10527 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10528 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10529 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10530 | .dac_nids = alc883_dac_nids, |
| 10531 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10532 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10533 | .channel_mode = alc883_3ST_2ch_modes, |
| 10534 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10535 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10536 | .setup = alc883_acer_aspire_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10537 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10538 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10539 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10540 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10541 | alc883_chmode_mixer }, |
| 10542 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10543 | alc888_acer_aspire_4930g_verbs }, |
| 10544 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10545 | .dac_nids = alc883_dac_nids, |
| 10546 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10547 | .adc_nids = alc883_adc_nids_rev, |
| 10548 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10549 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10550 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10551 | .channel_mode = alc883_3ST_6ch_modes, |
| 10552 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10553 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10554 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10555 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10556 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10557 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10558 | .setup = alc888_acer_aspire_4930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10559 | .init_hook = alc_hp_automute, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10560 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10561 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10562 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10563 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10564 | alc888_acer_aspire_6530g_verbs }, |
| 10565 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10566 | .dac_nids = alc883_dac_nids, |
| 10567 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10568 | .adc_nids = alc883_adc_nids_rev, |
| 10569 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10570 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10571 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10572 | .channel_mode = alc883_3ST_2ch_modes, |
| 10573 | .num_mux_defs = |
| 10574 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10575 | .input_mux = alc888_acer_aspire_6530_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10576 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10577 | .setup = alc888_acer_aspire_6530g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10578 | .init_hook = alc_hp_automute, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10579 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10580 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10581 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10582 | alc883_chmode_mixer }, |
| 10583 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10584 | alc889_acer_aspire_8930g_verbs, |
| 10585 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10586 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10587 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10588 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10589 | .adc_nids = alc889_adc_nids, |
| 10590 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10591 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10592 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10593 | .channel_mode = alc883_3ST_6ch_modes, |
| 10594 | .need_dac_fix = 1, |
| 10595 | .const_channel_count = 6, |
| 10596 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10597 | ARRAY_SIZE(alc889_capture_sources), |
| 10598 | .input_mux = alc889_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10599 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10600 | .setup = alc889_acer_aspire_8930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10601 | .init_hook = alc_hp_automute, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10602 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10603 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10604 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10605 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10606 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10607 | .mixers = { alc883_3ST_6ch_mixer, |
| 10608 | alc883_chmode_mixer }, |
| 10609 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10610 | alc888_acer_aspire_7730G_verbs }, |
| 10611 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10612 | .dac_nids = alc883_dac_nids, |
| 10613 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10614 | .adc_nids = alc883_adc_nids_rev, |
| 10615 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10616 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10617 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10618 | .channel_mode = alc883_3ST_6ch_modes, |
| 10619 | .need_dac_fix = 1, |
| 10620 | .const_channel_count = 6, |
| 10621 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10622 | .unsol_event = alc_sku_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10623 | .setup = alc888_acer_aspire_7730g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10624 | .init_hook = alc_hp_automute, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10625 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10626 | [ALC883_MEDION] = { |
| 10627 | .mixers = { alc883_fivestack_mixer, |
| 10628 | alc883_chmode_mixer }, |
| 10629 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10630 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10631 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10632 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10633 | .adc_nids = alc883_adc_nids_alt, |
| 10634 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10635 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10636 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10637 | .channel_mode = alc883_sixstack_modes, |
| 10638 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10639 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10640 | [ALC883_MEDION_WIM2160] = { |
| 10641 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10642 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10643 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10644 | .dac_nids = alc883_dac_nids, |
| 10645 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10646 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10647 | .adc_nids = alc883_adc_nids, |
| 10648 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10649 | .channel_mode = alc883_3ST_2ch_modes, |
| 10650 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10651 | .unsol_event = alc_sku_unsol_event, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10652 | .setup = alc883_medion_wim2160_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10653 | .init_hook = alc_hp_automute, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10654 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10655 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10656 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10657 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10658 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10659 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10660 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10661 | .channel_mode = alc883_3ST_2ch_modes, |
| 10662 | .input_mux = &alc883_capture_source, |
| 10663 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10664 | [ALC883_CLEVO_M540R] = { |
| 10665 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10666 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10667 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10668 | .dac_nids = alc883_dac_nids, |
| 10669 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10670 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10671 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10672 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10673 | .need_dac_fix = 1, |
| 10674 | .input_mux = &alc883_capture_source, |
| 10675 | /* This machine has the hardware HP auto-muting, thus |
| 10676 | * we need no software mute via unsol event |
| 10677 | */ |
| 10678 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10679 | [ALC883_CLEVO_M720] = { |
| 10680 | .mixers = { alc883_clevo_m720_mixer }, |
| 10681 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10682 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10683 | .dac_nids = alc883_dac_nids, |
| 10684 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10685 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10686 | .channel_mode = alc883_3ST_2ch_modes, |
| 10687 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10688 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10689 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10690 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10691 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10692 | [ALC883_LENOVO_101E_2ch] = { |
| 10693 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10694 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10695 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10696 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10697 | .adc_nids = alc883_adc_nids_alt, |
| 10698 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10699 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10700 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10701 | .channel_mode = alc883_3ST_2ch_modes, |
| 10702 | .input_mux = &alc883_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10703 | .setup = alc883_lenovo_101e_setup, |
| 10704 | .unsol_event = alc_sku_unsol_event, |
| 10705 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10706 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10707 | [ALC883_LENOVO_NB0763] = { |
| 10708 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10709 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10710 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10711 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10712 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10713 | .channel_mode = alc883_3ST_2ch_modes, |
| 10714 | .need_dac_fix = 1, |
| 10715 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10716 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10717 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10718 | .init_hook = alc_hp_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10719 | }, |
| 10720 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10721 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10722 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10723 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10724 | .dac_nids = alc883_dac_nids, |
| 10725 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10726 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10727 | .channel_mode = alc883_3ST_6ch_modes, |
| 10728 | .need_dac_fix = 1, |
| 10729 | .input_mux = &alc883_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10730 | .unsol_event = alc_sku_unsol_event, |
| 10731 | .setup = alc888_lenovo_ms7195_setup, |
| 10732 | .init_hook = alc_inithook, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10733 | }, |
| 10734 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10735 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10736 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10737 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10738 | .dac_nids = alc883_dac_nids, |
| 10739 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10740 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10741 | .channel_mode = alc883_3ST_2ch_modes, |
| 10742 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10743 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10744 | .setup = alc883_haier_w66_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10745 | .init_hook = alc_hp_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10746 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10747 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10748 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10749 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10750 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10751 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10752 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10753 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10754 | .need_dac_fix = 1, |
| 10755 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10756 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10757 | .setup = alc888_3st_hp_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10758 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10759 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10760 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10761 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10762 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10763 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10764 | .dac_nids = alc883_dac_nids, |
| 10765 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10766 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10767 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10768 | .channel_mode = alc883_sixstack_modes, |
| 10769 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10770 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10771 | .setup = alc888_6st_dell_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10772 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10773 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10774 | [ALC883_MITAC] = { |
| 10775 | .mixers = { alc883_mitac_mixer }, |
| 10776 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10777 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10778 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10779 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10780 | .channel_mode = alc883_3ST_2ch_modes, |
| 10781 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10782 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10783 | .setup = alc883_mitac_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10784 | .init_hook = alc_hp_automute, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10785 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10786 | [ALC883_FUJITSU_PI2515] = { |
| 10787 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10788 | .init_verbs = { alc883_init_verbs, |
| 10789 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10790 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10791 | .dac_nids = alc883_dac_nids, |
| 10792 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10793 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10794 | .channel_mode = alc883_3ST_2ch_modes, |
| 10795 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10796 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10797 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10798 | .init_hook = alc_hp_automute, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10799 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10800 | [ALC888_FUJITSU_XA3530] = { |
| 10801 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10802 | .init_verbs = { alc883_init_verbs, |
| 10803 | alc888_fujitsu_xa3530_verbs }, |
| 10804 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10805 | .dac_nids = alc883_dac_nids, |
| 10806 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10807 | .adc_nids = alc883_adc_nids_rev, |
| 10808 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10809 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10810 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10811 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10812 | .num_mux_defs = |
| 10813 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10814 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10815 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10816 | .setup = alc888_fujitsu_xa3530_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10817 | .init_hook = alc_hp_automute, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10818 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10819 | [ALC888_LENOVO_SKY] = { |
| 10820 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10821 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10822 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10823 | .dac_nids = alc883_dac_nids, |
| 10824 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10825 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10826 | .channel_mode = alc883_sixstack_modes, |
| 10827 | .need_dac_fix = 1, |
| 10828 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10829 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10830 | .setup = alc888_lenovo_sky_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10831 | .init_hook = alc_hp_automute, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10832 | }, |
| 10833 | [ALC888_ASUS_M90V] = { |
| 10834 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10835 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10836 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10837 | .dac_nids = alc883_dac_nids, |
| 10838 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10839 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10840 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10841 | .channel_mode = alc883_3ST_6ch_modes, |
| 10842 | .need_dac_fix = 1, |
| 10843 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10844 | .unsol_event = alc_sku_unsol_event, |
| 10845 | .setup = alc883_mode2_setup, |
| 10846 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10847 | }, |
| 10848 | [ALC888_ASUS_EEE1601] = { |
| 10849 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10850 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10851 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10852 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10853 | .dac_nids = alc883_dac_nids, |
| 10854 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10855 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10856 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10857 | .channel_mode = alc883_3ST_2ch_modes, |
| 10858 | .need_dac_fix = 1, |
| 10859 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10860 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10861 | .init_hook = alc883_eee1601_inithook, |
| 10862 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10863 | [ALC1200_ASUS_P5Q] = { |
| 10864 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10865 | .init_verbs = { alc883_init_verbs }, |
| 10866 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10867 | .dac_nids = alc883_dac_nids, |
| 10868 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10869 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10870 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10871 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10872 | .channel_mode = alc883_sixstack_modes, |
| 10873 | .input_mux = &alc883_capture_source, |
| 10874 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10875 | [ALC889A_MB31] = { |
| 10876 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10877 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10878 | alc880_gpio1_init_verbs }, |
| 10879 | .adc_nids = alc883_adc_nids, |
| 10880 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10881 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10882 | .dac_nids = alc883_dac_nids, |
| 10883 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10884 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10885 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10886 | .input_mux = &alc889A_mb31_capture_source, |
| 10887 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10888 | .unsol_event = alc889A_mb31_unsol_event, |
| 10889 | .init_hook = alc889A_mb31_automute, |
| 10890 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10891 | [ALC883_SONY_VAIO_TT] = { |
| 10892 | .mixers = { alc883_vaiott_mixer }, |
| 10893 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10894 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10895 | .dac_nids = alc883_dac_nids, |
| 10896 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10897 | .channel_mode = alc883_3ST_2ch_modes, |
| 10898 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10899 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10900 | .setup = alc883_vaiott_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10901 | .init_hook = alc_hp_automute, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10902 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10903 | }; |
| 10904 | |
| 10905 | |
| 10906 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10907 | * Pin config fixes |
| 10908 | */ |
| 10909 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10910 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10911 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10912 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10913 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10914 | PINFIX_GIGABYTE_880GM, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10915 | }; |
| 10916 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10917 | static const struct alc_fixup alc882_fixups[] = { |
| 10918 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10919 | .type = ALC_FIXUP_PINS, |
| 10920 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10921 | { 0x15, 0x01080104 }, /* side */ |
| 10922 | { 0x16, 0x01011012 }, /* rear */ |
| 10923 | { 0x17, 0x01016011 }, /* clfe */ |
| 10924 | { } |
| 10925 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10926 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10927 | [PINFIX_LENOVO_Y530] = { |
| 10928 | .type = ALC_FIXUP_PINS, |
| 10929 | .v.pins = (const struct alc_pincfg[]) { |
| 10930 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10931 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10932 | { } |
| 10933 | } |
| 10934 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10935 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10936 | .type = ALC_FIXUP_VERBS, |
| 10937 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10938 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10939 | {} |
| 10940 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10941 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10942 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10943 | .type = ALC_FIXUP_SKU, |
| 10944 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10945 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10946 | [PINFIX_GIGABYTE_880GM] = { |
| 10947 | .type = ALC_FIXUP_PINS, |
| 10948 | .v.pins = (const struct alc_pincfg[]) { |
| 10949 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 10950 | { } |
| 10951 | } |
| 10952 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10953 | }; |
| 10954 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10955 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10956 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10957 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10958 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10959 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10960 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10961 | {} |
| 10962 | }; |
| 10963 | |
| 10964 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10965 | * BIOS auto configuration |
| 10966 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10967 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10968 | const struct auto_pin_cfg *cfg) |
| 10969 | { |
| 10970 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10971 | } |
| 10972 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10973 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10974 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10975 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10976 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10977 | int idx; |
| 10978 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10979 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10980 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10981 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10982 | if (dac == 0x25) |
| 10983 | idx = 4; |
| 10984 | else if (dac >= 0x02 && dac <= 0x05) |
| 10985 | idx = dac - 2; |
| 10986 | else |
| 10987 | return; |
| 10988 | 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] | 10989 | } |
| 10990 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10991 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10992 | { |
| 10993 | struct alc_spec *spec = codec->spec; |
| 10994 | int i; |
| 10995 | |
| 10996 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10997 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10998 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10999 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11000 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11001 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11002 | } |
| 11003 | } |
| 11004 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11005 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11006 | { |
| 11007 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11008 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 11009 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11010 | |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 11011 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
| 11012 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 11013 | pin = spec->autocfg.hp_pins[i]; |
| 11014 | if (!pin) |
| 11015 | break; |
| 11016 | dac = spec->multiout.hp_nid; |
| 11017 | if (!dac) |
| 11018 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 11019 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 11020 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11021 | } |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 11022 | |
| 11023 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11024 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 11025 | pin = spec->autocfg.speaker_pins[i]; |
| 11026 | if (!pin) |
| 11027 | break; |
| 11028 | dac = spec->multiout.extra_out_nid[0]; |
| 11029 | if (!dac) |
| 11030 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 11031 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 11032 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11033 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11034 | } |
| 11035 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11036 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11037 | { |
| 11038 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11039 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11040 | int i; |
| 11041 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11042 | for (i = 0; i < cfg->num_inputs; i++) { |
| 11043 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 11044 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11045 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 11046 | snd_hda_codec_write(codec, nid, 0, |
| 11047 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11048 | AMP_OUT_MUTE); |
| 11049 | } |
| 11050 | } |
| 11051 | |
| 11052 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 11053 | { |
| 11054 | struct alc_spec *spec = codec->spec; |
| 11055 | int c; |
| 11056 | |
| 11057 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 11058 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 11059 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 11060 | unsigned int mux_idx; |
| 11061 | const struct hda_input_mux *imux; |
| 11062 | int conns, mute, idx, item; |
| 11063 | |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 11064 | /* mute ADC */ |
| 11065 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 11066 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11067 | AMP_IN_MUTE(0)); |
| 11068 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11069 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 11070 | ARRAY_SIZE(conn_list)); |
| 11071 | if (conns < 0) |
| 11072 | continue; |
| 11073 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 11074 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 11075 | if (!imux->num_items && mux_idx > 0) |
| 11076 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11077 | for (idx = 0; idx < conns; idx++) { |
| 11078 | /* if the current connection is the selected one, |
| 11079 | * unmute it as default - otherwise mute it |
| 11080 | */ |
| 11081 | mute = AMP_IN_MUTE(idx); |
| 11082 | for (item = 0; item < imux->num_items; item++) { |
| 11083 | if (imux->items[item].index == idx) { |
| 11084 | if (spec->cur_mux[c] == item) |
| 11085 | mute = AMP_IN_UNMUTE(idx); |
| 11086 | break; |
| 11087 | } |
| 11088 | } |
| 11089 | /* check if we have a selector or mixer |
| 11090 | * we could check for the widget type instead, but |
| 11091 | * just check for Amp-In presence (in case of mixer |
| 11092 | * without amp-in there is something wrong, this |
| 11093 | * function shouldn't be used or capsrc nid is wrong) |
| 11094 | */ |
| 11095 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11096 | snd_hda_codec_write(codec, nid, 0, |
| 11097 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11098 | mute); |
| 11099 | else if (mute != AMP_IN_MUTE(idx)) |
| 11100 | snd_hda_codec_write(codec, nid, 0, |
| 11101 | AC_VERB_SET_CONNECT_SEL, |
| 11102 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11103 | } |
| 11104 | } |
| 11105 | } |
| 11106 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11107 | /* add mic boosts if needed */ |
| 11108 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11109 | { |
| 11110 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11111 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11112 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11113 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11114 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11115 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11116 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11117 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 11118 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11119 | break; |
| 11120 | nid = cfg->inputs[i].pin; |
| 11121 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11122 | const char *label; |
| 11123 | char boost_label[32]; |
| 11124 | |
| 11125 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 11126 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11127 | type_idx++; |
| 11128 | else |
| 11129 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11130 | prev_label = label; |
| 11131 | |
| 11132 | snprintf(boost_label, sizeof(boost_label), |
| 11133 | "%s Boost Volume", label); |
| 11134 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11135 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11136 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11137 | if (err < 0) |
| 11138 | return err; |
| 11139 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11140 | } |
| 11141 | return 0; |
| 11142 | } |
| 11143 | |
| 11144 | /* almost identical with ALC880 parser... */ |
| 11145 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 11146 | { |
| 11147 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11148 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11149 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11150 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11151 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11152 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11153 | if (err < 0) |
| 11154 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11155 | if (!spec->autocfg.line_outs) |
| 11156 | return 0; /* can't find valid BIOS pin config */ |
| 11157 | |
| 11158 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11159 | if (err < 0) |
| 11160 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 11161 | err = alc_auto_add_multi_channel_mode(codec); |
| 11162 | if (err < 0) |
| 11163 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 11164 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11165 | if (err < 0) |
| 11166 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11167 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11168 | "Headphone"); |
| 11169 | if (err < 0) |
| 11170 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11171 | err = alc880_auto_create_extra_out(spec, |
| 11172 | spec->autocfg.speaker_pins[0], |
| 11173 | "Speaker"); |
| 11174 | if (err < 0) |
| 11175 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11176 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 11177 | if (err < 0) |
| 11178 | return err; |
| 11179 | |
| 11180 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11181 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11182 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11183 | |
| 11184 | if (spec->kctls.list) |
| 11185 | add_mixer(spec, spec->kctls.list); |
| 11186 | |
| 11187 | add_verb(spec, alc883_auto_init_verbs); |
| 11188 | /* if ADC 0x07 is available, initialize it, too */ |
| 11189 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 11190 | add_verb(spec, alc882_adc1_init_verbs); |
| 11191 | |
| 11192 | spec->num_mux_defs = 1; |
| 11193 | spec->input_mux = &spec->private_imux[0]; |
| 11194 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11195 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11196 | |
| 11197 | err = alc_auto_add_mic_boost(codec); |
| 11198 | if (err < 0) |
| 11199 | return err; |
| 11200 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11201 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11202 | } |
| 11203 | |
| 11204 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11205 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11206 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11207 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11208 | alc882_auto_init_multi_out(codec); |
| 11209 | alc882_auto_init_hp_out(codec); |
| 11210 | alc882_auto_init_analog_input(codec); |
| 11211 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11212 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11213 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11214 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11215 | } |
| 11216 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11217 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11218 | { |
| 11219 | struct alc_spec *spec; |
| 11220 | int err, board_config; |
| 11221 | |
| 11222 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11223 | if (spec == NULL) |
| 11224 | return -ENOMEM; |
| 11225 | |
| 11226 | codec->spec = spec; |
| 11227 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11228 | switch (codec->vendor_id) { |
| 11229 | case 0x10ec0882: |
| 11230 | case 0x10ec0885: |
| 11231 | break; |
| 11232 | default: |
| 11233 | /* ALC883 and variants */ |
| 11234 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11235 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11236 | } |
| 11237 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11238 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11239 | alc882_models, |
| 11240 | alc882_cfg_tbl); |
| 11241 | |
| 11242 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11243 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11244 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11245 | |
| 11246 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11247 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11248 | codec->chip_name); |
| 11249 | board_config = ALC882_AUTO; |
| 11250 | } |
| 11251 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11252 | if (board_config == ALC882_AUTO) { |
| 11253 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11254 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11255 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11256 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11257 | alc_auto_parse_customize_define(codec); |
| 11258 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11259 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11260 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11261 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11262 | if (err < 0) { |
| 11263 | alc_free(codec); |
| 11264 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11265 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11266 | printk(KERN_INFO |
| 11267 | "hda_codec: Cannot set up configuration " |
| 11268 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11269 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11270 | } |
| 11271 | } |
| 11272 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11273 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11274 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11275 | if (err < 0) { |
| 11276 | alc_free(codec); |
| 11277 | return err; |
| 11278 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11279 | } |
| 11280 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11281 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11282 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11283 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11284 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11285 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11286 | /* FIXME: setup DAC5 */ |
| 11287 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11288 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11289 | |
| 11290 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11291 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11292 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11293 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11294 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11295 | spec->num_adc_nids = 0; |
| 11296 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11297 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11298 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11299 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11300 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11301 | unsigned int wcap = get_wcaps(codec, nid); |
| 11302 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11303 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11304 | if (wcap != AC_WID_AUD_IN) |
| 11305 | continue; |
| 11306 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11307 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11308 | if (err < 0) |
| 11309 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11310 | err = snd_hda_get_connections(codec, cap, items, |
| 11311 | ARRAY_SIZE(items)); |
| 11312 | if (err < 0) |
| 11313 | continue; |
| 11314 | for (j = 0; j < imux->num_items; j++) |
| 11315 | if (imux->items[j].index >= err) |
| 11316 | break; |
| 11317 | if (j < imux->num_items) |
| 11318 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11319 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11320 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11321 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11322 | spec->adc_nids = spec->private_adc_nids; |
| 11323 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11324 | } |
| 11325 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11326 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11327 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11328 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11329 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11330 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11331 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11332 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11333 | spec->vmaster_nid = 0x0c; |
| 11334 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11335 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11336 | if (board_config == ALC882_AUTO) |
| 11337 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11338 | |
| 11339 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11340 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11341 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11342 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11343 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11344 | |
| 11345 | return 0; |
| 11346 | } |
| 11347 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11348 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11349 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11350 | * ALC262 support |
| 11351 | */ |
| 11352 | |
| 11353 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11354 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11355 | |
| 11356 | #define alc262_dac_nids alc260_dac_nids |
| 11357 | #define alc262_adc_nids alc882_adc_nids |
| 11358 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11359 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11360 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11361 | |
| 11362 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11363 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11364 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11365 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11366 | /* ADC0 */ |
| 11367 | 0x09 |
| 11368 | }; |
| 11369 | |
| 11370 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11371 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11372 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11373 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11374 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11375 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11376 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11377 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11378 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11379 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11381 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11382 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11383 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11384 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11385 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11386 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11387 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11388 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11389 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11390 | }; |
| 11391 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11392 | /* update HP, line and mono-out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11393 | #define alc262_hp_master_update alc260_hp_master_update |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11394 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11395 | static void alc262_hp_bpc_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11396 | { |
| 11397 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11398 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11399 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11400 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11401 | spec->automute = 1; |
| 11402 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11403 | } |
| 11404 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11405 | static void alc262_hp_wildwest_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11406 | { |
| 11407 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11408 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11409 | spec->autocfg.hp_pins[0] = 0x15; |
| 11410 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11411 | spec->automute = 1; |
| 11412 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11413 | } |
| 11414 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11415 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11416 | #define alc262_hp_master_sw_put alc260_hp_master_sw_put |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11417 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11418 | #define ALC262_HP_MASTER_SWITCH \ |
| 11419 | { \ |
| 11420 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11421 | .name = "Master Playback Switch", \ |
| 11422 | .info = snd_ctl_boolean_mono_info, \ |
| 11423 | .get = alc262_hp_master_sw_get, \ |
| 11424 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11425 | }, \ |
| 11426 | { \ |
| 11427 | .iface = NID_MAPPING, \ |
| 11428 | .name = "Master Playback Switch", \ |
| 11429 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11430 | } |
| 11431 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11432 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11433 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11434 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11435 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11436 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11437 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11438 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11439 | HDA_OUTPUT), |
| 11440 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11441 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11442 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11443 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11444 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11445 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11446 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11447 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11448 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11449 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11450 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11451 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11452 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11453 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11454 | { } /* end */ |
| 11455 | }; |
| 11456 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11457 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11458 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11459 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11460 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11461 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11463 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11464 | HDA_OUTPUT), |
| 11465 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11466 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11467 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11468 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11469 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11470 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11471 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11472 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11473 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11474 | { } /* end */ |
| 11475 | }; |
| 11476 | |
| 11477 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11478 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11479 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11480 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11481 | { } /* end */ |
| 11482 | }; |
| 11483 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11484 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11485 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11486 | { |
| 11487 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11488 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11489 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11490 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11491 | spec->automute = 1; |
| 11492 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11493 | } |
| 11494 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11495 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11496 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11497 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11498 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11499 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11502 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11503 | { } /* end */ |
| 11504 | }; |
| 11505 | |
| 11506 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11508 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11509 | |
| 11510 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11511 | { } |
| 11512 | }; |
| 11513 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11514 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11515 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11516 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11517 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11518 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11519 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11520 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11521 | { } /* end */ |
| 11522 | }; |
| 11523 | |
| 11524 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11525 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11526 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11527 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11528 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11529 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11530 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11531 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11532 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11533 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11534 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11535 | {} |
| 11536 | }; |
| 11537 | |
| 11538 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11539 | .num_items = 1, |
| 11540 | .items = { |
| 11541 | { "Line", 0x1 }, |
| 11542 | }, |
| 11543 | }; |
| 11544 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11545 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11546 | #define alc262_hippo_master_update alc262_hp_master_update |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11547 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11548 | #define alc262_hippo_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11549 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11550 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11551 | { \ |
| 11552 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11553 | .name = "Master Playback Switch", \ |
| 11554 | .info = snd_ctl_boolean_mono_info, \ |
| 11555 | .get = alc262_hippo_master_sw_get, \ |
| 11556 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11557 | }, \ |
| 11558 | { \ |
| 11559 | .iface = NID_MAPPING, \ |
| 11560 | .name = "Master Playback Switch", \ |
| 11561 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11562 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11563 | } |
| 11564 | |
| 11565 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11566 | ALC262_HIPPO_MASTER_SWITCH, |
| 11567 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11568 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11569 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11570 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11571 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11574 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11575 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11576 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11577 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11578 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11579 | { } /* end */ |
| 11580 | }; |
| 11581 | |
| 11582 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11583 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11584 | ALC262_HIPPO_MASTER_SWITCH, |
| 11585 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11586 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11587 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11588 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11591 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11592 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11593 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11594 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11595 | { } /* end */ |
| 11596 | }; |
| 11597 | |
| 11598 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11599 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11600 | { |
| 11601 | struct alc_spec *spec = codec->spec; |
| 11602 | |
| 11603 | spec->autocfg.hp_pins[0] = 0x15; |
| 11604 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11605 | spec->automute = 1; |
| 11606 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11607 | } |
| 11608 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11609 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11610 | { |
| 11611 | struct alc_spec *spec = codec->spec; |
| 11612 | |
| 11613 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11614 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11615 | spec->automute = 1; |
| 11616 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11617 | } |
| 11618 | |
| 11619 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11620 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11621 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11622 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11625 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11626 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11627 | { } /* end */ |
| 11628 | }; |
| 11629 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11630 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11631 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11632 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11636 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11637 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11638 | { } /* end */ |
| 11639 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11640 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11641 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11642 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11643 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11644 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11645 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11646 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11647 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11648 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11649 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11650 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11651 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11652 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11653 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11654 | { } /* end */ |
| 11655 | }; |
| 11656 | |
| 11657 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11658 | /* Headphone automute */ |
| 11659 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11660 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11661 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11662 | |
| 11663 | /* P11 AUX_IN, white 4-pin connector */ |
| 11664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11665 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11666 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11667 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11668 | |
| 11669 | {} |
| 11670 | }; |
| 11671 | |
| 11672 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11673 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11674 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11675 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11676 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11677 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11678 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11679 | spec->automute = 1; |
| 11680 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11681 | } |
| 11682 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11683 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11684 | #define alc262_capture_mixer alc882_capture_mixer |
| 11685 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11686 | |
| 11687 | /* |
| 11688 | * generic initialization of ADC, input mixers and output mixers |
| 11689 | */ |
| 11690 | static struct hda_verb alc262_init_verbs[] = { |
| 11691 | /* |
| 11692 | * Unmute ADC0-2 and set the default input to mic-in |
| 11693 | */ |
| 11694 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11696 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11697 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11698 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11699 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11700 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11701 | /* 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] | 11702 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11703 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11704 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11705 | */ |
| 11706 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11707 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11708 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11709 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11710 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11711 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11712 | |
| 11713 | /* |
| 11714 | * Set up output mixers (0x0c - 0x0e) |
| 11715 | */ |
| 11716 | /* set vol=0 to output mixers */ |
| 11717 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11718 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11719 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11720 | /* set up input amps for analog loopback */ |
| 11721 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11722 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11723 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11724 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11725 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11726 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11727 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11728 | |
| 11729 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11730 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11731 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11732 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11733 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11734 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11735 | |
| 11736 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11738 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11739 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11740 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11741 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11742 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11743 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11744 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11745 | /* FIXME: use matrix-type input source selection */ |
| 11746 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11747 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11752 | /* Input mixer2 */ |
| 11753 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11754 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11755 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11756 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11757 | /* Input mixer3 */ |
| 11758 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11762 | |
| 11763 | { } |
| 11764 | }; |
| 11765 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11766 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11767 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11768 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11769 | { } |
| 11770 | }; |
| 11771 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11772 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11773 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11774 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11775 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11776 | |
| 11777 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11778 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11779 | {} |
| 11780 | }; |
| 11781 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11782 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11783 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11784 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11785 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11786 | |
| 11787 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11789 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11790 | }; |
| 11791 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11792 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11793 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11794 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11798 | { } /* end */ |
| 11799 | }; |
| 11800 | |
| 11801 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11802 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11803 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11805 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11806 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11807 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11808 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11809 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11810 | {} |
| 11811 | }; |
| 11812 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11813 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11814 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11815 | struct alc_spec *spec = codec->spec; |
| 11816 | |
| 11817 | spec->autocfg.hp_pins[0] = 0x15; |
| 11818 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11819 | spec->ext_mic.pin = 0x18; |
| 11820 | spec->ext_mic.mux_idx = 0; |
| 11821 | spec->int_mic.pin = 0x12; |
| 11822 | spec->int_mic.mux_idx = 9; |
| 11823 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11824 | spec->automute = 1; |
| 11825 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11826 | } |
| 11827 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11828 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11829 | * nec model |
| 11830 | * 0x15 = headphone |
| 11831 | * 0x16 = internal speaker |
| 11832 | * 0x18 = external mic |
| 11833 | */ |
| 11834 | |
| 11835 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11836 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11837 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11838 | |
| 11839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11841 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11842 | |
| 11843 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11845 | { } /* end */ |
| 11846 | }; |
| 11847 | |
| 11848 | static struct hda_verb alc262_nec_verbs[] = { |
| 11849 | /* Unmute Speaker */ |
| 11850 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11851 | |
| 11852 | /* Headphone */ |
| 11853 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11854 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11855 | |
| 11856 | /* External mic to headphone */ |
| 11857 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11858 | /* External mic to speaker */ |
| 11859 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11860 | {} |
| 11861 | }; |
| 11862 | |
| 11863 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11864 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11865 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11866 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11867 | */ |
| 11868 | |
| 11869 | #define ALC_HP_EVENT 0x37 |
| 11870 | |
| 11871 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11872 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11873 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11874 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11875 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11876 | {} |
| 11877 | }; |
| 11878 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11879 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11880 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11881 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11882 | {} |
| 11883 | }; |
| 11884 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11885 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11886 | /* Front Mic pin: input vref at 50% */ |
| 11887 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11888 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11889 | {} |
| 11890 | }; |
| 11891 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11892 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11893 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11894 | .items = { |
| 11895 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11896 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11897 | { "CD", 0x4 }, |
| 11898 | }, |
| 11899 | }; |
| 11900 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11901 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11902 | .num_items = 5, |
| 11903 | .items = { |
| 11904 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11905 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11906 | { "Line", 0x2 }, |
| 11907 | { "CD", 0x4 }, |
| 11908 | { "AUX IN", 0x6 }, |
| 11909 | }, |
| 11910 | }; |
| 11911 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11912 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11913 | .num_items = 4, |
| 11914 | .items = { |
| 11915 | { "Mic", 0x0 }, |
| 11916 | { "Front Mic", 0x2 }, |
| 11917 | { "Line", 0x1 }, |
| 11918 | { "CD", 0x4 }, |
| 11919 | }, |
| 11920 | }; |
| 11921 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11922 | static void alc262_fujitsu_setup(struct hda_codec *codec) |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11923 | { |
| 11924 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11925 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11926 | spec->autocfg.hp_pins[0] = 0x14; |
| 11927 | spec->autocfg.hp_pins[1] = 0x1b; |
| 11928 | spec->autocfg.speaker_pins[0] = 0x15; |
| 11929 | spec->automute = 1; |
| 11930 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11931 | } |
| 11932 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11933 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11934 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11935 | .ops = &snd_hda_bind_vol, |
| 11936 | .values = { |
| 11937 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11938 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11939 | 0 |
| 11940 | }, |
| 11941 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11942 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11943 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11944 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11945 | { |
| 11946 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11947 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11948 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 11949 | .info = snd_ctl_boolean_mono_info, |
| 11950 | .get = alc262_hp_master_sw_get, |
| 11951 | .put = alc262_hp_master_sw_put, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11952 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11953 | { |
| 11954 | .iface = NID_MAPPING, |
| 11955 | .name = "Master Playback Switch", |
| 11956 | .private_value = 0x1b, |
| 11957 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11958 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11959 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11960 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11963 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11964 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11965 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11966 | { } /* end */ |
| 11967 | }; |
| 11968 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11969 | static void alc262_lenovo_3000_setup(struct hda_codec *codec) |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11970 | { |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11971 | struct alc_spec *spec = codec->spec; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11972 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11973 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11974 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11975 | spec->autocfg.speaker_pins[1] = 0x16; |
| 11976 | spec->automute = 1; |
| 11977 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11978 | } |
| 11979 | |
| 11980 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11981 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11982 | { |
| 11983 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11984 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11985 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b, |
| 11986 | .info = snd_ctl_boolean_mono_info, |
| 11987 | .get = alc262_hp_master_sw_get, |
| 11988 | .put = alc262_hp_master_sw_put, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11989 | }, |
| 11990 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11991 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11992 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11995 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11996 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11997 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11998 | { } /* end */ |
| 11999 | }; |
| 12000 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12001 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 12002 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12003 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12004 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12005 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12006 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12007 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12008 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12009 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12010 | { } /* end */ |
| 12011 | }; |
| 12012 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12013 | /* additional init verbs for Benq laptops */ |
| 12014 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 12015 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12016 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 12017 | {} |
| 12018 | }; |
| 12019 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12020 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 12021 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12022 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12023 | |
| 12024 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12025 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 12026 | {} |
| 12027 | }; |
| 12028 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12029 | /* Samsung Q1 Ultra Vista model setup */ |
| 12030 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12031 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 12032 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12033 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12035 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12036 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12037 | { } /* end */ |
| 12038 | }; |
| 12039 | |
| 12040 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12041 | /* output mixer */ |
| 12042 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12043 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12044 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12045 | /* speaker */ |
| 12046 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12047 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12048 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12049 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12050 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12051 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12052 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12053 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12054 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12055 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12056 | /* internal mic */ |
| 12057 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12058 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12059 | /* ADC, choose mic */ |
| 12060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12066 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12067 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12068 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12070 | {} |
| 12071 | }; |
| 12072 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12073 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12074 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12075 | { |
| 12076 | struct alc_spec *spec = codec->spec; |
| 12077 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12078 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12079 | mute = 0; |
| 12080 | /* auto-mute only when HP is used as HP */ |
| 12081 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12082 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12083 | if (spec->jack_present) |
| 12084 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12085 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12086 | /* mute/unmute internal speaker */ |
| 12087 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12088 | HDA_AMP_MUTE, mute); |
| 12089 | /* mute/unmute HP */ |
| 12090 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12091 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12092 | } |
| 12093 | |
| 12094 | /* unsolicited event for HP jack sensing */ |
| 12095 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12096 | unsigned int res) |
| 12097 | { |
| 12098 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12099 | return; |
| 12100 | alc262_ultra_automute(codec); |
| 12101 | } |
| 12102 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12103 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12104 | .num_items = 2, |
| 12105 | .items = { |
| 12106 | { "Mic", 0x1 }, |
| 12107 | { "Headphone", 0x7 }, |
| 12108 | }, |
| 12109 | }; |
| 12110 | |
| 12111 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12112 | struct snd_ctl_elem_value *ucontrol) |
| 12113 | { |
| 12114 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12115 | struct alc_spec *spec = codec->spec; |
| 12116 | int ret; |
| 12117 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12118 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12119 | if (!ret) |
| 12120 | return 0; |
| 12121 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12122 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12123 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12124 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12125 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12126 | return ret; |
| 12127 | } |
| 12128 | |
| 12129 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12130 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12131 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12132 | { |
| 12133 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12134 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12135 | .info = alc_mux_enum_info, |
| 12136 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12137 | .put = alc262_ultra_mux_enum_put, |
| 12138 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12139 | { |
| 12140 | .iface = NID_MAPPING, |
| 12141 | .name = "Capture Source", |
| 12142 | .private_value = 0x15, |
| 12143 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12144 | { } /* end */ |
| 12145 | }; |
| 12146 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12147 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12148 | * and thus it's bound with a different mixer. |
| 12149 | * This function returns which mixer amp should be used. |
| 12150 | */ |
| 12151 | static int alc262_check_volbit(hda_nid_t nid) |
| 12152 | { |
| 12153 | if (!nid) |
| 12154 | return 0; |
| 12155 | else if (nid == 0x16) |
| 12156 | return 2; |
| 12157 | else |
| 12158 | return 1; |
| 12159 | } |
| 12160 | |
| 12161 | 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] | 12162 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12163 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12164 | unsigned long val; |
| 12165 | int vbit; |
| 12166 | |
| 12167 | vbit = alc262_check_volbit(nid); |
| 12168 | if (!vbit) |
| 12169 | return 0; |
| 12170 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12171 | return 0; |
| 12172 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12173 | if (vbit == 2) |
| 12174 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12175 | else |
| 12176 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12177 | 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] | 12178 | } |
| 12179 | |
| 12180 | 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] | 12181 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12182 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12183 | unsigned long val; |
| 12184 | |
| 12185 | if (!nid) |
| 12186 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12187 | if (nid == 0x16) |
| 12188 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12189 | else |
| 12190 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12191 | 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] | 12192 | } |
| 12193 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12194 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12195 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12196 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12197 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12198 | const char *pfx; |
| 12199 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12200 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12201 | |
| 12202 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12203 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12204 | spec->multiout.dac_nids[0] = 2; |
| 12205 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 12206 | pfx = alc_get_line_out_pfx(spec, true); |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12207 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12208 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12209 | for (i = 0; i < 2; i++) { |
| 12210 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12211 | if (err < 0) |
| 12212 | return err; |
| 12213 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12214 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12215 | "Speaker", i); |
| 12216 | if (err < 0) |
| 12217 | return err; |
| 12218 | } |
| 12219 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12220 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12221 | "Headphone", i); |
| 12222 | if (err < 0) |
| 12223 | return err; |
| 12224 | } |
| 12225 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12226 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12227 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12228 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12229 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12230 | if (vbits == 1 || vbits == 2) |
| 12231 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12232 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12233 | for (i = 0; i < 2; i++) { |
| 12234 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12235 | &vbits, i); |
| 12236 | if (err < 0) |
| 12237 | return err; |
| 12238 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12239 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12240 | "Speaker", &vbits, i); |
| 12241 | if (err < 0) |
| 12242 | return err; |
| 12243 | } |
| 12244 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12245 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12246 | "Headphone", &vbits, i); |
| 12247 | if (err < 0) |
| 12248 | return err; |
| 12249 | } |
| 12250 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12251 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12252 | } |
| 12253 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12254 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12255 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12256 | |
| 12257 | /* |
| 12258 | * generic initialization of ADC, input mixers and output mixers |
| 12259 | */ |
| 12260 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12261 | /* |
| 12262 | * Unmute ADC0-2 and set the default input to mic-in |
| 12263 | */ |
| 12264 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12265 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12266 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12268 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12270 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12271 | /* 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] | 12272 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12273 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12274 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12275 | */ |
| 12276 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12279 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12280 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12281 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12282 | |
| 12283 | /* |
| 12284 | * Set up output mixers (0x0c - 0x0f) |
| 12285 | */ |
| 12286 | /* set vol=0 to output mixers */ |
| 12287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12288 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12290 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12291 | /* set up input amps for analog loopback */ |
| 12292 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12296 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12299 | |
| 12300 | /* FIXME: use matrix-type input source selection */ |
| 12301 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12302 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12303 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12304 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12305 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12306 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12307 | /* Input mixer2 */ |
| 12308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12309 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12310 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12311 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12312 | /* Input mixer3 */ |
| 12313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12317 | |
| 12318 | { } |
| 12319 | }; |
| 12320 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12321 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12322 | /* |
| 12323 | * Unmute ADC0-2 and set the default input to mic-in |
| 12324 | */ |
| 12325 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12327 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12328 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12329 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12330 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12331 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12332 | /* 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] | 12333 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12334 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12335 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12336 | */ |
| 12337 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12338 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12340 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12341 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12342 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12343 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12344 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12345 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12346 | /* |
| 12347 | * Set up output mixers (0x0c - 0x0e) |
| 12348 | */ |
| 12349 | /* set vol=0 to output mixers */ |
| 12350 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12351 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12352 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12353 | |
| 12354 | /* set up input amps for analog loopback */ |
| 12355 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12356 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12357 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12358 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12359 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12360 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12361 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12362 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12363 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12364 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12366 | |
| 12367 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12368 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12369 | |
| 12370 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12371 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12372 | |
| 12373 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12374 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12375 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12376 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12377 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12378 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12379 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12380 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12381 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12382 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12383 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12384 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12385 | |
| 12386 | |
| 12387 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12388 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12389 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12390 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12391 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12392 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12393 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12394 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12395 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12396 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12397 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12398 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12399 | /* Input mixer2 */ |
| 12400 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12401 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12402 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12403 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12404 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12405 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12406 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12407 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12409 | /* Input mixer3 */ |
| 12410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12412 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12415 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12417 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12418 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12419 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12420 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12421 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12422 | { } |
| 12423 | }; |
| 12424 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12425 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12426 | /* |
| 12427 | * Unmute ADC0-2 and set the default input to mic-in |
| 12428 | */ |
| 12429 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12430 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12431 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12432 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12433 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12434 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12435 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12436 | /* 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] | 12437 | * mixer widget |
| 12438 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12439 | * panel mic (mic 2) |
| 12440 | */ |
| 12441 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12442 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12443 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12444 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12446 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12450 | /* |
| 12451 | * Set up output mixers (0x0c - 0x0e) |
| 12452 | */ |
| 12453 | /* set vol=0 to output mixers */ |
| 12454 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12455 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12456 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12457 | |
| 12458 | /* set up input amps for analog loopback */ |
| 12459 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12460 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12462 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12463 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12464 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12465 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12466 | |
| 12467 | |
| 12468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12469 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12470 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12471 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12472 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12473 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12474 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12475 | |
| 12476 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12477 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12478 | |
| 12479 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12480 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12481 | |
| 12482 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12483 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12484 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12485 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12486 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12487 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12488 | |
| 12489 | /* FIXME: use matrix-type input source selection */ |
| 12490 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12491 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12492 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12493 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12494 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12495 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12496 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12497 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12498 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12499 | /* Input mixer2 */ |
| 12500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12502 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12503 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12504 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12505 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12506 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12507 | /* Input mixer3 */ |
| 12508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12509 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12511 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12512 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12513 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12514 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12515 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12516 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12517 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12518 | { } |
| 12519 | }; |
| 12520 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12521 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12522 | |
| 12523 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12524 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12525 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12526 | |
| 12527 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12528 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12529 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12530 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12531 | |
| 12532 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12533 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12534 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12535 | {} |
| 12536 | }; |
| 12537 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12538 | /* |
| 12539 | * Pin config fixes |
| 12540 | */ |
| 12541 | enum { |
| 12542 | PINFIX_FSC_H270, |
| 12543 | }; |
| 12544 | |
| 12545 | static const struct alc_fixup alc262_fixups[] = { |
| 12546 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12547 | .type = ALC_FIXUP_PINS, |
| 12548 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12549 | { 0x14, 0x99130110 }, /* speaker */ |
| 12550 | { 0x15, 0x0221142f }, /* front HP */ |
| 12551 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12552 | { } |
| 12553 | } |
| 12554 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12555 | }; |
| 12556 | |
| 12557 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12558 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12559 | {} |
| 12560 | }; |
| 12561 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12562 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12563 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12564 | #define alc262_loopbacks alc880_loopbacks |
| 12565 | #endif |
| 12566 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12567 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12568 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12569 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12570 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12571 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12572 | |
| 12573 | /* |
| 12574 | * BIOS auto configuration |
| 12575 | */ |
| 12576 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12577 | { |
| 12578 | struct alc_spec *spec = codec->spec; |
| 12579 | int err; |
| 12580 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12581 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12582 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12583 | alc262_ignore); |
| 12584 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12585 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12586 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12587 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12588 | spec->multiout.max_channels = 2; |
| 12589 | spec->no_analog = 1; |
| 12590 | goto dig_only; |
| 12591 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12592 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12593 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12594 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12595 | if (err < 0) |
| 12596 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12597 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12598 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12599 | return err; |
| 12600 | |
| 12601 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12602 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12603 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12604 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12605 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12606 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12607 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12608 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12609 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12610 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12611 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12612 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12613 | err = alc_auto_add_mic_boost(codec); |
| 12614 | if (err < 0) |
| 12615 | return err; |
| 12616 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12617 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12619 | return 1; |
| 12620 | } |
| 12621 | |
| 12622 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12623 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12624 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12625 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12626 | |
| 12627 | |
| 12628 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12629 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12630 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12631 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12632 | alc262_auto_init_multi_out(codec); |
| 12633 | alc262_auto_init_hp_out(codec); |
| 12634 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12635 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12636 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12637 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12638 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12639 | } |
| 12640 | |
| 12641 | /* |
| 12642 | * configuration and preset |
| 12643 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12644 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12645 | [ALC262_BASIC] = "basic", |
| 12646 | [ALC262_HIPPO] = "hippo", |
| 12647 | [ALC262_HIPPO_1] = "hippo_1", |
| 12648 | [ALC262_FUJITSU] = "fujitsu", |
| 12649 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12650 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12651 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12652 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12653 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12654 | [ALC262_BENQ_T31] = "benq-t31", |
| 12655 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12656 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12657 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12658 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12659 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12660 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12661 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12662 | [ALC262_AUTO] = "auto", |
| 12663 | }; |
| 12664 | |
| 12665 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12666 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12667 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12668 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12669 | ALC262_HP_BPC), |
| 12670 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12671 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12672 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12673 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12674 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12675 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12676 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12677 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12678 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12679 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12680 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12681 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12682 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12683 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12684 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12685 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12686 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12687 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12688 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12689 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12690 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12691 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12692 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12693 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12694 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12695 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12696 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12697 | #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] | 12698 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12699 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12700 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12701 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12702 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12703 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12704 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12705 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12706 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12707 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12708 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12709 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12710 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12711 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12712 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12713 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12714 | {} |
| 12715 | }; |
| 12716 | |
| 12717 | static struct alc_config_preset alc262_presets[] = { |
| 12718 | [ALC262_BASIC] = { |
| 12719 | .mixers = { alc262_base_mixer }, |
| 12720 | .init_verbs = { alc262_init_verbs }, |
| 12721 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12722 | .dac_nids = alc262_dac_nids, |
| 12723 | .hp_nid = 0x03, |
| 12724 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12725 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12726 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12727 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12728 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12729 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12730 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12731 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12732 | .dac_nids = alc262_dac_nids, |
| 12733 | .hp_nid = 0x03, |
| 12734 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12735 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12736 | .channel_mode = alc262_modes, |
| 12737 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12738 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12739 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12740 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12741 | }, |
| 12742 | [ALC262_HIPPO_1] = { |
| 12743 | .mixers = { alc262_hippo1_mixer }, |
| 12744 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12745 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12746 | .dac_nids = alc262_dac_nids, |
| 12747 | .hp_nid = 0x02, |
| 12748 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12749 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12750 | .channel_mode = alc262_modes, |
| 12751 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12752 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12753 | .setup = alc262_hippo1_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12754 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12755 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12756 | [ALC262_FUJITSU] = { |
| 12757 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12758 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12759 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12760 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12761 | .dac_nids = alc262_dac_nids, |
| 12762 | .hp_nid = 0x03, |
| 12763 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12764 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12765 | .channel_mode = alc262_modes, |
| 12766 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12767 | .unsol_event = alc_sku_unsol_event, |
| 12768 | .setup = alc262_fujitsu_setup, |
| 12769 | .init_hook = alc_inithook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12770 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12771 | [ALC262_HP_BPC] = { |
| 12772 | .mixers = { alc262_HP_BPC_mixer }, |
| 12773 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12774 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12775 | .dac_nids = alc262_dac_nids, |
| 12776 | .hp_nid = 0x03, |
| 12777 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12778 | .channel_mode = alc262_modes, |
| 12779 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12780 | .unsol_event = alc_sku_unsol_event, |
| 12781 | .setup = alc262_hp_bpc_setup, |
| 12782 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12783 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12784 | [ALC262_HP_BPC_D7000_WF] = { |
| 12785 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12786 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12787 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12788 | .dac_nids = alc262_dac_nids, |
| 12789 | .hp_nid = 0x03, |
| 12790 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12791 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12792 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12793 | .unsol_event = alc_sku_unsol_event, |
| 12794 | .setup = alc262_hp_wildwest_setup, |
| 12795 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12796 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12797 | [ALC262_HP_BPC_D7000_WL] = { |
| 12798 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12799 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12800 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12801 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12802 | .dac_nids = alc262_dac_nids, |
| 12803 | .hp_nid = 0x03, |
| 12804 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12805 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12806 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12807 | .unsol_event = alc_sku_unsol_event, |
| 12808 | .setup = alc262_hp_wildwest_setup, |
| 12809 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12810 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12811 | [ALC262_HP_TC_T5735] = { |
| 12812 | .mixers = { alc262_hp_t5735_mixer }, |
| 12813 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12814 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12815 | .dac_nids = alc262_dac_nids, |
| 12816 | .hp_nid = 0x03, |
| 12817 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12818 | .channel_mode = alc262_modes, |
| 12819 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12820 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12821 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12822 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12823 | }, |
| 12824 | [ALC262_HP_RP5700] = { |
| 12825 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12826 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12827 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12828 | .dac_nids = alc262_dac_nids, |
| 12829 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12830 | .channel_mode = alc262_modes, |
| 12831 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12832 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12833 | [ALC262_BENQ_ED8] = { |
| 12834 | .mixers = { alc262_base_mixer }, |
| 12835 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12836 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12837 | .dac_nids = alc262_dac_nids, |
| 12838 | .hp_nid = 0x03, |
| 12839 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12840 | .channel_mode = alc262_modes, |
| 12841 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12842 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12843 | [ALC262_SONY_ASSAMD] = { |
| 12844 | .mixers = { alc262_sony_mixer }, |
| 12845 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12846 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12847 | .dac_nids = alc262_dac_nids, |
| 12848 | .hp_nid = 0x02, |
| 12849 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12850 | .channel_mode = alc262_modes, |
| 12851 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12852 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12853 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12854 | .init_hook = alc_inithook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12855 | }, |
| 12856 | [ALC262_BENQ_T31] = { |
| 12857 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12858 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12859 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12860 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12861 | .dac_nids = alc262_dac_nids, |
| 12862 | .hp_nid = 0x03, |
| 12863 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12864 | .channel_mode = alc262_modes, |
| 12865 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12866 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12867 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12868 | .init_hook = alc_inithook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12869 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12870 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12871 | .mixers = { alc262_ultra_mixer }, |
| 12872 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12873 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12874 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12875 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12876 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12877 | .channel_mode = alc262_modes, |
| 12878 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12879 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12880 | .capsrc_nids = alc262_capsrc_nids, |
| 12881 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12882 | .unsol_event = alc262_ultra_unsol_event, |
| 12883 | .init_hook = alc262_ultra_automute, |
| 12884 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12885 | [ALC262_LENOVO_3000] = { |
| 12886 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12887 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12888 | alc262_lenovo_3000_unsol_verbs, |
| 12889 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12890 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12891 | .dac_nids = alc262_dac_nids, |
| 12892 | .hp_nid = 0x03, |
| 12893 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12894 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12895 | .channel_mode = alc262_modes, |
| 12896 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12897 | .unsol_event = alc_sku_unsol_event, |
| 12898 | .setup = alc262_lenovo_3000_setup, |
| 12899 | .init_hook = alc_inithook, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12900 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12901 | [ALC262_NEC] = { |
| 12902 | .mixers = { alc262_nec_mixer }, |
| 12903 | .init_verbs = { alc262_nec_verbs }, |
| 12904 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12905 | .dac_nids = alc262_dac_nids, |
| 12906 | .hp_nid = 0x03, |
| 12907 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12908 | .channel_mode = alc262_modes, |
| 12909 | .input_mux = &alc262_capture_source, |
| 12910 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12911 | [ALC262_TOSHIBA_S06] = { |
| 12912 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12913 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12914 | alc262_eapd_verbs }, |
| 12915 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12916 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12917 | .dac_nids = alc262_dac_nids, |
| 12918 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12919 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12920 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12921 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12922 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12923 | .unsol_event = alc_sku_unsol_event, |
| 12924 | .setup = alc262_toshiba_s06_setup, |
| 12925 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12926 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12927 | [ALC262_TOSHIBA_RX1] = { |
| 12928 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12929 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12930 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12931 | .dac_nids = alc262_dac_nids, |
| 12932 | .hp_nid = 0x03, |
| 12933 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12934 | .channel_mode = alc262_modes, |
| 12935 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12936 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12937 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12938 | .init_hook = alc_inithook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12939 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12940 | [ALC262_TYAN] = { |
| 12941 | .mixers = { alc262_tyan_mixer }, |
| 12942 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12943 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12944 | .dac_nids = alc262_dac_nids, |
| 12945 | .hp_nid = 0x02, |
| 12946 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12947 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12948 | .channel_mode = alc262_modes, |
| 12949 | .input_mux = &alc262_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12950 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12951 | .setup = alc262_tyan_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12952 | .init_hook = alc_hp_automute, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12953 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12954 | }; |
| 12955 | |
| 12956 | static int patch_alc262(struct hda_codec *codec) |
| 12957 | { |
| 12958 | struct alc_spec *spec; |
| 12959 | int board_config; |
| 12960 | int err; |
| 12961 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12962 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12963 | if (spec == NULL) |
| 12964 | return -ENOMEM; |
| 12965 | |
| 12966 | codec->spec = spec; |
| 12967 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12968 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12969 | * under-run |
| 12970 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12971 | { |
| 12972 | int tmp; |
| 12973 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12974 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12975 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12976 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12977 | } |
| 12978 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12979 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12980 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12981 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12982 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12983 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12984 | alc262_models, |
| 12985 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12986 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12987 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12988 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12989 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12990 | board_config = ALC262_AUTO; |
| 12991 | } |
| 12992 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12993 | if (board_config == ALC262_AUTO) { |
| 12994 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12995 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12996 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12997 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12998 | if (board_config == ALC262_AUTO) { |
| 12999 | /* automatic parse from the BIOS config */ |
| 13000 | err = alc262_parse_auto_config(codec); |
| 13001 | if (err < 0) { |
| 13002 | alc_free(codec); |
| 13003 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13004 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13005 | printk(KERN_INFO |
| 13006 | "hda_codec: Cannot set up configuration " |
| 13007 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13008 | board_config = ALC262_BASIC; |
| 13009 | } |
| 13010 | } |
| 13011 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13012 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13013 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13014 | if (err < 0) { |
| 13015 | alc_free(codec); |
| 13016 | return err; |
| 13017 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13018 | } |
| 13019 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13020 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13021 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13022 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13023 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 13024 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13025 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13026 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 13027 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 13028 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13029 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13030 | int i; |
| 13031 | /* check whether the digital-mic has to be supported */ |
| 13032 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 13033 | if (spec->input_mux->items[i].index >= 9) |
| 13034 | break; |
| 13035 | } |
| 13036 | if (i < spec->input_mux->num_items) { |
| 13037 | /* use only ADC0 */ |
| 13038 | spec->adc_nids = alc262_dmic_adc_nids; |
| 13039 | spec->num_adc_nids = 1; |
| 13040 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13041 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13042 | /* all analog inputs */ |
| 13043 | /* check whether NID 0x07 is valid */ |
| 13044 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 13045 | |
| 13046 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13047 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13048 | if (wcap != AC_WID_AUD_IN) { |
| 13049 | spec->adc_nids = alc262_adc_nids_alt; |
| 13050 | spec->num_adc_nids = |
| 13051 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13052 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13053 | } else { |
| 13054 | spec->adc_nids = alc262_adc_nids; |
| 13055 | spec->num_adc_nids = |
| 13056 | ARRAY_SIZE(alc262_adc_nids); |
| 13057 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13058 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13059 | } |
| 13060 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13061 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13062 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13063 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13064 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13065 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13066 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13067 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13068 | spec->vmaster_nid = 0x0c; |
| 13069 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13070 | codec->patch_ops = alc_patch_ops; |
| 13071 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13072 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 13073 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13074 | |
| 13075 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13076 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13077 | if (!spec->loopback.amplist) |
| 13078 | spec->loopback.amplist = alc262_loopbacks; |
| 13079 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13081 | return 0; |
| 13082 | } |
| 13083 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13084 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13085 | * ALC268 channel source setting (2 channel) |
| 13086 | */ |
| 13087 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13088 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13089 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13090 | static hda_nid_t alc268_dac_nids[2] = { |
| 13091 | /* front, hp */ |
| 13092 | 0x02, 0x03 |
| 13093 | }; |
| 13094 | |
| 13095 | static hda_nid_t alc268_adc_nids[2] = { |
| 13096 | /* ADC0-1 */ |
| 13097 | 0x08, 0x07 |
| 13098 | }; |
| 13099 | |
| 13100 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13101 | /* ADC0 */ |
| 13102 | 0x08 |
| 13103 | }; |
| 13104 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13105 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13106 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13107 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13108 | /* output mixer control */ |
| 13109 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13110 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13111 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13112 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13113 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13114 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13115 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13116 | { } |
| 13117 | }; |
| 13118 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13119 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13120 | /* output mixer control */ |
| 13121 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13122 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13123 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13124 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13125 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13126 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13127 | { } |
| 13128 | }; |
| 13129 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13130 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13131 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13132 | .ops = &snd_hda_bind_sw, |
| 13133 | .values = { |
| 13134 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13135 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13136 | 0 |
| 13137 | }, |
| 13138 | }; |
| 13139 | |
| 13140 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13141 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13142 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13143 | { } |
| 13144 | }; |
| 13145 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13146 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13147 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13148 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13149 | { } |
| 13150 | }; |
| 13151 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13152 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13153 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13154 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13155 | { } /* end */ |
| 13156 | }; |
| 13157 | |
| 13158 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13159 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13160 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13161 | .ops = &snd_hda_bind_vol, |
| 13162 | .values = { |
| 13163 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13164 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13165 | 0 |
| 13166 | }, |
| 13167 | }; |
| 13168 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13169 | static void alc268_acer_setup(struct hda_codec *codec) |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13170 | { |
| 13171 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13172 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13173 | spec->autocfg.hp_pins[0] = 0x14; |
| 13174 | spec->autocfg.speaker_pins[0] = 0x15; |
| 13175 | spec->automute = 1; |
| 13176 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13177 | } |
| 13178 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13179 | #define alc268_acer_master_sw_get alc262_hp_master_sw_get |
| 13180 | #define alc268_acer_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13181 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13182 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13183 | /* output mixer control */ |
| 13184 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13185 | { |
| 13186 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13187 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13188 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x15, |
| 13189 | .info = snd_ctl_boolean_mono_info, |
| 13190 | .get = alc268_acer_master_sw_get, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13191 | .put = alc268_acer_master_sw_put, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13192 | }, |
| 13193 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13194 | { } |
| 13195 | }; |
| 13196 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13197 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13198 | /* output mixer control */ |
| 13199 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13200 | { |
| 13201 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13202 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13203 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13204 | .info = snd_ctl_boolean_mono_info, |
| 13205 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13206 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13207 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13208 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13209 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13210 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13211 | { } |
| 13212 | }; |
| 13213 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13214 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13215 | /* output mixer control */ |
| 13216 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13217 | { |
| 13218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13219 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13220 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13221 | .info = snd_ctl_boolean_mono_info, |
| 13222 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13223 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13224 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13225 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13226 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13227 | { } |
| 13228 | }; |
| 13229 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13230 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13231 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13233 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13234 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13235 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13237 | { } |
| 13238 | }; |
| 13239 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13240 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13241 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13242 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13243 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13244 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13245 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13246 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13247 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13248 | { } |
| 13249 | }; |
| 13250 | |
| 13251 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13252 | #define alc268_toshiba_setup alc262_hippo_setup |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13253 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13254 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13255 | { |
| 13256 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13257 | spec->autocfg.hp_pins[0] = 0x15; |
| 13258 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13259 | spec->automute_mixer_nid[0] = 0x0f; |
| 13260 | spec->automute = 1; |
| 13261 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13262 | spec->ext_mic.pin = 0x18; |
| 13263 | spec->ext_mic.mux_idx = 0; |
| 13264 | spec->int_mic.pin = 0x12; |
| 13265 | spec->int_mic.mux_idx = 6; |
| 13266 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13267 | } |
| 13268 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13269 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13270 | /* output mixer control */ |
| 13271 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13272 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13273 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13274 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13275 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13276 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13277 | { } |
| 13278 | }; |
| 13279 | |
| 13280 | static struct hda_verb alc268_dell_verbs[] = { |
| 13281 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13283 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13284 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13285 | { } |
| 13286 | }; |
| 13287 | |
| 13288 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13289 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13290 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13291 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13292 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13293 | spec->autocfg.hp_pins[0] = 0x15; |
| 13294 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13295 | spec->ext_mic.pin = 0x18; |
| 13296 | spec->ext_mic.mux_idx = 0; |
| 13297 | spec->int_mic.pin = 0x19; |
| 13298 | spec->int_mic.mux_idx = 1; |
| 13299 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13300 | spec->automute = 1; |
| 13301 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13302 | } |
| 13303 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13304 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13305 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13306 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13307 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13308 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13309 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13310 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13311 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13312 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13313 | { } |
| 13314 | }; |
| 13315 | |
| 13316 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13317 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13318 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13319 | { } |
| 13320 | }; |
| 13321 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13322 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13323 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13324 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13325 | spec->autocfg.hp_pins[0] = 0x15; |
| 13326 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13327 | spec->ext_mic.pin = 0x18; |
| 13328 | spec->ext_mic.mux_idx = 0; |
| 13329 | spec->int_mic.pin = 0x19; |
| 13330 | spec->int_mic.mux_idx = 1; |
| 13331 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13332 | spec->automute = 1; |
| 13333 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13334 | } |
| 13335 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13336 | /* |
| 13337 | * generic initialization of ADC, input mixers and output mixers |
| 13338 | */ |
| 13339 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13340 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13341 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13342 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13343 | |
| 13344 | /* |
| 13345 | * Set up output mixers (0x0c - 0x0e) |
| 13346 | */ |
| 13347 | /* set vol=0 to output mixers */ |
| 13348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13349 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13350 | |
| 13351 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13352 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13353 | |
| 13354 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13355 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13356 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13357 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13358 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13359 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13360 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13361 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13362 | |
| 13363 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13365 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13366 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13367 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13368 | |
| 13369 | /* set PCBEEP vol = 0, mute connections */ |
| 13370 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13371 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13372 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13373 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13374 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13375 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13376 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13377 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13378 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13379 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13380 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13381 | { } |
| 13382 | }; |
| 13383 | |
| 13384 | /* |
| 13385 | * generic initialization of ADC, input mixers and output mixers |
| 13386 | */ |
| 13387 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13388 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13389 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13390 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13391 | |
| 13392 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13393 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13394 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13395 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13396 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13397 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13400 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13401 | |
| 13402 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13403 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13404 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13405 | /* set PCBEEP vol = 0, mute connections */ |
| 13406 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13407 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13408 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13409 | |
| 13410 | { } |
| 13411 | }; |
| 13412 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13413 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13414 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13415 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13416 | { } /* end */ |
| 13417 | }; |
| 13418 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13419 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13420 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13421 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13422 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13423 | { } /* end */ |
| 13424 | }; |
| 13425 | |
| 13426 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13427 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13428 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13429 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13430 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13431 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13432 | { } /* end */ |
| 13433 | }; |
| 13434 | |
| 13435 | static struct hda_input_mux alc268_capture_source = { |
| 13436 | .num_items = 4, |
| 13437 | .items = { |
| 13438 | { "Mic", 0x0 }, |
| 13439 | { "Front Mic", 0x1 }, |
| 13440 | { "Line", 0x2 }, |
| 13441 | { "CD", 0x3 }, |
| 13442 | }, |
| 13443 | }; |
| 13444 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13445 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13446 | .num_items = 3, |
| 13447 | .items = { |
| 13448 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13449 | { "Internal Mic", 0x1 }, |
| 13450 | { "Line", 0x2 }, |
| 13451 | }, |
| 13452 | }; |
| 13453 | |
| 13454 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13455 | .num_items = 3, |
| 13456 | .items = { |
| 13457 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13458 | { "Internal Mic", 0x6 }, |
| 13459 | { "Line", 0x2 }, |
| 13460 | }, |
| 13461 | }; |
| 13462 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13463 | #ifdef CONFIG_SND_DEBUG |
| 13464 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13465 | /* Volume widgets */ |
| 13466 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13467 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13468 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13469 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13470 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13471 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13472 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13473 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13474 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13475 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13476 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13477 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13478 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13479 | /* The below appears problematic on some hardwares */ |
| 13480 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13481 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13482 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13483 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13484 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13485 | |
| 13486 | /* Modes for retasking pin widgets */ |
| 13487 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13488 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13489 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13490 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13491 | |
| 13492 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13493 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13494 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13495 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13496 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13497 | |
| 13498 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13499 | * The ALC268 does not have an SPDIF input. |
| 13500 | */ |
| 13501 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13502 | |
| 13503 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13504 | * this output to turn on an external amplifier. |
| 13505 | */ |
| 13506 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13507 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13508 | |
| 13509 | { } /* end */ |
| 13510 | }; |
| 13511 | #endif |
| 13512 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13513 | /* create input playback/capture controls for the given pin */ |
| 13514 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13515 | const char *ctlname, int idx) |
| 13516 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13517 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13518 | int err; |
| 13519 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13520 | switch (nid) { |
| 13521 | case 0x14: |
| 13522 | case 0x16: |
| 13523 | dac = 0x02; |
| 13524 | break; |
| 13525 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13526 | case 0x1a: /* ALC259/269 only */ |
| 13527 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13528 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13529 | dac = 0x03; |
| 13530 | break; |
| 13531 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13532 | snd_printd(KERN_WARNING "hda_codec: " |
| 13533 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13534 | return 0; |
| 13535 | } |
| 13536 | if (spec->multiout.dac_nids[0] != dac && |
| 13537 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13538 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13539 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13540 | HDA_OUTPUT)); |
| 13541 | if (err < 0) |
| 13542 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13543 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13544 | } |
| 13545 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13546 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13547 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13548 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13549 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13550 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13551 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13552 | if (err < 0) |
| 13553 | return err; |
| 13554 | return 0; |
| 13555 | } |
| 13556 | |
| 13557 | /* add playback controls from the parsed DAC table */ |
| 13558 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13559 | const struct auto_pin_cfg *cfg) |
| 13560 | { |
| 13561 | hda_nid_t nid; |
| 13562 | int err; |
| 13563 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13564 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13565 | |
| 13566 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13567 | if (nid) { |
| 13568 | const char *name; |
| 13569 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13570 | name = "Speaker"; |
| 13571 | else |
| 13572 | name = "Front"; |
| 13573 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13574 | if (err < 0) |
| 13575 | return err; |
| 13576 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13577 | |
| 13578 | nid = cfg->speaker_pins[0]; |
| 13579 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13580 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13581 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13582 | if (err < 0) |
| 13583 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13584 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13585 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13586 | if (err < 0) |
| 13587 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13588 | } |
| 13589 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13590 | if (nid) { |
| 13591 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13592 | if (err < 0) |
| 13593 | return err; |
| 13594 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13595 | |
| 13596 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13597 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13598 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13599 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13600 | if (err < 0) |
| 13601 | return err; |
| 13602 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13603 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13604 | } |
| 13605 | |
| 13606 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13607 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13608 | const struct auto_pin_cfg *cfg) |
| 13609 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13610 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13611 | } |
| 13612 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13613 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13614 | hda_nid_t nid, int pin_type) |
| 13615 | { |
| 13616 | int idx; |
| 13617 | |
| 13618 | alc_set_pin_output(codec, nid, pin_type); |
| 13619 | if (nid == 0x14 || nid == 0x16) |
| 13620 | idx = 0; |
| 13621 | else |
| 13622 | idx = 1; |
| 13623 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13624 | } |
| 13625 | |
| 13626 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13627 | { |
| 13628 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13629 | int i; |
| 13630 | |
| 13631 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13632 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13633 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13634 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13635 | } |
| 13636 | } |
| 13637 | |
| 13638 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13639 | { |
| 13640 | struct alc_spec *spec = codec->spec; |
| 13641 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13642 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13643 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13644 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13645 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13646 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13647 | } |
| 13648 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13649 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13650 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13651 | } |
| 13652 | if (spec->autocfg.mono_out_pin) |
| 13653 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13654 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13655 | } |
| 13656 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13657 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13658 | { |
| 13659 | struct alc_spec *spec = codec->spec; |
| 13660 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13661 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13662 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13663 | unsigned int dac_vol1, dac_vol2; |
| 13664 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13665 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13666 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13667 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13668 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13669 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13670 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13671 | AMP_IN_UNMUTE(1)); |
| 13672 | snd_hda_codec_write(codec, 0x10, 0, |
| 13673 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13674 | AMP_IN_UNMUTE(1)); |
| 13675 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13676 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13677 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13678 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13679 | snd_hda_codec_write(codec, 0x10, 0, |
| 13680 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13681 | } |
| 13682 | |
| 13683 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13684 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13685 | dac_vol2 = AMP_OUT_ZERO; |
| 13686 | else if (line_nid == 0x15) |
| 13687 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13688 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13689 | dac_vol2 = AMP_OUT_ZERO; |
| 13690 | else if (hp_nid == 0x15) |
| 13691 | dac_vol1 = AMP_OUT_ZERO; |
| 13692 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13693 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13694 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13695 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13696 | |
| 13697 | snd_hda_codec_write(codec, 0x02, 0, |
| 13698 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13699 | snd_hda_codec_write(codec, 0x03, 0, |
| 13700 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13701 | } |
| 13702 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13703 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13704 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13705 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13706 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13707 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13708 | |
| 13709 | /* |
| 13710 | * BIOS auto configuration |
| 13711 | */ |
| 13712 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13713 | { |
| 13714 | struct alc_spec *spec = codec->spec; |
| 13715 | int err; |
| 13716 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13717 | |
| 13718 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13719 | alc268_ignore); |
| 13720 | if (err < 0) |
| 13721 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13722 | if (!spec->autocfg.line_outs) { |
| 13723 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13724 | spec->multiout.max_channels = 2; |
| 13725 | spec->no_analog = 1; |
| 13726 | goto dig_only; |
| 13727 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13728 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13729 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13730 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13731 | if (err < 0) |
| 13732 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13733 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13734 | if (err < 0) |
| 13735 | return err; |
| 13736 | |
| 13737 | spec->multiout.max_channels = 2; |
| 13738 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13739 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13740 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13741 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13742 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13743 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13744 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13745 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13746 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13747 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13748 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13749 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13750 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13751 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13752 | err = alc_auto_add_mic_boost(codec); |
| 13753 | if (err < 0) |
| 13754 | return err; |
| 13755 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13756 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13757 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13758 | return 1; |
| 13759 | } |
| 13760 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13761 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13762 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13763 | |
| 13764 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13765 | static void alc268_auto_init(struct hda_codec *codec) |
| 13766 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13767 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13768 | alc268_auto_init_multi_out(codec); |
| 13769 | alc268_auto_init_hp_out(codec); |
| 13770 | alc268_auto_init_mono_speaker_out(codec); |
| 13771 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13772 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13773 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13774 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13775 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13776 | } |
| 13777 | |
| 13778 | /* |
| 13779 | * configuration and preset |
| 13780 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13781 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13782 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13783 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13784 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13785 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13786 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13787 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13788 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13789 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13790 | #ifdef CONFIG_SND_DEBUG |
| 13791 | [ALC268_TEST] = "test", |
| 13792 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13793 | [ALC268_AUTO] = "auto", |
| 13794 | }; |
| 13795 | |
| 13796 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13797 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13798 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13799 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13800 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13801 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13802 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13803 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13804 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13805 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13806 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13807 | /* almost compatible with toshiba but with optional digital outs; |
| 13808 | * auto-probing seems working fine |
| 13809 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13810 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13811 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13812 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13813 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13814 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13815 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13816 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13817 | {} |
| 13818 | }; |
| 13819 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13820 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13821 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13822 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13823 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13824 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13825 | ALC268_TOSHIBA), |
| 13826 | {} |
| 13827 | }; |
| 13828 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13829 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13830 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13831 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13832 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13833 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13834 | alc267_quanta_il1_verbs }, |
| 13835 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13836 | .dac_nids = alc268_dac_nids, |
| 13837 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13838 | .adc_nids = alc268_adc_nids_alt, |
| 13839 | .hp_nid = 0x03, |
| 13840 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13841 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13842 | .unsol_event = alc_sku_unsol_event, |
| 13843 | .setup = alc267_quanta_il1_setup, |
| 13844 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13845 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13846 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13847 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13848 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13849 | .init_verbs = { alc268_base_init_verbs }, |
| 13850 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13851 | .dac_nids = alc268_dac_nids, |
| 13852 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13853 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13854 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13855 | .hp_nid = 0x03, |
| 13856 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13857 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13858 | .channel_mode = alc268_modes, |
| 13859 | .input_mux = &alc268_capture_source, |
| 13860 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13861 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13862 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13863 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13864 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13865 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13866 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13867 | .dac_nids = alc268_dac_nids, |
| 13868 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13869 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13870 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13871 | .hp_nid = 0x03, |
| 13872 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13873 | .channel_mode = alc268_modes, |
| 13874 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13875 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13876 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13877 | .init_hook = alc_inithook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13878 | }, |
| 13879 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13880 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13881 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13882 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13883 | alc268_acer_verbs }, |
| 13884 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13885 | .dac_nids = alc268_dac_nids, |
| 13886 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13887 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13888 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13889 | .hp_nid = 0x02, |
| 13890 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13891 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13892 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13893 | .unsol_event = alc_sku_unsol_event, |
| 13894 | .setup = alc268_acer_setup, |
| 13895 | .init_hook = alc_inithook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13896 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13897 | [ALC268_ACER_DMIC] = { |
| 13898 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13899 | alc268_beep_mixer }, |
| 13900 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13901 | alc268_acer_verbs }, |
| 13902 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13903 | .dac_nids = alc268_dac_nids, |
| 13904 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13905 | .adc_nids = alc268_adc_nids_alt, |
| 13906 | .capsrc_nids = alc268_capsrc_nids, |
| 13907 | .hp_nid = 0x02, |
| 13908 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13909 | .channel_mode = alc268_modes, |
| 13910 | .input_mux = &alc268_acer_dmic_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13911 | .unsol_event = alc_sku_unsol_event, |
| 13912 | .setup = alc268_acer_setup, |
| 13913 | .init_hook = alc_inithook, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13914 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13915 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13916 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13917 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13918 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13919 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13920 | alc268_acer_aspire_one_verbs }, |
| 13921 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13922 | .dac_nids = alc268_dac_nids, |
| 13923 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13924 | .adc_nids = alc268_adc_nids_alt, |
| 13925 | .capsrc_nids = alc268_capsrc_nids, |
| 13926 | .hp_nid = 0x03, |
| 13927 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13928 | .channel_mode = alc268_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13929 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13930 | .setup = alc268_acer_lc_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13931 | .init_hook = alc_inithook, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13932 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13933 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13934 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13935 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13936 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13937 | alc268_dell_verbs }, |
| 13938 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13939 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13940 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13941 | .adc_nids = alc268_adc_nids_alt, |
| 13942 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13943 | .hp_nid = 0x02, |
| 13944 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13945 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13946 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13947 | .setup = alc268_dell_setup, |
| 13948 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13949 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13950 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13951 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13952 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13953 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13954 | alc268_toshiba_verbs }, |
| 13955 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13956 | .dac_nids = alc268_dac_nids, |
| 13957 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13958 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13959 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13960 | .hp_nid = 0x03, |
| 13961 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13962 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13963 | .channel_mode = alc268_modes, |
| 13964 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13965 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13966 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13967 | .init_hook = alc_inithook, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13968 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13969 | #ifdef CONFIG_SND_DEBUG |
| 13970 | [ALC268_TEST] = { |
| 13971 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13972 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13973 | alc268_volume_init_verbs }, |
| 13974 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13975 | .dac_nids = alc268_dac_nids, |
| 13976 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13977 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13978 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13979 | .hp_nid = 0x03, |
| 13980 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13981 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13982 | .channel_mode = alc268_modes, |
| 13983 | .input_mux = &alc268_capture_source, |
| 13984 | }, |
| 13985 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13986 | }; |
| 13987 | |
| 13988 | static int patch_alc268(struct hda_codec *codec) |
| 13989 | { |
| 13990 | struct alc_spec *spec; |
| 13991 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13992 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13993 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13994 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13995 | if (spec == NULL) |
| 13996 | return -ENOMEM; |
| 13997 | |
| 13998 | codec->spec = spec; |
| 13999 | |
| 14000 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 14001 | alc268_models, |
| 14002 | alc268_cfg_tbl); |
| 14003 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14004 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14005 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14006 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14007 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14008 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14009 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14010 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14011 | board_config = ALC268_AUTO; |
| 14012 | } |
| 14013 | |
| 14014 | if (board_config == ALC268_AUTO) { |
| 14015 | /* automatic parse from the BIOS config */ |
| 14016 | err = alc268_parse_auto_config(codec); |
| 14017 | if (err < 0) { |
| 14018 | alc_free(codec); |
| 14019 | return err; |
| 14020 | } else if (!err) { |
| 14021 | printk(KERN_INFO |
| 14022 | "hda_codec: Cannot set up configuration " |
| 14023 | "from BIOS. Using base mode...\n"); |
| 14024 | board_config = ALC268_3ST; |
| 14025 | } |
| 14026 | } |
| 14027 | |
| 14028 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14029 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14030 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14031 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14032 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14033 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14034 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14035 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14036 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14037 | has_beep = 0; |
| 14038 | for (i = 0; i < spec->num_mixers; i++) { |
| 14039 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14040 | has_beep = 1; |
| 14041 | break; |
| 14042 | } |
| 14043 | } |
| 14044 | |
| 14045 | if (has_beep) { |
| 14046 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14047 | if (err < 0) { |
| 14048 | alc_free(codec); |
| 14049 | return err; |
| 14050 | } |
| 14051 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14052 | /* override the amp caps for beep generator */ |
| 14053 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14054 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14055 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14056 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14057 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14058 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14059 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14060 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14061 | /* check whether NID 0x07 is valid */ |
| 14062 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14063 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14064 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14065 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14066 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14067 | if (spec->auto_mic || |
| 14068 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14069 | spec->adc_nids = alc268_adc_nids_alt; |
| 14070 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14071 | if (spec->auto_mic) |
| 14072 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14073 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14074 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14075 | else |
| 14076 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14077 | } else { |
| 14078 | spec->adc_nids = alc268_adc_nids; |
| 14079 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14080 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14081 | } |
| 14082 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14083 | |
| 14084 | spec->vmaster_nid = 0x02; |
| 14085 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14086 | codec->patch_ops = alc_patch_ops; |
| 14087 | if (board_config == ALC268_AUTO) |
| 14088 | spec->init_hook = alc268_auto_init; |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 14089 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14090 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14091 | alc_init_jacks(codec); |
| 14092 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14093 | return 0; |
| 14094 | } |
| 14095 | |
| 14096 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14097 | * ALC269 channel source setting (2 channel) |
| 14098 | */ |
| 14099 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14100 | |
| 14101 | #define alc269_dac_nids alc260_dac_nids |
| 14102 | |
| 14103 | static hda_nid_t alc269_adc_nids[1] = { |
| 14104 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14105 | 0x08, |
| 14106 | }; |
| 14107 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14108 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14109 | 0x23, |
| 14110 | }; |
| 14111 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14112 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14113 | /* ADC1 */ |
| 14114 | 0x09, |
| 14115 | }; |
| 14116 | |
| 14117 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14118 | 0x22, |
| 14119 | }; |
| 14120 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14121 | static hda_nid_t alc269_adc_candidates[] = { |
David Henningsson | 262ac22 | 2011-04-07 11:43:00 +0200 | [diff] [blame] | 14122 | 0x08, 0x09, 0x07, 0x11, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14123 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14124 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14125 | #define alc269_modes alc260_modes |
| 14126 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14127 | |
| 14128 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14129 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14130 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14131 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14132 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14133 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14134 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14135 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14136 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14137 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14138 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14139 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14140 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14141 | { } /* end */ |
| 14142 | }; |
| 14143 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14144 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14145 | /* output mixer control */ |
| 14146 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14147 | { |
| 14148 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14149 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14150 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14151 | .info = snd_hda_mixer_amp_switch_info, |
| 14152 | .get = snd_hda_mixer_amp_switch_get, |
| 14153 | .put = alc268_acer_master_sw_put, |
| 14154 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14155 | }, |
| 14156 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14158 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14159 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14160 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14161 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14162 | { } |
| 14163 | }; |
| 14164 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14165 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14166 | /* output mixer control */ |
| 14167 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14168 | { |
| 14169 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14170 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14171 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14172 | .info = snd_hda_mixer_amp_switch_info, |
| 14173 | .get = snd_hda_mixer_amp_switch_get, |
| 14174 | .put = alc268_acer_master_sw_put, |
| 14175 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14176 | }, |
| 14177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14179 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14180 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14181 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14182 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14183 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14184 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14185 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14186 | { } |
| 14187 | }; |
| 14188 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14189 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14190 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14192 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14193 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14194 | { } /* end */ |
| 14195 | }; |
| 14196 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14197 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14198 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14199 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14200 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14201 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14202 | { } /* end */ |
| 14203 | }; |
| 14204 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14205 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14206 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14207 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14208 | { } /* end */ |
| 14209 | }; |
| 14210 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14211 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14212 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14213 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14214 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14215 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14216 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14217 | { } /* end */ |
| 14218 | }; |
| 14219 | |
| 14220 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14221 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14222 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14223 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14224 | { } /* end */ |
| 14225 | }; |
| 14226 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14227 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14228 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14229 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14230 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14231 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14232 | { } /* end */ |
| 14233 | }; |
| 14234 | |
| 14235 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14236 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14237 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14238 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14239 | { } /* end */ |
| 14240 | }; |
| 14241 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14242 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14243 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14244 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14245 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14247 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14248 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14249 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14250 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14251 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14252 | { } |
| 14253 | }; |
| 14254 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14255 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14256 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14257 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14258 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14259 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14260 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14261 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14262 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14263 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14264 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14265 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14266 | { } |
| 14267 | }; |
| 14268 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14269 | /* toggle speaker-output according to the hp-jack state */ |
| 14270 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14271 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14272 | alc_hp_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14273 | |
| 14274 | snd_hda_codec_write(codec, 0x20, 0, |
| 14275 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14276 | snd_hda_codec_write(codec, 0x20, 0, |
| 14277 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14278 | |
| 14279 | snd_hda_codec_write(codec, 0x20, 0, |
| 14280 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14281 | snd_hda_codec_write(codec, 0x20, 0, |
| 14282 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14283 | } |
| 14284 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14285 | #define alc269_lifebook_speaker_automute \ |
| 14286 | alc269_quanta_fl1_speaker_automute |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14287 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14288 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14289 | { |
| 14290 | unsigned int present_laptop; |
| 14291 | unsigned int present_dock; |
| 14292 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14293 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14294 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14295 | |
| 14296 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14297 | if (present_dock) |
| 14298 | snd_hda_codec_write(codec, 0x23, 0, |
| 14299 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14300 | if (present_laptop) |
| 14301 | snd_hda_codec_write(codec, 0x23, 0, |
| 14302 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14303 | if (!present_dock && !present_laptop) |
| 14304 | snd_hda_codec_write(codec, 0x23, 0, |
| 14305 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14306 | } |
| 14307 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14308 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14309 | unsigned int res) |
| 14310 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14311 | switch (res >> 26) { |
| 14312 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14313 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14314 | break; |
| 14315 | case ALC880_MIC_EVENT: |
| 14316 | alc_mic_automute(codec); |
| 14317 | break; |
| 14318 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14319 | } |
| 14320 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14321 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14322 | unsigned int res) |
| 14323 | { |
| 14324 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14325 | alc269_lifebook_speaker_automute(codec); |
| 14326 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14327 | alc269_lifebook_mic_autoswitch(codec); |
| 14328 | } |
| 14329 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14330 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14331 | { |
| 14332 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14333 | spec->autocfg.hp_pins[0] = 0x15; |
| 14334 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14335 | spec->automute_mixer_nid[0] = 0x0c; |
| 14336 | spec->automute = 1; |
| 14337 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14338 | spec->ext_mic.pin = 0x18; |
| 14339 | spec->ext_mic.mux_idx = 0; |
| 14340 | spec->int_mic.pin = 0x19; |
| 14341 | spec->int_mic.mux_idx = 1; |
| 14342 | spec->auto_mic = 1; |
| 14343 | } |
| 14344 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14345 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14346 | { |
| 14347 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14348 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14349 | } |
| 14350 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14351 | static void alc269_lifebook_setup(struct hda_codec *codec) |
| 14352 | { |
| 14353 | struct alc_spec *spec = codec->spec; |
| 14354 | spec->autocfg.hp_pins[0] = 0x15; |
| 14355 | spec->autocfg.hp_pins[1] = 0x1a; |
| 14356 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14357 | spec->automute_mixer_nid[0] = 0x0c; |
| 14358 | spec->automute = 1; |
| 14359 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 14360 | } |
| 14361 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14362 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14363 | { |
| 14364 | alc269_lifebook_speaker_automute(codec); |
| 14365 | alc269_lifebook_mic_autoswitch(codec); |
| 14366 | } |
| 14367 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14368 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14369 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14370 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14371 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14372 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14373 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14374 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14375 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14376 | {} |
| 14377 | }; |
| 14378 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14379 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14381 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14382 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14383 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14384 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14385 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14386 | {} |
| 14387 | }; |
| 14388 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14389 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14390 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14391 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14392 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14393 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14394 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14395 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14396 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14397 | {} |
| 14398 | }; |
| 14399 | |
| 14400 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14401 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14402 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14403 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14404 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14405 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14406 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14407 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14408 | {} |
| 14409 | }; |
| 14410 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14411 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14412 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14413 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14414 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14415 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14416 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14417 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14418 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14419 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14420 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14421 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14422 | { } |
| 14423 | }; |
| 14424 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14425 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14426 | { |
| 14427 | struct alc_spec *spec = codec->spec; |
| 14428 | spec->autocfg.hp_pins[0] = 0x15; |
| 14429 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14430 | spec->automute_mixer_nid[0] = 0x0c; |
| 14431 | spec->automute = 1; |
| 14432 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14433 | spec->ext_mic.pin = 0x18; |
| 14434 | spec->ext_mic.mux_idx = 0; |
| 14435 | spec->int_mic.pin = 0x19; |
| 14436 | spec->int_mic.mux_idx = 1; |
| 14437 | spec->auto_mic = 1; |
| 14438 | } |
| 14439 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14440 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14441 | { |
| 14442 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14443 | spec->autocfg.hp_pins[0] = 0x15; |
| 14444 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14445 | spec->automute_mixer_nid[0] = 0x0c; |
| 14446 | spec->automute = 1; |
| 14447 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14448 | spec->ext_mic.pin = 0x18; |
| 14449 | spec->ext_mic.mux_idx = 0; |
| 14450 | spec->int_mic.pin = 0x12; |
| 14451 | spec->int_mic.mux_idx = 5; |
| 14452 | spec->auto_mic = 1; |
| 14453 | } |
| 14454 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14455 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14456 | { |
| 14457 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14458 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14459 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14460 | spec->automute_mixer_nid[0] = 0x0c; |
| 14461 | spec->automute = 1; |
| 14462 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14463 | spec->ext_mic.pin = 0x18; |
| 14464 | spec->ext_mic.mux_idx = 0; |
| 14465 | spec->int_mic.pin = 0x19; |
| 14466 | spec->int_mic.mux_idx = 1; |
| 14467 | spec->auto_mic = 1; |
| 14468 | } |
| 14469 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14470 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14471 | { |
| 14472 | struct alc_spec *spec = codec->spec; |
| 14473 | spec->autocfg.hp_pins[0] = 0x21; |
| 14474 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14475 | spec->automute_mixer_nid[0] = 0x0c; |
| 14476 | spec->automute = 1; |
| 14477 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14478 | spec->ext_mic.pin = 0x18; |
| 14479 | spec->ext_mic.mux_idx = 0; |
| 14480 | spec->int_mic.pin = 0x12; |
| 14481 | spec->int_mic.mux_idx = 6; |
| 14482 | spec->auto_mic = 1; |
| 14483 | } |
| 14484 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14485 | /* |
| 14486 | * generic initialization of ADC, input mixers and output mixers |
| 14487 | */ |
| 14488 | static struct hda_verb alc269_init_verbs[] = { |
| 14489 | /* |
| 14490 | * Unmute ADC0 and set the default input to mic-in |
| 14491 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14493 | |
| 14494 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14495 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14496 | */ |
| 14497 | /* set vol=0 to output mixers */ |
| 14498 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14499 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14500 | |
| 14501 | /* set up input amps for analog loopback */ |
| 14502 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14505 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14506 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14507 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14508 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14509 | |
| 14510 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14511 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14512 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14513 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14514 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14515 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14516 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14517 | |
| 14518 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14519 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14520 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14521 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14522 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14523 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14524 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14525 | |
| 14526 | /* set EAPD */ |
| 14527 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14528 | { } |
| 14529 | }; |
| 14530 | |
| 14531 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14532 | /* |
| 14533 | * Unmute ADC0 and set the default input to mic-in |
| 14534 | */ |
| 14535 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14536 | |
| 14537 | /* |
| 14538 | * Set up output mixers (0x02 - 0x03) |
| 14539 | */ |
| 14540 | /* set vol=0 to output mixers */ |
| 14541 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14542 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14543 | |
| 14544 | /* set up input amps for analog loopback */ |
| 14545 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14547 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14548 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14549 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14550 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14551 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14552 | |
| 14553 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14554 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14555 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14556 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14557 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14558 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14560 | |
| 14561 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14562 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14563 | |
| 14564 | /* FIXME: use Mux-type input source selection */ |
| 14565 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14566 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14567 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14568 | |
| 14569 | /* set EAPD */ |
| 14570 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14571 | { } |
| 14572 | }; |
| 14573 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14574 | #define alc269_auto_create_multi_out_ctls \ |
| 14575 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14576 | #define alc269_auto_create_input_ctls \ |
| 14577 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14578 | |
| 14579 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14580 | #define alc269_loopbacks alc880_loopbacks |
| 14581 | #endif |
| 14582 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14583 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14584 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14585 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14586 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14587 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14588 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14589 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14590 | .substreams = 1, |
| 14591 | .channels_min = 2, |
| 14592 | .channels_max = 8, |
| 14593 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14594 | /* NID is set in alc_build_pcms */ |
| 14595 | .ops = { |
| 14596 | .open = alc880_playback_pcm_open, |
| 14597 | .prepare = alc880_playback_pcm_prepare, |
| 14598 | .cleanup = alc880_playback_pcm_cleanup |
| 14599 | }, |
| 14600 | }; |
| 14601 | |
| 14602 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14603 | .substreams = 1, |
| 14604 | .channels_min = 2, |
| 14605 | .channels_max = 2, |
| 14606 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14607 | /* NID is set in alc_build_pcms */ |
| 14608 | }; |
| 14609 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14610 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14611 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14612 | { |
| 14613 | switch (codec->subsystem_id) { |
| 14614 | case 0x103c1586: |
| 14615 | return 1; |
| 14616 | } |
| 14617 | return 0; |
| 14618 | } |
| 14619 | |
| 14620 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14621 | { |
| 14622 | /* update mute-LED according to the speaker mute state */ |
| 14623 | if (nid == 0x01 || nid == 0x14) { |
| 14624 | int pinval; |
| 14625 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14626 | HDA_AMP_MUTE) |
| 14627 | pinval = 0x24; |
| 14628 | else |
| 14629 | pinval = 0x20; |
| 14630 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14631 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14632 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14633 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14634 | } |
| 14635 | return alc_check_power_status(codec, nid); |
| 14636 | } |
| 14637 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14638 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14639 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14640 | { |
| 14641 | struct alc_spec *spec = codec->spec; |
| 14642 | |
| 14643 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14644 | return 0; |
| 14645 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14646 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14647 | if (spec->ext_mic.pin <= 0x12) { |
| 14648 | spec->private_adc_nids[0] = 0x08; |
| 14649 | spec->private_adc_nids[1] = 0x11; |
| 14650 | spec->private_capsrc_nids[0] = 0x23; |
| 14651 | spec->private_capsrc_nids[1] = 0x22; |
| 14652 | } else { |
| 14653 | spec->private_adc_nids[0] = 0x11; |
| 14654 | spec->private_adc_nids[1] = 0x08; |
| 14655 | spec->private_capsrc_nids[0] = 0x22; |
| 14656 | spec->private_capsrc_nids[1] = 0x23; |
| 14657 | } |
| 14658 | spec->adc_nids = spec->private_adc_nids; |
| 14659 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14660 | spec->num_adc_nids = 2; |
| 14661 | spec->dual_adc_switch = 1; |
| 14662 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14663 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14664 | return 1; |
| 14665 | } |
| 14666 | return 0; |
| 14667 | } |
| 14668 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14669 | /* different alc269-variants */ |
| 14670 | enum { |
| 14671 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14672 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14673 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14674 | ALC269_TYPE_ALC269VB, |
| 14675 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14676 | ALC269_TYPE_ALC271X, |
| 14677 | }; |
| 14678 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14679 | /* |
| 14680 | * BIOS auto configuration |
| 14681 | */ |
| 14682 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14683 | { |
| 14684 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14685 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14686 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14687 | |
| 14688 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14689 | alc269_ignore); |
| 14690 | if (err < 0) |
| 14691 | return err; |
| 14692 | |
| 14693 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14694 | if (err < 0) |
| 14695 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14696 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14697 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14698 | else |
| 14699 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14700 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14701 | if (err < 0) |
| 14702 | return err; |
| 14703 | |
| 14704 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14705 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14706 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14707 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14708 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14709 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14710 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14711 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14712 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14713 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14714 | } else { |
| 14715 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14716 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14717 | } |
| 14718 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14719 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14720 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14721 | |
| 14722 | if (!alc275_setup_dual_adc(codec)) |
| 14723 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14724 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14725 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14726 | err = alc_auto_add_mic_boost(codec); |
| 14727 | if (err < 0) |
| 14728 | return err; |
| 14729 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14730 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14731 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14732 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14733 | return 1; |
| 14734 | } |
| 14735 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14736 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14737 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14738 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14739 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14740 | |
| 14741 | |
| 14742 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14743 | static void alc269_auto_init(struct hda_codec *codec) |
| 14744 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14745 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14746 | alc269_auto_init_multi_out(codec); |
| 14747 | alc269_auto_init_hp_out(codec); |
| 14748 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14749 | if (!spec->dual_adc_switch) |
| 14750 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14751 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14752 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14753 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14754 | } |
| 14755 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14756 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14757 | { |
| 14758 | int val = alc_read_coef_idx(codec, 0x04); |
| 14759 | if (power_up) |
| 14760 | val |= 1 << 11; |
| 14761 | else |
| 14762 | val &= ~(1 << 11); |
| 14763 | alc_write_coef_idx(codec, 0x04, val); |
| 14764 | } |
| 14765 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14766 | static void alc269_shutup(struct hda_codec *codec) |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14767 | { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14768 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14769 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14770 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14771 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14772 | msleep(150); |
| 14773 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14774 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14775 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14776 | #ifdef SND_HDA_NEEDS_RESUME |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14777 | static int alc269_resume(struct hda_codec *codec) |
| 14778 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14779 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14780 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14781 | msleep(150); |
| 14782 | } |
| 14783 | |
| 14784 | codec->patch_ops.init(codec); |
| 14785 | |
| 14786 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14787 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14788 | msleep(200); |
| 14789 | } |
| 14790 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14791 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14792 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14793 | |
| 14794 | snd_hda_codec_resume_amp(codec); |
| 14795 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14796 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14797 | return 0; |
| 14798 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14799 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14800 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14801 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14802 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14803 | { |
| 14804 | int coef; |
| 14805 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14806 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14807 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14808 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14809 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14810 | } |
| 14811 | |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14812 | static void alc271_fixup_dmic(struct hda_codec *codec, |
| 14813 | const struct alc_fixup *fix, int action) |
| 14814 | { |
| 14815 | static struct hda_verb verbs[] = { |
| 14816 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14817 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14818 | {} |
| 14819 | }; |
| 14820 | unsigned int cfg; |
| 14821 | |
| 14822 | if (strcmp(codec->chip_name, "ALC271X")) |
| 14823 | return; |
| 14824 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 14825 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 14826 | snd_hda_sequence_write(codec, verbs); |
| 14827 | } |
| 14828 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14829 | enum { |
| 14830 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14831 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14832 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14833 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14834 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14835 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14836 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14837 | ALC271_FIXUP_DMIC, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14838 | }; |
| 14839 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14840 | static const struct alc_fixup alc269_fixups[] = { |
| 14841 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14842 | .type = ALC_FIXUP_VERBS, |
| 14843 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14844 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14845 | {} |
| 14846 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14847 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14848 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14849 | .type = ALC_FIXUP_VERBS, |
| 14850 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14851 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14852 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14853 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14854 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14855 | }, |
| 14856 | .chained = true, |
| 14857 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14858 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14859 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14860 | .type = ALC_FIXUP_VERBS, |
| 14861 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14862 | /* Enables internal speaker */ |
| 14863 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14864 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14865 | {} |
| 14866 | } |
| 14867 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14868 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14869 | .type = ALC_FIXUP_SKU, |
| 14870 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14871 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14872 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14873 | .type = ALC_FIXUP_PINS, |
| 14874 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14875 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14876 | { } |
| 14877 | } |
| 14878 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14879 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14880 | .type = ALC_FIXUP_VERBS, |
| 14881 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14882 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14883 | {} |
| 14884 | } |
| 14885 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14886 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14887 | .type = ALC_FIXUP_FUNC, |
| 14888 | .v.func = alc269_fixup_hweq, |
| 14889 | .chained = true, |
| 14890 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14891 | }, |
| 14892 | [ALC271_FIXUP_DMIC] = { |
| 14893 | .type = ALC_FIXUP_FUNC, |
| 14894 | .v.func = alc271_fixup_dmic, |
| 14895 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14896 | }; |
| 14897 | |
| 14898 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14899 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14900 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14901 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14902 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14903 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14904 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14905 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14906 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14907 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14908 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14909 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14910 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14911 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14912 | {} |
| 14913 | }; |
| 14914 | |
| 14915 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14916 | /* |
| 14917 | * configuration and preset |
| 14918 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14919 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14920 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14921 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14922 | [ALC269_AMIC] = "laptop-amic", |
| 14923 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14924 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14925 | [ALC269_LIFEBOOK] = "lifebook", |
| 14926 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14927 | }; |
| 14928 | |
| 14929 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14930 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14931 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14932 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14933 | ALC269_AMIC), |
| 14934 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14935 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14936 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14937 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14938 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14939 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14940 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14941 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14942 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 14943 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14944 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14945 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14946 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14947 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14948 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14949 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14950 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14951 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14952 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14953 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14954 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14955 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14956 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14957 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14958 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14959 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14960 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14961 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14962 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14963 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14964 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14965 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14966 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14967 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14968 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14969 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14970 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14971 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14972 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14973 | ALC269_DMIC), |
| 14974 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14975 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14976 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14977 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14978 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14979 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14980 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14981 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14982 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14983 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14984 | {} |
| 14985 | }; |
| 14986 | |
| 14987 | static struct alc_config_preset alc269_presets[] = { |
| 14988 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14989 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14990 | .init_verbs = { alc269_init_verbs }, |
| 14991 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14992 | .dac_nids = alc269_dac_nids, |
| 14993 | .hp_nid = 0x03, |
| 14994 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14995 | .channel_mode = alc269_modes, |
| 14996 | .input_mux = &alc269_capture_source, |
| 14997 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14998 | [ALC269_QUANTA_FL1] = { |
| 14999 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15000 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15001 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15002 | .dac_nids = alc269_dac_nids, |
| 15003 | .hp_nid = 0x03, |
| 15004 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15005 | .channel_mode = alc269_modes, |
| 15006 | .input_mux = &alc269_capture_source, |
| 15007 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15008 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15009 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15010 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15011 | [ALC269_AMIC] = { |
| 15012 | .mixers = { alc269_laptop_mixer }, |
| 15013 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15014 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15015 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15016 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15017 | .dac_nids = alc269_dac_nids, |
| 15018 | .hp_nid = 0x03, |
| 15019 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15020 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15021 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15022 | .setup = alc269_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15023 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15024 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15025 | [ALC269_DMIC] = { |
| 15026 | .mixers = { alc269_laptop_mixer }, |
| 15027 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15028 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15029 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15030 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15031 | .dac_nids = alc269_dac_nids, |
| 15032 | .hp_nid = 0x03, |
| 15033 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15034 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15035 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15036 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15037 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15038 | }, |
| 15039 | [ALC269VB_AMIC] = { |
| 15040 | .mixers = { alc269vb_laptop_mixer }, |
| 15041 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15042 | .init_verbs = { alc269vb_init_verbs, |
| 15043 | alc269vb_laptop_amic_init_verbs }, |
| 15044 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15045 | .dac_nids = alc269_dac_nids, |
| 15046 | .hp_nid = 0x03, |
| 15047 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15048 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15049 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15050 | .setup = alc269vb_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15051 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15052 | }, |
| 15053 | [ALC269VB_DMIC] = { |
| 15054 | .mixers = { alc269vb_laptop_mixer }, |
| 15055 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15056 | .init_verbs = { alc269vb_init_verbs, |
| 15057 | alc269vb_laptop_dmic_init_verbs }, |
| 15058 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15059 | .dac_nids = alc269_dac_nids, |
| 15060 | .hp_nid = 0x03, |
| 15061 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15062 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15063 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15064 | .setup = alc269vb_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15065 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15066 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15067 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15068 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15069 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15070 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15071 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15072 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15073 | .dac_nids = alc269_dac_nids, |
| 15074 | .hp_nid = 0x03, |
| 15075 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15076 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15077 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15078 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15079 | .init_hook = alc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15080 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15081 | [ALC269_LIFEBOOK] = { |
| 15082 | .mixers = { alc269_lifebook_mixer }, |
| 15083 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15084 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15085 | .dac_nids = alc269_dac_nids, |
| 15086 | .hp_nid = 0x03, |
| 15087 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15088 | .channel_mode = alc269_modes, |
| 15089 | .input_mux = &alc269_capture_source, |
| 15090 | .unsol_event = alc269_lifebook_unsol_event, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15091 | .setup = alc269_lifebook_setup, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15092 | .init_hook = alc269_lifebook_init_hook, |
| 15093 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15094 | [ALC271_ACER] = { |
| 15095 | .mixers = { alc269_asus_mixer }, |
| 15096 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15097 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15098 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15099 | .dac_nids = alc269_dac_nids, |
| 15100 | .adc_nids = alc262_dmic_adc_nids, |
| 15101 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15102 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15103 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15104 | .channel_mode = alc269_modes, |
| 15105 | .input_mux = &alc269_capture_source, |
| 15106 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15107 | .unsol_event = alc_sku_unsol_event, |
| 15108 | .setup = alc269vb_laptop_dmic_setup, |
| 15109 | .init_hook = alc_inithook, |
| 15110 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15111 | }; |
| 15112 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15113 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15114 | { |
| 15115 | int val; |
| 15116 | |
| 15117 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15118 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15119 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15120 | } |
| 15121 | |
| 15122 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15123 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15124 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15125 | } |
| 15126 | |
| 15127 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15128 | val = alc_read_coef_idx(codec, 0x04); |
| 15129 | /* Power up output pin */ |
| 15130 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15131 | } |
| 15132 | |
| 15133 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15134 | val = alc_read_coef_idx(codec, 0xd); |
| 15135 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15136 | /* Capless ramp up clock control */ |
| 15137 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15138 | } |
| 15139 | val = alc_read_coef_idx(codec, 0x17); |
| 15140 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15141 | /* Class D power on reset */ |
| 15142 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15143 | } |
| 15144 | } |
| 15145 | return 0; |
| 15146 | } |
| 15147 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15148 | static int patch_alc269(struct hda_codec *codec) |
| 15149 | { |
| 15150 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15151 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15152 | int err; |
| 15153 | |
| 15154 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15155 | if (spec == NULL) |
| 15156 | return -ENOMEM; |
| 15157 | |
| 15158 | codec->spec = spec; |
| 15159 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15160 | alc_auto_parse_customize_define(codec); |
| 15161 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15162 | if (codec->vendor_id == 0x10ec0269) { |
| 15163 | coef = alc_read_coef_idx(codec, 0); |
| 15164 | if ((coef & 0x00f0) == 0x0010) { |
| 15165 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15166 | spec->cdefine.platform_type == 1) { |
| 15167 | alc_codec_rename(codec, "ALC271X"); |
| 15168 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15169 | } else if ((coef & 0xf000) == 0x1000) { |
| 15170 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15171 | } else if ((coef & 0xf000) == 0x2000) { |
| 15172 | alc_codec_rename(codec, "ALC259"); |
| 15173 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15174 | } else if ((coef & 0xf000) == 0x3000) { |
| 15175 | alc_codec_rename(codec, "ALC258"); |
| 15176 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15177 | } else { |
| 15178 | alc_codec_rename(codec, "ALC269VB"); |
| 15179 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15180 | } |
| 15181 | } else |
| 15182 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15183 | alc269_fill_coef(codec); |
| 15184 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15185 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15186 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15187 | alc269_models, |
| 15188 | alc269_cfg_tbl); |
| 15189 | |
| 15190 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15191 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15192 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15193 | board_config = ALC269_AUTO; |
| 15194 | } |
| 15195 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15196 | if (board_config == ALC269_AUTO) { |
| 15197 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15198 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15199 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15200 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15201 | if (board_config == ALC269_AUTO) { |
| 15202 | /* automatic parse from the BIOS config */ |
| 15203 | err = alc269_parse_auto_config(codec); |
| 15204 | if (err < 0) { |
| 15205 | alc_free(codec); |
| 15206 | return err; |
| 15207 | } else if (!err) { |
| 15208 | printk(KERN_INFO |
| 15209 | "hda_codec: Cannot set up configuration " |
| 15210 | "from BIOS. Using base mode...\n"); |
| 15211 | board_config = ALC269_BASIC; |
| 15212 | } |
| 15213 | } |
| 15214 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15215 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15216 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15217 | if (err < 0) { |
| 15218 | alc_free(codec); |
| 15219 | return err; |
| 15220 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15221 | } |
| 15222 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15223 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15224 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15225 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15226 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15227 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15228 | * fix the sample rate of analog I/O to 44.1kHz |
| 15229 | */ |
| 15230 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15231 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15232 | } else if (spec->dual_adc_switch) { |
| 15233 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15234 | /* switch ADC dynamically */ |
| 15235 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15236 | } else { |
| 15237 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15238 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15239 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15240 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15241 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15242 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15243 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15244 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15245 | spec->adc_nids = alc269_adc_nids; |
| 15246 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15247 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15248 | } else { |
| 15249 | spec->adc_nids = alc269vb_adc_nids; |
| 15250 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15251 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15252 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15253 | } |
| 15254 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15255 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15256 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15257 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15258 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15259 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15260 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15261 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15262 | spec->vmaster_nid = 0x02; |
| 15263 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15264 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15265 | #ifdef SND_HDA_NEEDS_RESUME |
| 15266 | codec->patch_ops.resume = alc269_resume; |
| 15267 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15268 | if (board_config == ALC269_AUTO) |
| 15269 | spec->init_hook = alc269_auto_init; |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 15270 | spec->shutup = alc269_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15271 | |
| 15272 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15273 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15274 | if (!spec->loopback.amplist) |
| 15275 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15276 | if (alc269_mic2_for_mute_led(codec)) |
| 15277 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15278 | #endif |
| 15279 | |
| 15280 | return 0; |
| 15281 | } |
| 15282 | |
| 15283 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15284 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15285 | */ |
| 15286 | |
| 15287 | /* |
| 15288 | * set the path ways for 2 channel output |
| 15289 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15290 | */ |
| 15291 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15292 | /* set pin widget 1Ah (line in) for input */ |
| 15293 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15294 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15295 | * the vref |
| 15296 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15297 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15298 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15299 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15300 | #if 0 |
| 15301 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15302 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15303 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15304 | { } /* end */ |
| 15305 | }; |
| 15306 | /* |
| 15307 | * 6ch mode |
| 15308 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15309 | */ |
| 15310 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15311 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15312 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15313 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15314 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15315 | |
| 15316 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15317 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15318 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15319 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15320 | #if 0 |
| 15321 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15322 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15323 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15324 | { } /* end */ |
| 15325 | }; |
| 15326 | |
| 15327 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15328 | { 2, alc861_threestack_ch2_init }, |
| 15329 | { 6, alc861_threestack_ch6_init }, |
| 15330 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15331 | /* Set mic1 as input and unmute the mixer */ |
| 15332 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15333 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15334 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15335 | { } /* end */ |
| 15336 | }; |
| 15337 | /* Set mic1 as output and mute mixer */ |
| 15338 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15339 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15340 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15341 | { } /* end */ |
| 15342 | }; |
| 15343 | |
| 15344 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15345 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15346 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15347 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15348 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15349 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15350 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15351 | /* set pin widget 1Ah (line in) for input */ |
| 15352 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15353 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15354 | * the vref |
| 15355 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15356 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15357 | |
| 15358 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15359 | #if 0 |
| 15360 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15361 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15362 | #endif |
| 15363 | { } /* end */ |
| 15364 | }; |
| 15365 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15366 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15367 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15368 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15369 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15370 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15371 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15372 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15373 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15374 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15375 | |
| 15376 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15377 | #if 0 |
| 15378 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15379 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15380 | #endif |
| 15381 | { } /* end */ |
| 15382 | }; |
| 15383 | |
| 15384 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15385 | { 2, alc861_asus_ch2_init }, |
| 15386 | { 6, alc861_asus_ch6_init }, |
| 15387 | }; |
| 15388 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15389 | /* patch-ALC861 */ |
| 15390 | |
| 15391 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15392 | /* output mixer control */ |
| 15393 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15394 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15395 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15396 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15397 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15398 | |
| 15399 | /*Input mixer control */ |
| 15400 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15401 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15402 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15403 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15404 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15405 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15406 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15407 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15408 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15409 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15410 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15411 | { } /* end */ |
| 15412 | }; |
| 15413 | |
| 15414 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15415 | /* output mixer control */ |
| 15416 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15417 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15418 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15419 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15420 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15421 | |
| 15422 | /* Input mixer control */ |
| 15423 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15424 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15425 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15426 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15427 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15428 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15429 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15430 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15431 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15433 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15434 | { |
| 15435 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15436 | .name = "Channel Mode", |
| 15437 | .info = alc_ch_mode_info, |
| 15438 | .get = alc_ch_mode_get, |
| 15439 | .put = alc_ch_mode_put, |
| 15440 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15441 | }, |
| 15442 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15443 | }; |
| 15444 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15445 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15446 | /* output mixer control */ |
| 15447 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15448 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15450 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15451 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15452 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15453 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15454 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15455 | /* output mixer control */ |
| 15456 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15457 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15458 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15459 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15460 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15461 | |
| 15462 | /* Input mixer control */ |
| 15463 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15464 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15465 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15466 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15467 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15468 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15469 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15470 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15471 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15472 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15473 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15474 | { |
| 15475 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15476 | .name = "Channel Mode", |
| 15477 | .info = alc_ch_mode_info, |
| 15478 | .get = alc_ch_mode_get, |
| 15479 | .put = alc_ch_mode_put, |
| 15480 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15481 | }, |
| 15482 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15483 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15484 | |
| 15485 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15486 | /* output mixer control */ |
| 15487 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15488 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15489 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15490 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15491 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15492 | |
| 15493 | /* Input mixer control */ |
| 15494 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15495 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15497 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15498 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15499 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15502 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15504 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15505 | { |
| 15506 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15507 | .name = "Channel Mode", |
| 15508 | .info = alc_ch_mode_info, |
| 15509 | .get = alc_ch_mode_get, |
| 15510 | .put = alc_ch_mode_put, |
| 15511 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15512 | }, |
| 15513 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15514 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15515 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15516 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15517 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15518 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15519 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15520 | { } |
| 15521 | }; |
| 15522 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15523 | /* |
| 15524 | * generic initialization of ADC, input mixers and output mixers |
| 15525 | */ |
| 15526 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15527 | /* |
| 15528 | * Unmute ADC0 and set the default input to mic-in |
| 15529 | */ |
| 15530 | /* port-A for surround (rear panel) */ |
| 15531 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15532 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15533 | /* port-B for mic-in (rear panel) with vref */ |
| 15534 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15535 | /* port-C for line-in (rear panel) */ |
| 15536 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15537 | /* port-D for Front */ |
| 15538 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15539 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15540 | /* port-E for HP out (front panel) */ |
| 15541 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15542 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15543 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15544 | /* port-F for mic-in (front panel) with vref */ |
| 15545 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15546 | /* port-G for CLFE (rear panel) */ |
| 15547 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15548 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15549 | /* port-H for side (rear panel) */ |
| 15550 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15551 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15552 | /* CD-in */ |
| 15553 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15554 | /* route front mic to ADC1*/ |
| 15555 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15556 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15557 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15558 | /* Unmute DAC0~3 & spdif out*/ |
| 15559 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15560 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15561 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15562 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15565 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15566 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15567 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15568 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15569 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15570 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15571 | /* Unmute Stereo Mixer 15 */ |
| 15572 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15573 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15575 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15576 | |
| 15577 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15579 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15580 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15581 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15582 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15583 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15584 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15585 | /* hp used DAC 3 (Front) */ |
| 15586 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15587 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15588 | |
| 15589 | { } |
| 15590 | }; |
| 15591 | |
| 15592 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15593 | /* |
| 15594 | * Unmute ADC0 and set the default input to mic-in |
| 15595 | */ |
| 15596 | /* port-A for surround (rear panel) */ |
| 15597 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15598 | /* port-B for mic-in (rear panel) with vref */ |
| 15599 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15600 | /* port-C for line-in (rear panel) */ |
| 15601 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15602 | /* port-D for Front */ |
| 15603 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15604 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15605 | /* port-E for HP out (front panel) */ |
| 15606 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15607 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15608 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15609 | /* port-F for mic-in (front panel) with vref */ |
| 15610 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15611 | /* port-G for CLFE (rear panel) */ |
| 15612 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15613 | /* port-H for side (rear panel) */ |
| 15614 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15615 | /* CD-in */ |
| 15616 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15617 | /* route front mic to ADC1*/ |
| 15618 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15619 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15620 | /* Unmute DAC0~3 & spdif out*/ |
| 15621 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15622 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15623 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15624 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15625 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15626 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15627 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15628 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15629 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15630 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15631 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15632 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15633 | /* Unmute Stereo Mixer 15 */ |
| 15634 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15635 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15637 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15638 | |
| 15639 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15640 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15641 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15642 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15643 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15644 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15645 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15646 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15647 | /* hp used DAC 3 (Front) */ |
| 15648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15649 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15650 | { } |
| 15651 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15652 | |
| 15653 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15654 | /* |
| 15655 | * Unmute ADC0 and set the default input to mic-in |
| 15656 | */ |
| 15657 | /* port-A for surround (rear panel) */ |
| 15658 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15659 | /* port-B for mic-in (rear panel) with vref */ |
| 15660 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15661 | /* port-C for line-in (rear panel) */ |
| 15662 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15663 | /* port-D for Front */ |
| 15664 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15665 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15666 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15667 | /* this has to be set to VREF80 */ |
| 15668 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15669 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15670 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15671 | /* port-F for mic-in (front panel) with vref */ |
| 15672 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15673 | /* port-G for CLFE (rear panel) */ |
| 15674 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15675 | /* port-H for side (rear panel) */ |
| 15676 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15677 | /* CD-in */ |
| 15678 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15679 | /* route front mic to ADC1*/ |
| 15680 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15681 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15682 | /* Unmute DAC0~3 & spdif out*/ |
| 15683 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15684 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15685 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15686 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15688 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15689 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15690 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15691 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15692 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15693 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15694 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15695 | /* Unmute Stereo Mixer 15 */ |
| 15696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15697 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15698 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15699 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15700 | |
| 15701 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15702 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15703 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15704 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15705 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15706 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15707 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15708 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15709 | /* hp used DAC 3 (Front) */ |
| 15710 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15711 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15712 | { } |
| 15713 | }; |
| 15714 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15715 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15716 | /* |
| 15717 | * Unmute ADC0 and set the default input to mic-in |
| 15718 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15719 | /* port-A for surround (rear panel) |
| 15720 | * according to codec#0 this is the HP jack |
| 15721 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15722 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15723 | /* route front PCM to HP */ |
| 15724 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15725 | /* port-B for mic-in (rear panel) with vref */ |
| 15726 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15727 | /* port-C for line-in (rear panel) */ |
| 15728 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15729 | /* port-D for Front */ |
| 15730 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15731 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15732 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15733 | /* this has to be set to VREF80 */ |
| 15734 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15735 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15736 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15737 | /* port-F for mic-in (front panel) with vref */ |
| 15738 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15739 | /* port-G for CLFE (rear panel) */ |
| 15740 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15741 | /* port-H for side (rear panel) */ |
| 15742 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15743 | /* CD-in */ |
| 15744 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15745 | /* route front mic to ADC1*/ |
| 15746 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15748 | /* Unmute DAC0~3 & spdif out*/ |
| 15749 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15750 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15751 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15752 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15754 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15755 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15756 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15757 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15758 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15759 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15760 | /* Unmute Stereo Mixer 15 */ |
| 15761 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15762 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15763 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15764 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15765 | |
| 15766 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15767 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15768 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15769 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15770 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15771 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15772 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15773 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15774 | /* hp used DAC 3 (Front) */ |
| 15775 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15776 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15777 | { } |
| 15778 | }; |
| 15779 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15780 | /* additional init verbs for ASUS laptops */ |
| 15781 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15782 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15783 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15784 | { } |
| 15785 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15786 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15787 | /* |
| 15788 | * generic initialization of ADC, input mixers and output mixers |
| 15789 | */ |
| 15790 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15791 | /* |
| 15792 | * Unmute ADC0 and set the default input to mic-in |
| 15793 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15794 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15795 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15797 | /* Unmute DAC0~3 & spdif out*/ |
| 15798 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15799 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15800 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15801 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15802 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15803 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15804 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15805 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15806 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15807 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15808 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15809 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15810 | /* Unmute Stereo Mixer 15 */ |
| 15811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15812 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15815 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15816 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15817 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15818 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15819 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15821 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15822 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15823 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15824 | |
| 15825 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15826 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15827 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15828 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15829 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15830 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15831 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15832 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15833 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15834 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15835 | |
| 15836 | { } |
| 15837 | }; |
| 15838 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15839 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15840 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15841 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15842 | { } |
| 15843 | }; |
| 15844 | |
| 15845 | /* toggle speaker-output according to the hp-jack state */ |
| 15846 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15847 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15848 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15849 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15850 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15851 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15852 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15853 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15854 | } |
| 15855 | |
| 15856 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15857 | unsigned int res) |
| 15858 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15859 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15860 | alc861_toshiba_automute(codec); |
| 15861 | } |
| 15862 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15863 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15864 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15865 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15866 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15867 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15868 | |
| 15869 | |
| 15870 | #define ALC861_DIGOUT_NID 0x07 |
| 15871 | |
| 15872 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15873 | { 8, NULL } |
| 15874 | }; |
| 15875 | |
| 15876 | static hda_nid_t alc861_dac_nids[4] = { |
| 15877 | /* front, surround, clfe, side */ |
| 15878 | 0x03, 0x06, 0x05, 0x04 |
| 15879 | }; |
| 15880 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15881 | static hda_nid_t alc660_dac_nids[3] = { |
| 15882 | /* front, clfe, surround */ |
| 15883 | 0x03, 0x05, 0x06 |
| 15884 | }; |
| 15885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15886 | static hda_nid_t alc861_adc_nids[1] = { |
| 15887 | /* ADC0-2 */ |
| 15888 | 0x08, |
| 15889 | }; |
| 15890 | |
| 15891 | static struct hda_input_mux alc861_capture_source = { |
| 15892 | .num_items = 5, |
| 15893 | .items = { |
| 15894 | { "Mic", 0x0 }, |
| 15895 | { "Front Mic", 0x3 }, |
| 15896 | { "Line", 0x1 }, |
| 15897 | { "CD", 0x4 }, |
| 15898 | { "Mixer", 0x5 }, |
| 15899 | }, |
| 15900 | }; |
| 15901 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15902 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15903 | { |
| 15904 | struct alc_spec *spec = codec->spec; |
| 15905 | hda_nid_t mix, srcs[5]; |
| 15906 | int i, j, num; |
| 15907 | |
| 15908 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15909 | return 0; |
| 15910 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15911 | if (num < 0) |
| 15912 | return 0; |
| 15913 | for (i = 0; i < num; i++) { |
| 15914 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15915 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15916 | if (type != AC_WID_AUD_OUT) |
| 15917 | continue; |
| 15918 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15919 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15920 | break; |
| 15921 | if (j >= spec->multiout.num_dacs) |
| 15922 | return srcs[i]; |
| 15923 | } |
| 15924 | return 0; |
| 15925 | } |
| 15926 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15927 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15928 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15929 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15930 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15931 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15932 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15933 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15934 | |
| 15935 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15936 | for (i = 0; i < cfg->line_outs; i++) { |
| 15937 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15938 | dac = alc861_look_for_dac(codec, nid); |
| 15939 | if (!dac) |
| 15940 | continue; |
| 15941 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15942 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15943 | return 0; |
| 15944 | } |
| 15945 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15946 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15947 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15948 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15949 | 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] | 15950 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15951 | } |
| 15952 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15953 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15954 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15955 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15956 | /* add playback controls from the parsed DAC table */ |
| 15957 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15958 | const struct auto_pin_cfg *cfg) |
| 15959 | { |
| 15960 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 15961 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15962 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15963 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15964 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15965 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15966 | int i, err, noutputs; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15967 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15968 | noutputs = cfg->line_outs; |
| 15969 | if (spec->multi_ios > 0) |
| 15970 | noutputs += spec->multi_ios; |
| 15971 | |
| 15972 | for (i = 0; i < noutputs; i++) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15973 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15974 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15975 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15976 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15977 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15978 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15979 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15980 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15981 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15982 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15983 | return err; |
| 15984 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15985 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15986 | int index = i; |
| 15987 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15988 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15989 | index = 0; |
| 15990 | } |
| 15991 | err = __alc861_create_out_sw(codec, name, nid, index, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15992 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15993 | return err; |
| 15994 | } |
| 15995 | } |
| 15996 | return 0; |
| 15997 | } |
| 15998 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15999 | 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] | 16000 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16001 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16002 | int err; |
| 16003 | hda_nid_t nid; |
| 16004 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16005 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16006 | return 0; |
| 16007 | |
| 16008 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16009 | nid = alc861_look_for_dac(codec, pin); |
| 16010 | if (nid) { |
| 16011 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16012 | if (err < 0) |
| 16013 | return err; |
| 16014 | spec->multiout.hp_nid = nid; |
| 16015 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16016 | } |
| 16017 | return 0; |
| 16018 | } |
| 16019 | |
| 16020 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16021 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16022 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16023 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16024 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16025 | } |
| 16026 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16027 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16028 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16029 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16030 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16031 | hda_nid_t mix, srcs[5]; |
| 16032 | int i, num; |
| 16033 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16034 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16035 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16036 | 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] | 16037 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16038 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16039 | return; |
| 16040 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16041 | if (num < 0) |
| 16042 | return; |
| 16043 | for (i = 0; i < num; i++) { |
| 16044 | unsigned int mute; |
| 16045 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16046 | mute = AMP_IN_UNMUTE(i); |
| 16047 | else |
| 16048 | mute = AMP_IN_MUTE(i); |
| 16049 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16050 | mute); |
| 16051 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16052 | } |
| 16053 | |
| 16054 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16055 | { |
| 16056 | struct alc_spec *spec = codec->spec; |
| 16057 | int i; |
| 16058 | |
| 16059 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16060 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16061 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16062 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16063 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16064 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16065 | } |
| 16066 | } |
| 16067 | |
| 16068 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16069 | { |
| 16070 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16071 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16072 | if (spec->autocfg.hp_outs) |
| 16073 | alc861_auto_set_output_and_unmute(codec, |
| 16074 | spec->autocfg.hp_pins[0], |
| 16075 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16076 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16077 | if (spec->autocfg.speaker_outs) |
| 16078 | alc861_auto_set_output_and_unmute(codec, |
| 16079 | spec->autocfg.speaker_pins[0], |
| 16080 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16081 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16082 | } |
| 16083 | |
| 16084 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16085 | { |
| 16086 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16087 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16088 | int i; |
| 16089 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16090 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16091 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16092 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16093 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16094 | } |
| 16095 | } |
| 16096 | |
| 16097 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16098 | /* return 1 if successful, 0 if the proper config is not found, |
| 16099 | * or a negative error code |
| 16100 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16101 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16102 | { |
| 16103 | struct alc_spec *spec = codec->spec; |
| 16104 | int err; |
| 16105 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16106 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16107 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16108 | alc861_ignore); |
| 16109 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16110 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16111 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16112 | return 0; /* can't find valid BIOS pin config */ |
| 16113 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16114 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16115 | if (err < 0) |
| 16116 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16117 | err = alc_auto_add_multi_channel_mode(codec); |
| 16118 | if (err < 0) |
| 16119 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16120 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16121 | if (err < 0) |
| 16122 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16123 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16124 | if (err < 0) |
| 16125 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16126 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16127 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16128 | return err; |
| 16129 | |
| 16130 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16131 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16132 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16133 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16134 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16135 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16136 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16137 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16138 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16139 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16140 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16141 | |
| 16142 | spec->adc_nids = alc861_adc_nids; |
| 16143 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16144 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16145 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16146 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16147 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16148 | return 1; |
| 16149 | } |
| 16150 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16151 | /* additional initialization for auto-configuration model */ |
| 16152 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16153 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16154 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16155 | alc861_auto_init_multi_out(codec); |
| 16156 | alc861_auto_init_hp_out(codec); |
| 16157 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16158 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16159 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16160 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16161 | } |
| 16162 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16163 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16164 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16165 | { 0x15, HDA_INPUT, 0 }, |
| 16166 | { 0x15, HDA_INPUT, 1 }, |
| 16167 | { 0x15, HDA_INPUT, 2 }, |
| 16168 | { 0x15, HDA_INPUT, 3 }, |
| 16169 | { } /* end */ |
| 16170 | }; |
| 16171 | #endif |
| 16172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16173 | |
| 16174 | /* |
| 16175 | * configuration and preset |
| 16176 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16177 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16178 | [ALC861_3ST] = "3stack", |
| 16179 | [ALC660_3ST] = "3stack-660", |
| 16180 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16181 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16182 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16183 | [ALC861_TOSHIBA] = "toshiba", |
| 16184 | [ALC861_ASUS] = "asus", |
| 16185 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16186 | [ALC861_AUTO] = "auto", |
| 16187 | }; |
| 16188 | |
| 16189 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16190 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16191 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16192 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16193 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16194 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16195 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16196 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16197 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16198 | * Any other models that need this preset? |
| 16199 | */ |
| 16200 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16201 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16202 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16203 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16204 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16205 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16206 | /* FIXME: the below seems conflict */ |
| 16207 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16208 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16209 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16210 | {} |
| 16211 | }; |
| 16212 | |
| 16213 | static struct alc_config_preset alc861_presets[] = { |
| 16214 | [ALC861_3ST] = { |
| 16215 | .mixers = { alc861_3ST_mixer }, |
| 16216 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16217 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16218 | .dac_nids = alc861_dac_nids, |
| 16219 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16220 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16221 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16222 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16223 | .adc_nids = alc861_adc_nids, |
| 16224 | .input_mux = &alc861_capture_source, |
| 16225 | }, |
| 16226 | [ALC861_3ST_DIG] = { |
| 16227 | .mixers = { alc861_base_mixer }, |
| 16228 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16229 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16230 | .dac_nids = alc861_dac_nids, |
| 16231 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16232 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16233 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16234 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16235 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16236 | .adc_nids = alc861_adc_nids, |
| 16237 | .input_mux = &alc861_capture_source, |
| 16238 | }, |
| 16239 | [ALC861_6ST_DIG] = { |
| 16240 | .mixers = { alc861_base_mixer }, |
| 16241 | .init_verbs = { alc861_base_init_verbs }, |
| 16242 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16243 | .dac_nids = alc861_dac_nids, |
| 16244 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16245 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16246 | .channel_mode = alc861_8ch_modes, |
| 16247 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16248 | .adc_nids = alc861_adc_nids, |
| 16249 | .input_mux = &alc861_capture_source, |
| 16250 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16251 | [ALC660_3ST] = { |
| 16252 | .mixers = { alc861_3ST_mixer }, |
| 16253 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16254 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16255 | .dac_nids = alc660_dac_nids, |
| 16256 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16257 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16258 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16259 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16260 | .adc_nids = alc861_adc_nids, |
| 16261 | .input_mux = &alc861_capture_source, |
| 16262 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16263 | [ALC861_UNIWILL_M31] = { |
| 16264 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16265 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16266 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16267 | .dac_nids = alc861_dac_nids, |
| 16268 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16269 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16270 | .channel_mode = alc861_uniwill_m31_modes, |
| 16271 | .need_dac_fix = 1, |
| 16272 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16273 | .adc_nids = alc861_adc_nids, |
| 16274 | .input_mux = &alc861_capture_source, |
| 16275 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16276 | [ALC861_TOSHIBA] = { |
| 16277 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16278 | .init_verbs = { alc861_base_init_verbs, |
| 16279 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16280 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16281 | .dac_nids = alc861_dac_nids, |
| 16282 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16283 | .channel_mode = alc883_3ST_2ch_modes, |
| 16284 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16285 | .adc_nids = alc861_adc_nids, |
| 16286 | .input_mux = &alc861_capture_source, |
| 16287 | .unsol_event = alc861_toshiba_unsol_event, |
| 16288 | .init_hook = alc861_toshiba_automute, |
| 16289 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16290 | [ALC861_ASUS] = { |
| 16291 | .mixers = { alc861_asus_mixer }, |
| 16292 | .init_verbs = { alc861_asus_init_verbs }, |
| 16293 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16294 | .dac_nids = alc861_dac_nids, |
| 16295 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16296 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16297 | .channel_mode = alc861_asus_modes, |
| 16298 | .need_dac_fix = 1, |
| 16299 | .hp_nid = 0x06, |
| 16300 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16301 | .adc_nids = alc861_adc_nids, |
| 16302 | .input_mux = &alc861_capture_source, |
| 16303 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16304 | [ALC861_ASUS_LAPTOP] = { |
| 16305 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16306 | .init_verbs = { alc861_asus_init_verbs, |
| 16307 | alc861_asus_laptop_init_verbs }, |
| 16308 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16309 | .dac_nids = alc861_dac_nids, |
| 16310 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16311 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16312 | .channel_mode = alc883_3ST_2ch_modes, |
| 16313 | .need_dac_fix = 1, |
| 16314 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16315 | .adc_nids = alc861_adc_nids, |
| 16316 | .input_mux = &alc861_capture_source, |
| 16317 | }, |
| 16318 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16319 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16320 | /* Pin config fixes */ |
| 16321 | enum { |
| 16322 | PINFIX_FSC_AMILO_PI1505, |
| 16323 | }; |
| 16324 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16325 | static const struct alc_fixup alc861_fixups[] = { |
| 16326 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16327 | .type = ALC_FIXUP_PINS, |
| 16328 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16329 | { 0x0b, 0x0221101f }, /* HP */ |
| 16330 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16331 | { } |
| 16332 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16333 | }, |
| 16334 | }; |
| 16335 | |
| 16336 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16337 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16338 | {} |
| 16339 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16340 | |
| 16341 | static int patch_alc861(struct hda_codec *codec) |
| 16342 | { |
| 16343 | struct alc_spec *spec; |
| 16344 | int board_config; |
| 16345 | int err; |
| 16346 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16347 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16348 | if (spec == NULL) |
| 16349 | return -ENOMEM; |
| 16350 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16351 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16352 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16353 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16354 | alc861_models, |
| 16355 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16356 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16357 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16358 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16359 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16360 | board_config = ALC861_AUTO; |
| 16361 | } |
| 16362 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16363 | if (board_config == ALC861_AUTO) { |
| 16364 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16365 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16366 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16367 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16368 | if (board_config == ALC861_AUTO) { |
| 16369 | /* automatic parse from the BIOS config */ |
| 16370 | err = alc861_parse_auto_config(codec); |
| 16371 | if (err < 0) { |
| 16372 | alc_free(codec); |
| 16373 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16374 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16375 | printk(KERN_INFO |
| 16376 | "hda_codec: Cannot set up configuration " |
| 16377 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16378 | board_config = ALC861_3ST_DIG; |
| 16379 | } |
| 16380 | } |
| 16381 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16382 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16383 | if (err < 0) { |
| 16384 | alc_free(codec); |
| 16385 | return err; |
| 16386 | } |
| 16387 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16388 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16389 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16390 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16391 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16392 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16393 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16394 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16395 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16396 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16397 | if (!spec->cap_mixer) |
| 16398 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16399 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16400 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16401 | spec->vmaster_nid = 0x03; |
| 16402 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16403 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16404 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16405 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16406 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16407 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16408 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16409 | spec->power_hook = alc_power_eapd; |
| 16410 | #endif |
| 16411 | } |
| 16412 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16413 | if (!spec->loopback.amplist) |
| 16414 | spec->loopback.amplist = alc861_loopbacks; |
| 16415 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16416 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16417 | return 0; |
| 16418 | } |
| 16419 | |
| 16420 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16421 | * ALC861-VD support |
| 16422 | * |
| 16423 | * Based on ALC882 |
| 16424 | * |
| 16425 | * In addition, an independent DAC |
| 16426 | */ |
| 16427 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16428 | |
| 16429 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16430 | /* front, surr, clfe, side surr */ |
| 16431 | 0x02, 0x03, 0x04, 0x05 |
| 16432 | }; |
| 16433 | |
| 16434 | /* dac_nids for ALC660vd are in a different order - according to |
| 16435 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16436 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16437 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16438 | * - and it is the same as in 861vd. |
| 16439 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16440 | */ |
| 16441 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16442 | /* front, rear, clfe, rear_surr */ |
| 16443 | 0x02, 0x04, 0x03 |
| 16444 | }; |
| 16445 | |
| 16446 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16447 | /* ADC0 */ |
| 16448 | 0x09, |
| 16449 | }; |
| 16450 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16451 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16452 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16453 | /* input MUX */ |
| 16454 | /* FIXME: should be a matrix-type input source selection */ |
| 16455 | static struct hda_input_mux alc861vd_capture_source = { |
| 16456 | .num_items = 4, |
| 16457 | .items = { |
| 16458 | { "Mic", 0x0 }, |
| 16459 | { "Front Mic", 0x1 }, |
| 16460 | { "Line", 0x2 }, |
| 16461 | { "CD", 0x4 }, |
| 16462 | }, |
| 16463 | }; |
| 16464 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16465 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16466 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16467 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16468 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16469 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16470 | }, |
| 16471 | }; |
| 16472 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16473 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16474 | .num_items = 2, |
| 16475 | .items = { |
| 16476 | { "Front Mic", 0x0 }, |
| 16477 | { "ATAPI Mic", 0x1 }, |
| 16478 | }, |
| 16479 | }; |
| 16480 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16481 | /* |
| 16482 | * 2ch mode |
| 16483 | */ |
| 16484 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16485 | { 2, NULL } |
| 16486 | }; |
| 16487 | |
| 16488 | /* |
| 16489 | * 6ch mode |
| 16490 | */ |
| 16491 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16492 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16493 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16494 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16495 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16496 | { } /* end */ |
| 16497 | }; |
| 16498 | |
| 16499 | /* |
| 16500 | * 8ch mode |
| 16501 | */ |
| 16502 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16503 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16504 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16505 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16506 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16507 | { } /* end */ |
| 16508 | }; |
| 16509 | |
| 16510 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16511 | { 6, alc861vd_6stack_ch6_init }, |
| 16512 | { 8, alc861vd_6stack_ch8_init }, |
| 16513 | }; |
| 16514 | |
| 16515 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16516 | { |
| 16517 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16518 | .name = "Channel Mode", |
| 16519 | .info = alc_ch_mode_info, |
| 16520 | .get = alc_ch_mode_get, |
| 16521 | .put = alc_ch_mode_put, |
| 16522 | }, |
| 16523 | { } /* end */ |
| 16524 | }; |
| 16525 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16526 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16527 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16528 | */ |
| 16529 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16530 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16531 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16532 | |
| 16533 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16534 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16535 | |
| 16536 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16537 | HDA_OUTPUT), |
| 16538 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16539 | HDA_OUTPUT), |
| 16540 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16541 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16542 | |
| 16543 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16544 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16545 | |
| 16546 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16547 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16548 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16550 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16551 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16552 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16553 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16554 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16555 | |
| 16556 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16557 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16558 | |
| 16559 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16560 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16561 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16562 | { } /* end */ |
| 16563 | }; |
| 16564 | |
| 16565 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16566 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16567 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16568 | |
| 16569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16570 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16571 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16574 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16575 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16576 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16577 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16578 | |
| 16579 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16580 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16581 | |
| 16582 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16583 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16584 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16585 | { } /* end */ |
| 16586 | }; |
| 16587 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16588 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16589 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16590 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16591 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16592 | |
| 16593 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16594 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16595 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16598 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16599 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16600 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16601 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16602 | |
| 16603 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16604 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16605 | |
| 16606 | { } /* end */ |
| 16607 | }; |
| 16608 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16609 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16610 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16611 | */ |
| 16612 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16613 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16614 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16615 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16616 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16617 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16620 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16621 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16622 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16623 | { } /* end */ |
| 16624 | }; |
| 16625 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16626 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16627 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16628 | */ |
| 16629 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16630 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16631 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16632 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16633 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16634 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16636 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16637 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16638 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16639 | { } /* end */ |
| 16640 | }; |
| 16641 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16642 | /* |
| 16643 | * generic initialization of ADC, input mixers and output mixers |
| 16644 | */ |
| 16645 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16646 | /* |
| 16647 | * Unmute ADC0 and set the default input to mic-in |
| 16648 | */ |
| 16649 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16650 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16651 | |
| 16652 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16653 | * the analog-loopback mixer widget |
| 16654 | */ |
| 16655 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16656 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16659 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16661 | |
| 16662 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16663 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16664 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16665 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16667 | |
| 16668 | /* |
| 16669 | * Set up output mixers (0x02 - 0x05) |
| 16670 | */ |
| 16671 | /* set vol=0 to output mixers */ |
| 16672 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16673 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16674 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16675 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16676 | |
| 16677 | /* set up input amps for analog loopback */ |
| 16678 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16679 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16681 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16682 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16683 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16685 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16686 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16687 | |
| 16688 | { } |
| 16689 | }; |
| 16690 | |
| 16691 | /* |
| 16692 | * 3-stack pin configuration: |
| 16693 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16694 | */ |
| 16695 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16696 | /* |
| 16697 | * Set pin mode and muting |
| 16698 | */ |
| 16699 | /* set front pin widgets 0x14 for output */ |
| 16700 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16701 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16702 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16703 | |
| 16704 | /* Mic (rear) pin: input vref at 80% */ |
| 16705 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16706 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16707 | /* Front Mic pin: input vref at 80% */ |
| 16708 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16709 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16710 | /* Line In pin: input */ |
| 16711 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16712 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16713 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16714 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16715 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16716 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16717 | /* CD pin widget for input */ |
| 16718 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16719 | |
| 16720 | { } |
| 16721 | }; |
| 16722 | |
| 16723 | /* |
| 16724 | * 6-stack pin configuration: |
| 16725 | */ |
| 16726 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16727 | /* |
| 16728 | * Set pin mode and muting |
| 16729 | */ |
| 16730 | /* set front pin widgets 0x14 for output */ |
| 16731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16732 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16733 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16734 | |
| 16735 | /* Rear Pin: output 1 (0x0d) */ |
| 16736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16738 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16739 | /* CLFE Pin: output 2 (0x0e) */ |
| 16740 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16741 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16742 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16743 | /* Side Pin: output 3 (0x0f) */ |
| 16744 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16746 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16747 | |
| 16748 | /* Mic (rear) pin: input vref at 80% */ |
| 16749 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16750 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16751 | /* Front Mic pin: input vref at 80% */ |
| 16752 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16754 | /* Line In pin: input */ |
| 16755 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16756 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16757 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16758 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16759 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16760 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16761 | /* CD pin widget for input */ |
| 16762 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16763 | |
| 16764 | { } |
| 16765 | }; |
| 16766 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16767 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16768 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16769 | { } |
| 16770 | }; |
| 16771 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16772 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16773 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16774 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16775 | { } |
| 16776 | }; |
| 16777 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16778 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16781 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16782 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16783 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16784 | {} |
| 16785 | }; |
| 16786 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16787 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16788 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16789 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16790 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16791 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16792 | spec->automute = 1; |
| 16793 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
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 | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16798 | alc_hp_automute(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: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16810 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 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; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16867 | spec->automute = 1; |
| 16868 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16869 | } |
| 16870 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16871 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16872 | #define alc861vd_loopbacks alc880_loopbacks |
| 16873 | #endif |
| 16874 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16875 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16876 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16877 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16878 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16879 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16880 | |
| 16881 | /* |
| 16882 | * configuration and preset |
| 16883 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16884 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16885 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16886 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16887 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16888 | [ALC861VD_3ST] = "3stack", |
| 16889 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16890 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16891 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16892 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16893 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16894 | [ALC861VD_AUTO] = "auto", |
| 16895 | }; |
| 16896 | |
| 16897 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16898 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16899 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16900 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16901 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16902 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16903 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16904 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16905 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16906 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16907 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16908 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16909 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16910 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16911 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16912 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16913 | {} |
| 16914 | }; |
| 16915 | |
| 16916 | static struct alc_config_preset alc861vd_presets[] = { |
| 16917 | [ALC660VD_3ST] = { |
| 16918 | .mixers = { alc861vd_3st_mixer }, |
| 16919 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16920 | alc861vd_3stack_init_verbs }, |
| 16921 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16922 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16923 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16924 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16925 | .input_mux = &alc861vd_capture_source, |
| 16926 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16927 | [ALC660VD_3ST_DIG] = { |
| 16928 | .mixers = { alc861vd_3st_mixer }, |
| 16929 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16930 | alc861vd_3stack_init_verbs }, |
| 16931 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16932 | .dac_nids = alc660vd_dac_nids, |
| 16933 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16934 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16935 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16936 | .input_mux = &alc861vd_capture_source, |
| 16937 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16938 | [ALC861VD_3ST] = { |
| 16939 | .mixers = { alc861vd_3st_mixer }, |
| 16940 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16941 | alc861vd_3stack_init_verbs }, |
| 16942 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16943 | .dac_nids = alc861vd_dac_nids, |
| 16944 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16945 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16946 | .input_mux = &alc861vd_capture_source, |
| 16947 | }, |
| 16948 | [ALC861VD_3ST_DIG] = { |
| 16949 | .mixers = { alc861vd_3st_mixer }, |
| 16950 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16951 | alc861vd_3stack_init_verbs }, |
| 16952 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16953 | .dac_nids = alc861vd_dac_nids, |
| 16954 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16955 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16956 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16957 | .input_mux = &alc861vd_capture_source, |
| 16958 | }, |
| 16959 | [ALC861VD_6ST_DIG] = { |
| 16960 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16961 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16962 | alc861vd_6stack_init_verbs }, |
| 16963 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16964 | .dac_nids = alc861vd_dac_nids, |
| 16965 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16966 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16967 | .channel_mode = alc861vd_6stack_modes, |
| 16968 | .input_mux = &alc861vd_capture_source, |
| 16969 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16970 | [ALC861VD_LENOVO] = { |
| 16971 | .mixers = { alc861vd_lenovo_mixer }, |
| 16972 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16973 | alc861vd_3stack_init_verbs, |
| 16974 | alc861vd_eapd_verbs, |
| 16975 | alc861vd_lenovo_unsol_verbs }, |
| 16976 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16977 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16978 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16979 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16980 | .input_mux = &alc861vd_capture_source, |
| 16981 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16982 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16983 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16984 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16985 | [ALC861VD_DALLAS] = { |
| 16986 | .mixers = { alc861vd_dallas_mixer }, |
| 16987 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16988 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16989 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16990 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16991 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16992 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16993 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16994 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16995 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16996 | }, |
| 16997 | [ALC861VD_HP] = { |
| 16998 | .mixers = { alc861vd_hp_mixer }, |
| 16999 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17000 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17001 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17002 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17003 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17004 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17005 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17006 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17007 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17008 | .init_hook = alc_hp_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17009 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17010 | [ALC660VD_ASUS_V1S] = { |
| 17011 | .mixers = { alc861vd_lenovo_mixer }, |
| 17012 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17013 | alc861vd_3stack_init_verbs, |
| 17014 | alc861vd_eapd_verbs, |
| 17015 | alc861vd_lenovo_unsol_verbs }, |
| 17016 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17017 | .dac_nids = alc660vd_dac_nids, |
| 17018 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17019 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17020 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17021 | .input_mux = &alc861vd_capture_source, |
| 17022 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17023 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17024 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17025 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17026 | }; |
| 17027 | |
| 17028 | /* |
| 17029 | * BIOS auto configuration |
| 17030 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17031 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17032 | const struct auto_pin_cfg *cfg) |
| 17033 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17034 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17035 | } |
| 17036 | |
| 17037 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17038 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17039 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17040 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17041 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17042 | } |
| 17043 | |
| 17044 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17045 | { |
| 17046 | struct alc_spec *spec = codec->spec; |
| 17047 | int i; |
| 17048 | |
| 17049 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17050 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17051 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17052 | if (nid) |
| 17053 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17054 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17055 | } |
| 17056 | } |
| 17057 | |
| 17058 | |
| 17059 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17060 | { |
| 17061 | struct alc_spec *spec = codec->spec; |
| 17062 | hda_nid_t pin; |
| 17063 | |
| 17064 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17065 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17066 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17067 | pin = spec->autocfg.speaker_pins[0]; |
| 17068 | if (pin) |
| 17069 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17070 | } |
| 17071 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17072 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17073 | |
| 17074 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17075 | { |
| 17076 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17077 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17078 | int i; |
| 17079 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17080 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17081 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17082 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17083 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17084 | if (nid != ALC861VD_PIN_CD_NID && |
| 17085 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17086 | snd_hda_codec_write(codec, nid, 0, |
| 17087 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17088 | AMP_OUT_MUTE); |
| 17089 | } |
| 17090 | } |
| 17091 | } |
| 17092 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17093 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17094 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17095 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17096 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17097 | |
| 17098 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17099 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17100 | * different NIDs for mute/unmute switch and volume control */ |
| 17101 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17102 | const struct auto_pin_cfg *cfg) |
| 17103 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17104 | static const char * const chname[4] = { |
| 17105 | "Front", "Surround", "CLFE", "Side" |
| 17106 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17107 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17108 | hda_nid_t nid_v, nid_s; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17109 | int i, err, noutputs; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17110 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17111 | noutputs = cfg->line_outs; |
| 17112 | if (spec->multi_ios > 0) |
| 17113 | noutputs += spec->multi_ios; |
| 17114 | |
| 17115 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17116 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17117 | continue; |
| 17118 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17119 | alc880_dac_to_idx( |
| 17120 | spec->multiout.dac_nids[i])); |
| 17121 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17122 | alc880_dac_to_idx( |
| 17123 | spec->multiout.dac_nids[i])); |
| 17124 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17125 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17126 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17127 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17128 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17129 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 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_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17134 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17135 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17136 | HDA_OUTPUT)); |
| 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 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17141 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17142 | HDA_INPUT)); |
| 17143 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17144 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17145 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17146 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17147 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17148 | HDA_INPUT)); |
| 17149 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17150 | return err; |
| 17151 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17152 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17153 | int index = i; |
| 17154 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17155 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17156 | index = 0; |
| 17157 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17158 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17159 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17160 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17161 | HDA_OUTPUT)); |
| 17162 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17163 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17164 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17165 | name, index, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17166 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17167 | HDA_INPUT)); |
| 17168 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17169 | return err; |
| 17170 | } |
| 17171 | } |
| 17172 | return 0; |
| 17173 | } |
| 17174 | |
| 17175 | /* add playback controls for speaker and HP outputs */ |
| 17176 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17177 | * different NIDs for mute/unmute switch and volume control */ |
| 17178 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17179 | hda_nid_t pin, const char *pfx) |
| 17180 | { |
| 17181 | hda_nid_t nid_v, nid_s; |
| 17182 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17183 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17184 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17185 | return 0; |
| 17186 | |
| 17187 | if (alc880_is_fixed_pin(pin)) { |
| 17188 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17189 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17190 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17191 | spec->multiout.hp_nid = nid_v; |
| 17192 | else |
| 17193 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17194 | /* control HP volume/switch on the output mixer amp */ |
| 17195 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17196 | alc880_fixed_pin_idx(pin)); |
| 17197 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17198 | alc880_fixed_pin_idx(pin)); |
| 17199 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17200 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17201 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17202 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17203 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17204 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17205 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17206 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17207 | return err; |
| 17208 | } else if (alc880_is_multi_pin(pin)) { |
| 17209 | /* set manual connection */ |
| 17210 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17211 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17212 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17213 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17214 | return err; |
| 17215 | } |
| 17216 | return 0; |
| 17217 | } |
| 17218 | |
| 17219 | /* parse the BIOS configuration and set up the alc_spec |
| 17220 | * return 1 if successful, 0 if the proper config is not found, |
| 17221 | * or a negative error code |
| 17222 | * Based on ALC880 version - had to change it to override |
| 17223 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17224 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17225 | { |
| 17226 | struct alc_spec *spec = codec->spec; |
| 17227 | int err; |
| 17228 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17230 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17231 | alc861vd_ignore); |
| 17232 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17233 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17234 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17235 | return 0; /* can't find valid BIOS pin config */ |
| 17236 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17237 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17238 | if (err < 0) |
| 17239 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17240 | err = alc_auto_add_multi_channel_mode(codec); |
| 17241 | if (err < 0) |
| 17242 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17243 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17244 | if (err < 0) |
| 17245 | return err; |
| 17246 | err = alc861vd_auto_create_extra_out(spec, |
| 17247 | spec->autocfg.speaker_pins[0], |
| 17248 | "Speaker"); |
| 17249 | if (err < 0) |
| 17250 | return err; |
| 17251 | err = alc861vd_auto_create_extra_out(spec, |
| 17252 | spec->autocfg.hp_pins[0], |
| 17253 | "Headphone"); |
| 17254 | if (err < 0) |
| 17255 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17256 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17257 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17258 | return err; |
| 17259 | |
| 17260 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17261 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17262 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17263 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17264 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17265 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17266 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17267 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17268 | |
| 17269 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17270 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17271 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17272 | err = alc_auto_add_mic_boost(codec); |
| 17273 | if (err < 0) |
| 17274 | return err; |
| 17275 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17276 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17277 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17278 | return 1; |
| 17279 | } |
| 17280 | |
| 17281 | /* additional initialization for auto-configuration model */ |
| 17282 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17283 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17284 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17285 | alc861vd_auto_init_multi_out(codec); |
| 17286 | alc861vd_auto_init_hp_out(codec); |
| 17287 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17288 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17289 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17290 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17291 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17292 | } |
| 17293 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17294 | enum { |
| 17295 | ALC660VD_FIX_ASUS_GPIO1 |
| 17296 | }; |
| 17297 | |
| 17298 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17299 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17300 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17301 | .type = ALC_FIXUP_VERBS, |
| 17302 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17303 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17304 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17305 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17306 | { } |
| 17307 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17308 | }, |
| 17309 | }; |
| 17310 | |
| 17311 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17312 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17313 | {} |
| 17314 | }; |
| 17315 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17316 | static int patch_alc861vd(struct hda_codec *codec) |
| 17317 | { |
| 17318 | struct alc_spec *spec; |
| 17319 | int err, board_config; |
| 17320 | |
| 17321 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17322 | if (spec == NULL) |
| 17323 | return -ENOMEM; |
| 17324 | |
| 17325 | codec->spec = spec; |
| 17326 | |
| 17327 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17328 | alc861vd_models, |
| 17329 | alc861vd_cfg_tbl); |
| 17330 | |
| 17331 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17332 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17333 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17334 | board_config = ALC861VD_AUTO; |
| 17335 | } |
| 17336 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17337 | if (board_config == ALC861VD_AUTO) { |
| 17338 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17339 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17340 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17341 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17342 | if (board_config == ALC861VD_AUTO) { |
| 17343 | /* automatic parse from the BIOS config */ |
| 17344 | err = alc861vd_parse_auto_config(codec); |
| 17345 | if (err < 0) { |
| 17346 | alc_free(codec); |
| 17347 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17348 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17349 | printk(KERN_INFO |
| 17350 | "hda_codec: Cannot set up configuration " |
| 17351 | "from BIOS. Using base mode...\n"); |
| 17352 | board_config = ALC861VD_3ST; |
| 17353 | } |
| 17354 | } |
| 17355 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17356 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17357 | if (err < 0) { |
| 17358 | alc_free(codec); |
| 17359 | return err; |
| 17360 | } |
| 17361 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17362 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17363 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17364 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17365 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17366 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17367 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17368 | } |
| 17369 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17370 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17371 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17372 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17373 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17374 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17375 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17376 | if (!spec->adc_nids) { |
| 17377 | spec->adc_nids = alc861vd_adc_nids; |
| 17378 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17379 | } |
| 17380 | if (!spec->capsrc_nids) |
| 17381 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17382 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17383 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17384 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17385 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17386 | spec->vmaster_nid = 0x02; |
| 17387 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17388 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17389 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17390 | codec->patch_ops = alc_patch_ops; |
| 17391 | |
| 17392 | if (board_config == ALC861VD_AUTO) |
| 17393 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 17394 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17395 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17396 | if (!spec->loopback.amplist) |
| 17397 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17398 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17399 | |
| 17400 | return 0; |
| 17401 | } |
| 17402 | |
| 17403 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17404 | * ALC662 support |
| 17405 | * |
| 17406 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17407 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17408 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17409 | * 6-channel independent captures. |
| 17410 | * |
| 17411 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17412 | * driver yet). |
| 17413 | */ |
| 17414 | #define ALC662_DIGOUT_NID 0x06 |
| 17415 | #define ALC662_DIGIN_NID 0x0a |
| 17416 | |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 17417 | static hda_nid_t alc662_dac_nids[3] = { |
| 17418 | /* front, rear, clfe */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17419 | 0x02, 0x03, 0x04 |
| 17420 | }; |
| 17421 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17422 | static hda_nid_t alc272_dac_nids[2] = { |
| 17423 | 0x02, 0x03 |
| 17424 | }; |
| 17425 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17426 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17427 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17428 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17429 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17430 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17431 | static hda_nid_t alc272_adc_nids[1] = { |
| 17432 | /* ADC1-2 */ |
| 17433 | 0x08, |
| 17434 | }; |
| 17435 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17436 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17437 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17438 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17439 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17440 | /* input MUX */ |
| 17441 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17442 | static struct hda_input_mux alc662_capture_source = { |
| 17443 | .num_items = 4, |
| 17444 | .items = { |
| 17445 | { "Mic", 0x0 }, |
| 17446 | { "Front Mic", 0x1 }, |
| 17447 | { "Line", 0x2 }, |
| 17448 | { "CD", 0x4 }, |
| 17449 | }, |
| 17450 | }; |
| 17451 | |
| 17452 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17453 | .num_items = 2, |
| 17454 | .items = { |
| 17455 | { "Mic", 0x1 }, |
| 17456 | { "Line", 0x2 }, |
| 17457 | }, |
| 17458 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17459 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17460 | static struct hda_input_mux alc663_capture_source = { |
| 17461 | .num_items = 3, |
| 17462 | .items = { |
| 17463 | { "Mic", 0x0 }, |
| 17464 | { "Front Mic", 0x1 }, |
| 17465 | { "Line", 0x2 }, |
| 17466 | }, |
| 17467 | }; |
| 17468 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17469 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17470 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17471 | .num_items = 16, |
| 17472 | .items = { |
| 17473 | { "Autoselect Mic", 0x0 }, |
| 17474 | { "Internal Mic", 0x1 }, |
| 17475 | { "In-0x02", 0x2 }, |
| 17476 | { "In-0x03", 0x3 }, |
| 17477 | { "In-0x04", 0x4 }, |
| 17478 | { "In-0x05", 0x5 }, |
| 17479 | { "In-0x06", 0x6 }, |
| 17480 | { "In-0x07", 0x7 }, |
| 17481 | { "In-0x08", 0x8 }, |
| 17482 | { "In-0x09", 0x9 }, |
| 17483 | { "In-0x0a", 0x0a }, |
| 17484 | { "In-0x0b", 0x0b }, |
| 17485 | { "In-0x0c", 0x0c }, |
| 17486 | { "In-0x0d", 0x0d }, |
| 17487 | { "In-0x0e", 0x0e }, |
| 17488 | { "In-0x0f", 0x0f }, |
| 17489 | }, |
| 17490 | }; |
| 17491 | #endif |
| 17492 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17493 | /* |
| 17494 | * 2ch mode |
| 17495 | */ |
| 17496 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17497 | { 2, NULL } |
| 17498 | }; |
| 17499 | |
| 17500 | /* |
| 17501 | * 2ch mode |
| 17502 | */ |
| 17503 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17504 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17505 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17506 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17507 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17508 | { } /* end */ |
| 17509 | }; |
| 17510 | |
| 17511 | /* |
| 17512 | * 6ch mode |
| 17513 | */ |
| 17514 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17515 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17516 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17517 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17518 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17519 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17520 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17521 | { } /* end */ |
| 17522 | }; |
| 17523 | |
| 17524 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17525 | { 2, alc662_3ST_ch2_init }, |
| 17526 | { 6, alc662_3ST_ch6_init }, |
| 17527 | }; |
| 17528 | |
| 17529 | /* |
| 17530 | * 2ch mode |
| 17531 | */ |
| 17532 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17533 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17534 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17535 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17536 | { } /* end */ |
| 17537 | }; |
| 17538 | |
| 17539 | /* |
| 17540 | * 6ch mode |
| 17541 | */ |
| 17542 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17543 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17544 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17545 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17546 | { } /* end */ |
| 17547 | }; |
| 17548 | |
| 17549 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17550 | { 2, alc662_sixstack_ch6_init }, |
| 17551 | { 6, alc662_sixstack_ch8_init }, |
| 17552 | }; |
| 17553 | |
| 17554 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17555 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17556 | */ |
| 17557 | |
| 17558 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17559 | /* output mixer control */ |
| 17560 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17561 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17562 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17563 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17564 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17565 | 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] | 17566 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17567 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17568 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17569 | |
| 17570 | /*Input mixer control */ |
| 17571 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17572 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17573 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17574 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17575 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17576 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17577 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17578 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17579 | { } /* end */ |
| 17580 | }; |
| 17581 | |
| 17582 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17583 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17584 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17585 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17586 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17587 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17588 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17589 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17590 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17591 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17592 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17593 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17594 | { } /* end */ |
| 17595 | }; |
| 17596 | |
| 17597 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17598 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17599 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17600 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17601 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17602 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17603 | 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] | 17604 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17605 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17606 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17607 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17608 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17609 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17610 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17611 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17612 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17613 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17614 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17615 | { } /* end */ |
| 17616 | }; |
| 17617 | |
| 17618 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17619 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17620 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17621 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17622 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17623 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17624 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17625 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17628 | { } /* end */ |
| 17629 | }; |
| 17630 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17631 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17632 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17633 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17634 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17635 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17638 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17639 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17640 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17641 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17642 | { } /* end */ |
| 17643 | }; |
| 17644 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17645 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17646 | ALC262_HIPPO_MASTER_SWITCH, |
| 17647 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17648 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17649 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17650 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17651 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17652 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17653 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17656 | { } /* end */ |
| 17657 | }; |
| 17658 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17659 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17660 | .ops = &snd_hda_bind_vol, |
| 17661 | .values = { |
| 17662 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17663 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17664 | 0 |
| 17665 | }, |
| 17666 | }; |
| 17667 | |
| 17668 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17669 | .ops = &snd_hda_bind_sw, |
| 17670 | .values = { |
| 17671 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17672 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17673 | 0 |
| 17674 | }, |
| 17675 | }; |
| 17676 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17677 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17678 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17679 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17682 | { } /* end */ |
| 17683 | }; |
| 17684 | |
| 17685 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17686 | .ops = &snd_hda_bind_sw, |
| 17687 | .values = { |
| 17688 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17689 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17690 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17691 | 0 |
| 17692 | }, |
| 17693 | }; |
| 17694 | |
| 17695 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17696 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17697 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17698 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17699 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17700 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17701 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17702 | |
| 17703 | { } /* end */ |
| 17704 | }; |
| 17705 | |
| 17706 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17707 | .ops = &snd_hda_bind_sw, |
| 17708 | .values = { |
| 17709 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17710 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17711 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17712 | 0 |
| 17713 | }, |
| 17714 | }; |
| 17715 | |
| 17716 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17717 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17718 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17721 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17722 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17723 | { } /* end */ |
| 17724 | }; |
| 17725 | |
| 17726 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17727 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17728 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17729 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17730 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17732 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17733 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17734 | { } /* end */ |
| 17735 | }; |
| 17736 | |
| 17737 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17738 | .ops = &snd_hda_bind_vol, |
| 17739 | .values = { |
| 17740 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17741 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17742 | 0 |
| 17743 | }, |
| 17744 | }; |
| 17745 | |
| 17746 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17747 | .ops = &snd_hda_bind_sw, |
| 17748 | .values = { |
| 17749 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17750 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17751 | 0 |
| 17752 | }, |
| 17753 | }; |
| 17754 | |
| 17755 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17756 | HDA_BIND_VOL("Master Playback Volume", |
| 17757 | &alc663_asus_two_bind_master_vol), |
| 17758 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17759 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17760 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17761 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17762 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17763 | { } /* end */ |
| 17764 | }; |
| 17765 | |
| 17766 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17767 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17768 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17769 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17770 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17773 | { } /* end */ |
| 17774 | }; |
| 17775 | |
| 17776 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17777 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17778 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17779 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17780 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17781 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17782 | |
| 17783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17784 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17785 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17786 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17787 | { } /* end */ |
| 17788 | }; |
| 17789 | |
| 17790 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17791 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17792 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17794 | |
| 17795 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17797 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17798 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17801 | { } /* end */ |
| 17802 | }; |
| 17803 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17804 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17805 | .ops = &snd_hda_bind_sw, |
| 17806 | .values = { |
| 17807 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17808 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17809 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17810 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17811 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17812 | 0 |
| 17813 | }, |
| 17814 | }; |
| 17815 | |
| 17816 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17817 | .ops = &snd_hda_bind_sw, |
| 17818 | .values = { |
| 17819 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17820 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17821 | 0 |
| 17822 | }, |
| 17823 | }; |
| 17824 | |
| 17825 | static struct snd_kcontrol_new alc663_mode7_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", 0x1b, 0x0, HDA_OUTPUT), |
| 17830 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17831 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17832 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17835 | { } /* end */ |
| 17836 | }; |
| 17837 | |
| 17838 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17839 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17840 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17841 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17842 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17843 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17846 | { } /* end */ |
| 17847 | }; |
| 17848 | |
| 17849 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17850 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17851 | { |
| 17852 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17853 | .name = "Channel Mode", |
| 17854 | .info = alc_ch_mode_info, |
| 17855 | .get = alc_ch_mode_get, |
| 17856 | .put = alc_ch_mode_put, |
| 17857 | }, |
| 17858 | { } /* end */ |
| 17859 | }; |
| 17860 | |
| 17861 | static struct hda_verb alc662_init_verbs[] = { |
| 17862 | /* ADC: mute amp left and right */ |
| 17863 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17864 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17865 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17866 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17867 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17868 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17869 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17870 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17871 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17872 | |
| 17873 | /* Front Pin: output 0 (0x0c) */ |
| 17874 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17875 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17876 | |
| 17877 | /* Rear Pin: output 1 (0x0d) */ |
| 17878 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17879 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17880 | |
| 17881 | /* CLFE Pin: output 2 (0x0e) */ |
| 17882 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17883 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17884 | |
| 17885 | /* Mic (rear) pin: input vref at 80% */ |
| 17886 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17887 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17888 | /* Front Mic pin: input vref at 80% */ |
| 17889 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17890 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17891 | /* Line In pin: input */ |
| 17892 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17893 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17894 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17895 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17896 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17897 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17898 | /* CD pin widget for input */ |
| 17899 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17900 | |
| 17901 | /* FIXME: use matrix-type input source selection */ |
| 17902 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17903 | /* Input mixer */ |
| 17904 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17905 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17906 | |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 17907 | { } |
| 17908 | }; |
| 17909 | |
| 17910 | static struct hda_verb alc662_eapd_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17911 | /* always trun on EAPD */ |
| 17912 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17913 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17914 | { } |
| 17915 | }; |
| 17916 | |
| 17917 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17918 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17919 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17920 | {} |
| 17921 | }; |
| 17922 | |
| 17923 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17924 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17925 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17926 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17927 | }; |
| 17928 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17929 | /* Set Unsolicited Event*/ |
| 17930 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17931 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17932 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17933 | {} |
| 17934 | }; |
| 17935 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17936 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17937 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17938 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17939 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17940 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17941 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17942 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17943 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17944 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17945 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17946 | {} |
| 17947 | }; |
| 17948 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17949 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17950 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17951 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17952 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17953 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17955 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17956 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17957 | {} |
| 17958 | }; |
| 17959 | |
| 17960 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17961 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17962 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17963 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17964 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17965 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17967 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17968 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17969 | {} |
| 17970 | }; |
| 17971 | |
| 17972 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17978 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17979 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17980 | {} |
| 17981 | }; |
| 17982 | |
| 17983 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17984 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17985 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17986 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17987 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17988 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17989 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17990 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17991 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17992 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17993 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17994 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17995 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17996 | {} |
| 17997 | }; |
| 17998 | |
| 17999 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18000 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18001 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18002 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18003 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18004 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18005 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18006 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18007 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18009 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18010 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18011 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18012 | {} |
| 18013 | }; |
| 18014 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18015 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18016 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18017 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18018 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18019 | |
| 18020 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18021 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18022 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18023 | |
| 18024 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18025 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18026 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18027 | {} |
| 18028 | }; |
| 18029 | |
| 18030 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18031 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18032 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18033 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18034 | |
| 18035 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18036 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18037 | {} |
| 18038 | }; |
| 18039 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18040 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18041 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18042 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18043 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18044 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18045 | {} |
| 18046 | }; |
| 18047 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18048 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18049 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18050 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18051 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18052 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18053 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18054 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18055 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18058 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18059 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18060 | {} |
| 18061 | }; |
| 18062 | |
| 18063 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18064 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18065 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18067 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18068 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18069 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18070 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18071 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18072 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18073 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18074 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18075 | {} |
| 18076 | }; |
| 18077 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18078 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18079 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18080 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18081 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18082 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18083 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18084 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18085 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18086 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18087 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18088 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18089 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18091 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18092 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18093 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18094 | {} |
| 18095 | }; |
| 18096 | |
| 18097 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18098 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18099 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18100 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18101 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18102 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18103 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18104 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18105 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18106 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18107 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18108 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18111 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18112 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18113 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18114 | {} |
| 18115 | }; |
| 18116 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18117 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18118 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18119 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18120 | { } /* end */ |
| 18121 | }; |
| 18122 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18123 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18124 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18125 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18126 | { } /* end */ |
| 18127 | }; |
| 18128 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18129 | static void alc662_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18130 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18131 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18132 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18133 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18134 | spec->autocfg.line_out_pins[0] = 0x14; |
| 18135 | spec->autocfg.speaker_pins[0] = 0x15; |
| 18136 | spec->automute = 1; |
| 18137 | spec->detect_line = 1; |
| 18138 | spec->automute_lines = 1; |
| 18139 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18140 | } |
| 18141 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18142 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18143 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18144 | struct alc_spec *spec = codec->spec; |
| 18145 | |
| 18146 | alc262_hippo1_setup(codec); |
| 18147 | spec->ext_mic.pin = 0x18; |
| 18148 | spec->ext_mic.mux_idx = 0; |
| 18149 | spec->int_mic.pin = 0x19; |
| 18150 | spec->int_mic.mux_idx = 1; |
| 18151 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18152 | } |
| 18153 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18154 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18155 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18156 | struct alc_spec *spec = codec->spec; |
| 18157 | |
| 18158 | spec->autocfg.hp_pins[0] = 0x14; |
| 18159 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18160 | spec->automute = 1; |
| 18161 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18162 | } |
| 18163 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18164 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18165 | { |
| 18166 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18167 | spec->autocfg.hp_pins[0] = 0x21; |
| 18168 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18169 | spec->automute_mixer_nid[0] = 0x0c; |
| 18170 | spec->automute = 1; |
| 18171 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18172 | spec->ext_mic.pin = 0x18; |
| 18173 | spec->ext_mic.mux_idx = 0; |
| 18174 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18175 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18176 | spec->auto_mic = 1; |
| 18177 | } |
| 18178 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18179 | /* ***************** Mode1 ******************************/ |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18180 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18181 | { |
| 18182 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18183 | spec->autocfg.hp_pins[0] = 0x21; |
| 18184 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18185 | spec->automute_mixer_nid[0] = 0x0c; |
| 18186 | spec->automute = 1; |
| 18187 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18188 | spec->ext_mic.pin = 0x18; |
| 18189 | spec->ext_mic.mux_idx = 0; |
| 18190 | spec->int_mic.pin = 0x19; |
| 18191 | spec->int_mic.mux_idx = 1; |
| 18192 | spec->auto_mic = 1; |
| 18193 | } |
| 18194 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18195 | /* ***************** Mode2 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18196 | static void alc662_mode2_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18197 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18198 | struct alc_spec *spec = codec->spec; |
| 18199 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18200 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18201 | spec->automute = 1; |
| 18202 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18203 | spec->ext_mic.pin = 0x18; |
| 18204 | spec->ext_mic.mux_idx = 0; |
| 18205 | spec->int_mic.pin = 0x19; |
| 18206 | spec->int_mic.mux_idx = 1; |
| 18207 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18208 | } |
| 18209 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18210 | /* ***************** Mode3 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18211 | static void alc663_mode3_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18212 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18213 | struct alc_spec *spec = codec->spec; |
| 18214 | spec->autocfg.hp_pins[0] = 0x21; |
| 18215 | spec->autocfg.hp_pins[0] = 0x15; |
| 18216 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18217 | spec->automute = 1; |
| 18218 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18219 | spec->ext_mic.pin = 0x18; |
| 18220 | spec->ext_mic.mux_idx = 0; |
| 18221 | spec->int_mic.pin = 0x19; |
| 18222 | spec->int_mic.mux_idx = 1; |
| 18223 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18224 | } |
| 18225 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18226 | /* ***************** Mode4 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18227 | static void alc663_mode4_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18228 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18229 | struct alc_spec *spec = codec->spec; |
| 18230 | spec->autocfg.hp_pins[0] = 0x21; |
| 18231 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18232 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18233 | spec->automute_mixer_nid[0] = 0x0c; |
| 18234 | spec->automute_mixer_nid[1] = 0x0e; |
| 18235 | spec->automute = 1; |
| 18236 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18237 | spec->ext_mic.pin = 0x18; |
| 18238 | spec->ext_mic.mux_idx = 0; |
| 18239 | spec->int_mic.pin = 0x19; |
| 18240 | spec->int_mic.mux_idx = 1; |
| 18241 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18242 | } |
| 18243 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18244 | /* ***************** Mode5 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18245 | static void alc663_mode5_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18246 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18247 | struct alc_spec *spec = codec->spec; |
| 18248 | spec->autocfg.hp_pins[0] = 0x15; |
| 18249 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18250 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18251 | spec->automute_mixer_nid[0] = 0x0c; |
| 18252 | spec->automute_mixer_nid[1] = 0x0e; |
| 18253 | spec->automute = 1; |
| 18254 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18255 | spec->ext_mic.pin = 0x18; |
| 18256 | spec->ext_mic.mux_idx = 0; |
| 18257 | spec->int_mic.pin = 0x19; |
| 18258 | spec->int_mic.mux_idx = 1; |
| 18259 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18260 | } |
| 18261 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18262 | /* ***************** Mode6 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18263 | static void alc663_mode6_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18264 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18265 | struct alc_spec *spec = codec->spec; |
| 18266 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18267 | spec->autocfg.hp_pins[0] = 0x15; |
| 18268 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18269 | spec->automute_mixer_nid[0] = 0x0c; |
| 18270 | spec->automute = 1; |
| 18271 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18272 | spec->ext_mic.pin = 0x18; |
| 18273 | spec->ext_mic.mux_idx = 0; |
| 18274 | spec->int_mic.pin = 0x19; |
| 18275 | spec->int_mic.mux_idx = 1; |
| 18276 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18277 | } |
| 18278 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18279 | /* ***************** Mode7 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18280 | static void alc663_mode7_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18281 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18282 | struct alc_spec *spec = codec->spec; |
| 18283 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18284 | spec->autocfg.hp_pins[0] = 0x21; |
| 18285 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18286 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18287 | spec->automute = 1; |
| 18288 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18289 | spec->ext_mic.pin = 0x18; |
| 18290 | spec->ext_mic.mux_idx = 0; |
| 18291 | spec->int_mic.pin = 0x19; |
| 18292 | spec->int_mic.mux_idx = 1; |
| 18293 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18294 | } |
| 18295 | |
| 18296 | /* ***************** Mode8 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18297 | static void alc663_mode8_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18298 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18299 | struct alc_spec *spec = codec->spec; |
| 18300 | spec->autocfg.hp_pins[0] = 0x21; |
| 18301 | spec->autocfg.hp_pins[1] = 0x15; |
| 18302 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18303 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18304 | spec->automute = 1; |
| 18305 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18306 | spec->ext_mic.pin = 0x18; |
| 18307 | spec->ext_mic.mux_idx = 0; |
| 18308 | spec->int_mic.pin = 0x12; |
| 18309 | spec->int_mic.mux_idx = 9; |
| 18310 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18311 | } |
| 18312 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18313 | static void alc663_g71v_setup(struct hda_codec *codec) |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18314 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18315 | struct alc_spec *spec = codec->spec; |
| 18316 | spec->autocfg.hp_pins[0] = 0x21; |
| 18317 | spec->autocfg.line_out_pins[0] = 0x15; |
| 18318 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18319 | spec->automute = 1; |
| 18320 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
| 18321 | spec->detect_line = 1; |
| 18322 | spec->automute_lines = 1; |
| 18323 | spec->ext_mic.pin = 0x18; |
| 18324 | spec->ext_mic.mux_idx = 0; |
| 18325 | spec->int_mic.pin = 0x12; |
| 18326 | spec->int_mic.mux_idx = 9; |
| 18327 | spec->auto_mic = 1; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18328 | } |
| 18329 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18330 | #define alc663_g50v_setup alc663_m51va_setup |
| 18331 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18332 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18333 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18334 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18335 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18336 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18337 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18338 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18339 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18340 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18341 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18342 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18343 | { } /* end */ |
| 18344 | }; |
| 18345 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18346 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18347 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18348 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18349 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18350 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18352 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18355 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18356 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18357 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18358 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18359 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18360 | { } /* end */ |
| 18361 | }; |
| 18362 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18363 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18364 | #define alc662_loopbacks alc880_loopbacks |
| 18365 | #endif |
| 18366 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18367 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18368 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18369 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18370 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18371 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18372 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18373 | |
| 18374 | /* |
| 18375 | * configuration and preset |
| 18376 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18377 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18378 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18379 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18380 | [ALC662_3ST_6ch] = "3stack-6ch", |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 18381 | [ALC662_5ST_DIG] = "5stack-dig", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18382 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18383 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18384 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18385 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18386 | [ALC663_ASUS_M51VA] = "m51va", |
| 18387 | [ALC663_ASUS_G71V] = "g71v", |
| 18388 | [ALC663_ASUS_H13] = "h13", |
| 18389 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18390 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18391 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18392 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18393 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18394 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18395 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18396 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18397 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18398 | [ALC272_DELL] = "dell", |
| 18399 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18400 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18401 | [ALC662_AUTO] = "auto", |
| 18402 | }; |
| 18403 | |
| 18404 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18405 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18406 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18407 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18408 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18409 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18410 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18411 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18412 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18413 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18414 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18415 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18416 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18417 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18418 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18419 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18420 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18421 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18422 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18423 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18424 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18425 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18426 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18427 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18428 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18429 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18430 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18431 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18432 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18433 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18434 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18435 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18436 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18437 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18438 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18439 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18440 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18441 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18442 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18443 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18444 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18445 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18446 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18447 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18448 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18449 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18450 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18451 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18452 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18453 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18454 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18455 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18456 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18457 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18458 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18459 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18460 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18461 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18462 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18463 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18464 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18465 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18466 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18467 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18468 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18469 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18470 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18471 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18472 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18473 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18474 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18475 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18476 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18477 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18478 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18479 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18480 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18481 | {} |
| 18482 | }; |
| 18483 | |
| 18484 | static struct alc_config_preset alc662_presets[] = { |
| 18485 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18486 | .mixers = { alc662_3ST_2ch_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18487 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18488 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18489 | .dac_nids = alc662_dac_nids, |
| 18490 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18491 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18492 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18493 | .channel_mode = alc662_3ST_2ch_modes, |
| 18494 | .input_mux = &alc662_capture_source, |
| 18495 | }, |
| 18496 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18497 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18498 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18499 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18500 | .dac_nids = alc662_dac_nids, |
| 18501 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18502 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18503 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18504 | .channel_mode = alc662_3ST_6ch_modes, |
| 18505 | .need_dac_fix = 1, |
| 18506 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18507 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18508 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18509 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18510 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18511 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18512 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18513 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18514 | .channel_mode = alc662_3ST_6ch_modes, |
| 18515 | .need_dac_fix = 1, |
| 18516 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18517 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18518 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18519 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18520 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18521 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18522 | .dac_nids = alc662_dac_nids, |
| 18523 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18524 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18525 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18526 | .channel_mode = alc662_5stack_modes, |
| 18527 | .input_mux = &alc662_capture_source, |
| 18528 | }, |
| 18529 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18530 | .mixers = { alc662_lenovo_101e_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18531 | .init_verbs = { alc662_init_verbs, |
| 18532 | alc662_eapd_init_verbs, |
| 18533 | alc662_sue_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18534 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18535 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18536 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18537 | .channel_mode = alc662_3ST_2ch_modes, |
| 18538 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18539 | .unsol_event = alc_sku_unsol_event, |
| 18540 | .setup = alc662_lenovo_101e_setup, |
| 18541 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18542 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18543 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18544 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18545 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18546 | alc662_eapd_init_verbs, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18547 | alc662_eeepc_sue_init_verbs }, |
| 18548 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18549 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18550 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18551 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18552 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18553 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18554 | .init_hook = alc_inithook, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18555 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18556 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18557 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18558 | alc662_chmode_mixer }, |
| 18559 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18560 | alc662_eapd_init_verbs, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18561 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18562 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18563 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18564 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18565 | .channel_mode = alc662_3ST_6ch_modes, |
| 18566 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18567 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18568 | .setup = alc662_eeepc_ep20_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18569 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18570 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18571 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18572 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18573 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18574 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18575 | alc662_ecs_init_verbs }, |
| 18576 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18577 | .dac_nids = alc662_dac_nids, |
| 18578 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18579 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18580 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18581 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18582 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18583 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18584 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18585 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18586 | .init_verbs = { alc662_init_verbs, |
| 18587 | alc662_eapd_init_verbs, |
| 18588 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18589 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18590 | .dac_nids = alc662_dac_nids, |
| 18591 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18592 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18593 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18594 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18595 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18596 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18597 | }, |
| 18598 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18599 | .mixers = { alc663_g71v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18600 | .init_verbs = { alc662_init_verbs, |
| 18601 | alc662_eapd_init_verbs, |
| 18602 | alc663_g71v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18603 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18604 | .dac_nids = alc662_dac_nids, |
| 18605 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18606 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18607 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18608 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18609 | .setup = alc663_g71v_setup, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18610 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18611 | }, |
| 18612 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18613 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18614 | .init_verbs = { alc662_init_verbs, |
| 18615 | alc662_eapd_init_verbs, |
| 18616 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18617 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18618 | .dac_nids = alc662_dac_nids, |
| 18619 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18620 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18621 | .setup = alc663_m51va_setup, |
| 18622 | .unsol_event = alc_sku_unsol_event, |
| 18623 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18624 | }, |
| 18625 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18626 | .mixers = { alc663_g50v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18627 | .init_verbs = { alc662_init_verbs, |
| 18628 | alc662_eapd_init_verbs, |
| 18629 | alc663_g50v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18630 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18631 | .dac_nids = alc662_dac_nids, |
| 18632 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18633 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18634 | .channel_mode = alc662_3ST_6ch_modes, |
| 18635 | .input_mux = &alc663_capture_source, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18636 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18637 | .setup = alc663_g50v_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18638 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18639 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18640 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18641 | .mixers = { alc663_m51va_mixer }, |
| 18642 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18643 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18644 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18645 | alc663_21jd_amic_init_verbs }, |
| 18646 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18647 | .hp_nid = 0x03, |
| 18648 | .dac_nids = alc662_dac_nids, |
| 18649 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18650 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18651 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18652 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18653 | .setup = alc663_mode1_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18654 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18655 | }, |
| 18656 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18657 | .mixers = { alc662_1bjd_mixer }, |
| 18658 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18659 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18660 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18661 | alc662_1bjd_amic_init_verbs }, |
| 18662 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18663 | .dac_nids = alc662_dac_nids, |
| 18664 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18665 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18666 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18667 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18668 | .setup = alc662_mode2_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18669 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18670 | }, |
| 18671 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18672 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18673 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18674 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18675 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18676 | alc663_two_hp_amic_m1_init_verbs }, |
| 18677 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18678 | .hp_nid = 0x03, |
| 18679 | .dac_nids = alc662_dac_nids, |
| 18680 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18681 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18682 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18683 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18684 | .setup = alc663_mode3_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18685 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18686 | }, |
| 18687 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18688 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18689 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18690 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18691 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18692 | alc663_21jd_amic_init_verbs}, |
| 18693 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18694 | .hp_nid = 0x03, |
| 18695 | .dac_nids = alc662_dac_nids, |
| 18696 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18697 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18698 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18699 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18700 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18701 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18702 | }, |
| 18703 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18704 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18705 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18706 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18707 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18708 | alc663_15jd_amic_init_verbs }, |
| 18709 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18710 | .hp_nid = 0x03, |
| 18711 | .dac_nids = alc662_dac_nids, |
| 18712 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18713 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18714 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18715 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18716 | .setup = alc663_mode5_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18717 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18718 | }, |
| 18719 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18720 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18721 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18722 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18723 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18724 | alc663_two_hp_amic_m2_init_verbs }, |
| 18725 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18726 | .hp_nid = 0x03, |
| 18727 | .dac_nids = alc662_dac_nids, |
| 18728 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18729 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18730 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18731 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18732 | .setup = alc663_mode6_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18733 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18734 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18735 | [ALC663_ASUS_MODE7] = { |
| 18736 | .mixers = { alc663_mode7_mixer }, |
| 18737 | .cap_mixer = alc662_auto_capture_mixer, |
| 18738 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18739 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18740 | alc663_mode7_init_verbs }, |
| 18741 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18742 | .hp_nid = 0x03, |
| 18743 | .dac_nids = alc662_dac_nids, |
| 18744 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18745 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18746 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18747 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18748 | .setup = alc663_mode7_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18749 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18750 | }, |
| 18751 | [ALC663_ASUS_MODE8] = { |
| 18752 | .mixers = { alc663_mode8_mixer }, |
| 18753 | .cap_mixer = alc662_auto_capture_mixer, |
| 18754 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18755 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18756 | alc663_mode8_init_verbs }, |
| 18757 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18758 | .hp_nid = 0x03, |
| 18759 | .dac_nids = alc662_dac_nids, |
| 18760 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18761 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18762 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18763 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18764 | .setup = alc663_mode8_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18765 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18766 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18767 | [ALC272_DELL] = { |
| 18768 | .mixers = { alc663_m51va_mixer }, |
| 18769 | .cap_mixer = alc272_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18770 | .init_verbs = { alc662_init_verbs, |
| 18771 | alc662_eapd_init_verbs, |
| 18772 | alc272_dell_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18773 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18774 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18775 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18776 | .adc_nids = alc272_adc_nids, |
| 18777 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18778 | .capsrc_nids = alc272_capsrc_nids, |
| 18779 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18780 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18781 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18782 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18783 | }, |
| 18784 | [ALC272_DELL_ZM1] = { |
| 18785 | .mixers = { alc663_m51va_mixer }, |
| 18786 | .cap_mixer = alc662_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18787 | .init_verbs = { alc662_init_verbs, |
| 18788 | alc662_eapd_init_verbs, |
| 18789 | alc272_dell_zm1_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18790 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18791 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18792 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18793 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18794 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18795 | .capsrc_nids = alc662_capsrc_nids, |
| 18796 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18797 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18798 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18799 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18800 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18801 | [ALC272_SAMSUNG_NC10] = { |
| 18802 | .mixers = { alc272_nc10_mixer }, |
| 18803 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18804 | alc662_eapd_init_verbs, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18805 | alc663_21jd_amic_init_verbs }, |
| 18806 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18807 | .dac_nids = alc272_dac_nids, |
| 18808 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18809 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18810 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18811 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18812 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18813 | .init_hook = alc_inithook, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18814 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18815 | }; |
| 18816 | |
| 18817 | |
| 18818 | /* |
| 18819 | * BIOS auto configuration |
| 18820 | */ |
| 18821 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18822 | /* convert from MIX nid to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18823 | static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18824 | { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18825 | hda_nid_t list[5]; |
Takashi Iwai | 1304ac8 | 2011-04-06 15:16:21 +0200 | [diff] [blame] | 18826 | int i, num; |
| 18827 | |
| 18828 | num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list)); |
| 18829 | for (i = 0; i < num; i++) { |
| 18830 | if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT) |
| 18831 | return list[i]; |
| 18832 | } |
| 18833 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18834 | } |
| 18835 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18836 | /* go down to the selector widget before the mixer */ |
| 18837 | static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin) |
| 18838 | { |
| 18839 | hda_nid_t srcs[5]; |
| 18840 | int num = snd_hda_get_connections(codec, pin, srcs, |
| 18841 | ARRAY_SIZE(srcs)); |
| 18842 | if (num != 1 || |
| 18843 | get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL) |
| 18844 | return pin; |
| 18845 | return srcs[0]; |
| 18846 | } |
| 18847 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18848 | /* get MIX nid connected to the given pin targeted to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18849 | static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18850 | hda_nid_t dac) |
| 18851 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 18852 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18853 | int i, num; |
| 18854 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18855 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18856 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18857 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18858 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18859 | return mix[i]; |
| 18860 | } |
| 18861 | return 0; |
| 18862 | } |
| 18863 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18864 | /* select the connection from pin to DAC if needed */ |
| 18865 | static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin, |
| 18866 | hda_nid_t dac) |
| 18867 | { |
| 18868 | hda_nid_t mix[5]; |
| 18869 | int i, num; |
| 18870 | |
| 18871 | pin = alc_go_down_to_selector(codec, pin); |
| 18872 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18873 | if (num < 2) |
| 18874 | return 0; |
| 18875 | for (i = 0; i < num; i++) { |
| 18876 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) { |
| 18877 | snd_hda_codec_update_cache(codec, pin, 0, |
| 18878 | AC_VERB_SET_CONNECT_SEL, i); |
| 18879 | return 0; |
| 18880 | } |
| 18881 | } |
| 18882 | return 0; |
| 18883 | } |
| 18884 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18885 | /* look for an empty DAC slot */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18886 | static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18887 | { |
| 18888 | struct alc_spec *spec = codec->spec; |
| 18889 | hda_nid_t srcs[5]; |
| 18890 | int i, j, num; |
| 18891 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18892 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18893 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18894 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18895 | hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18896 | if (!nid) |
| 18897 | continue; |
| 18898 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18899 | if (spec->multiout.dac_nids[j] == nid) |
| 18900 | break; |
| 18901 | if (j >= spec->multiout.num_dacs) |
| 18902 | return nid; |
| 18903 | } |
| 18904 | return 0; |
| 18905 | } |
| 18906 | |
| 18907 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18908 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18909 | const struct auto_pin_cfg *cfg) |
| 18910 | { |
| 18911 | struct alc_spec *spec = codec->spec; |
| 18912 | int i; |
| 18913 | hda_nid_t dac; |
| 18914 | |
| 18915 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18916 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18917 | dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18918 | if (!dac) |
| 18919 | continue; |
| 18920 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18921 | } |
| 18922 | return 0; |
| 18923 | } |
| 18924 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18925 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 18926 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18927 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18928 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18929 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18930 | } |
| 18931 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18932 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 18933 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18934 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18935 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18936 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18937 | } |
| 18938 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18939 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 18940 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 18941 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 18942 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18943 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18944 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18945 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18946 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18947 | |
| 18948 | /* add playback controls from the parsed DAC table */ |
| 18949 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18950 | const struct auto_pin_cfg *cfg) |
| 18951 | { |
| 18952 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18953 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18954 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18955 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18956 | const char *pfx = alc_get_line_out_pfx(spec, true); |
| 18957 | hda_nid_t nid, mix, pin; |
| 18958 | int i, err, noutputs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18959 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18960 | noutputs = cfg->line_outs; |
| 18961 | if (spec->multi_ios > 0) |
| 18962 | noutputs += spec->multi_ios; |
| 18963 | |
| 18964 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18965 | nid = spec->multiout.dac_nids[i]; |
| 18966 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18967 | continue; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18968 | if (i >= cfg->line_outs) |
| 18969 | pin = spec->multi_io[i - 1].pin; |
| 18970 | else |
| 18971 | pin = cfg->line_out_pins[i]; |
| 18972 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18973 | if (!mix) |
| 18974 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18975 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18976 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18977 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18978 | if (err < 0) |
| 18979 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18980 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18981 | if (err < 0) |
| 18982 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18983 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18984 | if (err < 0) |
| 18985 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18986 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18987 | if (err < 0) |
| 18988 | return err; |
| 18989 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18990 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18991 | int index = i; |
| 18992 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18993 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18994 | index = 0; |
| 18995 | } |
| 18996 | err = __alc662_add_vol_ctl(spec, name, nid, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18997 | if (err < 0) |
| 18998 | return err; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18999 | err = __alc662_add_sw_ctl(spec, name, mix, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19000 | if (err < 0) |
| 19001 | return err; |
| 19002 | } |
| 19003 | } |
| 19004 | return 0; |
| 19005 | } |
| 19006 | |
| 19007 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19008 | /* return DAC nid if any new DAC is assigned */ |
| 19009 | 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] | 19010 | const char *pfx) |
| 19011 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19012 | struct alc_spec *spec = codec->spec; |
| 19013 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19014 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19015 | |
| 19016 | if (!pin) |
| 19017 | return 0; |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19018 | nid = alc_auto_look_for_dac(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19019 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19020 | /* the corresponding DAC is already occupied */ |
| 19021 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19022 | return 0; /* no way */ |
| 19023 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19024 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19025 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19026 | } |
| 19027 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19028 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19029 | if (!mix) |
| 19030 | return 0; |
| 19031 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19032 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19033 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19034 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19035 | if (err < 0) |
| 19036 | return err; |
| 19037 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19038 | } |
| 19039 | |
| 19040 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19041 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19042 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19043 | |
| 19044 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19045 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19046 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19047 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19048 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19049 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19050 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19051 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19052 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19053 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19054 | if (alc_auto_mix_to_dac(codec, srcs[i]) != dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19055 | continue; |
Takashi Iwai | 0e53f34 | 2011-04-07 12:27:32 +0200 | [diff] [blame] | 19056 | /* need the manual connection? */ |
| 19057 | if (num > 1) |
| 19058 | snd_hda_codec_write(codec, nid, 0, |
| 19059 | AC_VERB_SET_CONNECT_SEL, i); |
| 19060 | /* unmute mixer widget inputs */ |
| 19061 | snd_hda_codec_write(codec, srcs[i], 0, |
| 19062 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19063 | AMP_IN_UNMUTE(0)); |
| 19064 | snd_hda_codec_write(codec, srcs[i], 0, |
| 19065 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19066 | AMP_IN_UNMUTE(1)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19067 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19068 | } |
| 19069 | } |
| 19070 | |
| 19071 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19072 | { |
| 19073 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19074 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19075 | int i; |
| 19076 | |
| 19077 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19078 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19079 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19080 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19081 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19082 | } |
| 19083 | } |
| 19084 | |
| 19085 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19086 | { |
| 19087 | struct alc_spec *spec = codec->spec; |
| 19088 | hda_nid_t pin; |
| 19089 | |
| 19090 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19091 | if (pin) |
| 19092 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19093 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19094 | pin = spec->autocfg.speaker_pins[0]; |
| 19095 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19096 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19097 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19098 | } |
| 19099 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19100 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19101 | |
| 19102 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19103 | { |
| 19104 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19105 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19106 | int i; |
| 19107 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19108 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19109 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19110 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19111 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19112 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19113 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19114 | snd_hda_codec_write(codec, nid, 0, |
| 19115 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19116 | AMP_OUT_MUTE); |
| 19117 | } |
| 19118 | } |
| 19119 | } |
| 19120 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19121 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19122 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19123 | /* |
| 19124 | * multi-io helper |
| 19125 | */ |
| 19126 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
| 19127 | unsigned int location) |
| 19128 | { |
| 19129 | struct alc_spec *spec = codec->spec; |
| 19130 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19131 | int type, i, num_pins = 0; |
| 19132 | |
| 19133 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
| 19134 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19135 | hda_nid_t nid = cfg->inputs[i].pin; |
| 19136 | hda_nid_t dac; |
| 19137 | unsigned int defcfg, caps; |
| 19138 | if (cfg->inputs[i].type != type) |
| 19139 | continue; |
| 19140 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 19141 | if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX) |
| 19142 | continue; |
| 19143 | if (location && get_defcfg_location(defcfg) != location) |
| 19144 | continue; |
| 19145 | caps = snd_hda_query_pin_caps(codec, nid); |
| 19146 | if (!(caps & AC_PINCAP_OUT)) |
| 19147 | continue; |
| 19148 | dac = alc_auto_look_for_dac(codec, nid); |
| 19149 | if (!dac) |
| 19150 | continue; |
| 19151 | spec->multi_io[num_pins].pin = nid; |
| 19152 | spec->multi_io[num_pins].dac = dac; |
| 19153 | num_pins++; |
| 19154 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19155 | } |
| 19156 | } |
| 19157 | spec->multiout.num_dacs = 1; |
| 19158 | if (num_pins < 2) |
| 19159 | return 0; |
| 19160 | return num_pins; |
| 19161 | } |
| 19162 | |
| 19163 | static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 19164 | struct snd_ctl_elem_info *uinfo) |
| 19165 | { |
| 19166 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19167 | struct alc_spec *spec = codec->spec; |
| 19168 | |
| 19169 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 19170 | uinfo->count = 1; |
| 19171 | uinfo->value.enumerated.items = spec->multi_ios + 1; |
| 19172 | if (uinfo->value.enumerated.item > spec->multi_ios) |
| 19173 | uinfo->value.enumerated.item = spec->multi_ios; |
| 19174 | sprintf(uinfo->value.enumerated.name, "%dch", |
| 19175 | (uinfo->value.enumerated.item + 1) * 2); |
| 19176 | return 0; |
| 19177 | } |
| 19178 | |
| 19179 | static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 19180 | struct snd_ctl_elem_value *ucontrol) |
| 19181 | { |
| 19182 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19183 | struct alc_spec *spec = codec->spec; |
| 19184 | ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2; |
| 19185 | return 0; |
| 19186 | } |
| 19187 | |
| 19188 | static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output) |
| 19189 | { |
| 19190 | struct alc_spec *spec = codec->spec; |
| 19191 | hda_nid_t nid = spec->multi_io[idx].pin; |
| 19192 | |
| 19193 | if (!spec->multi_io[idx].ctl_in) |
| 19194 | spec->multi_io[idx].ctl_in = |
| 19195 | snd_hda_codec_read(codec, nid, 0, |
| 19196 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 19197 | if (output) { |
| 19198 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19199 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19200 | PIN_OUT); |
| 19201 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19202 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19203 | HDA_AMP_MUTE, 0); |
| 19204 | alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac); |
| 19205 | } else { |
| 19206 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19207 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19208 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 19209 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19210 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19211 | spec->multi_io[idx].ctl_in); |
| 19212 | } |
| 19213 | return 0; |
| 19214 | } |
| 19215 | |
| 19216 | static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 19217 | struct snd_ctl_elem_value *ucontrol) |
| 19218 | { |
| 19219 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19220 | struct alc_spec *spec = codec->spec; |
| 19221 | int i, ch; |
| 19222 | |
| 19223 | ch = ucontrol->value.enumerated.item[0]; |
| 19224 | if (ch < 0 || ch > spec->multi_ios) |
| 19225 | return -EINVAL; |
| 19226 | if (ch == (spec->ext_channel_count - 1) / 2) |
| 19227 | return 0; |
| 19228 | spec->ext_channel_count = (ch + 1) * 2; |
| 19229 | for (i = 0; i < spec->multi_ios; i++) |
| 19230 | alc_set_multi_io(codec, i, i < ch); |
| 19231 | spec->multiout.max_channels = spec->ext_channel_count; |
| 19232 | return 1; |
| 19233 | } |
| 19234 | |
| 19235 | static struct snd_kcontrol_new alc_auto_channel_mode_enum = { |
| 19236 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 19237 | .name = "Channel Mode", |
| 19238 | .info = alc_auto_ch_mode_info, |
| 19239 | .get = alc_auto_ch_mode_get, |
| 19240 | .put = alc_auto_ch_mode_put, |
| 19241 | }; |
| 19242 | |
| 19243 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec) |
| 19244 | { |
| 19245 | struct alc_spec *spec = codec->spec; |
| 19246 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19247 | unsigned int location, defcfg; |
| 19248 | int num_pins; |
| 19249 | |
| 19250 | if (cfg->line_outs != 1 || |
| 19251 | cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 19252 | return 0; |
| 19253 | |
| 19254 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
| 19255 | location = get_defcfg_location(defcfg); |
| 19256 | |
| 19257 | num_pins = alc_auto_fill_multi_ios(codec, location); |
| 19258 | if (num_pins > 0) { |
| 19259 | struct snd_kcontrol_new *knew; |
| 19260 | |
| 19261 | knew = alc_kcontrol_new(spec); |
| 19262 | if (!knew) |
| 19263 | return -ENOMEM; |
| 19264 | *knew = alc_auto_channel_mode_enum; |
| 19265 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); |
| 19266 | if (!knew->name) |
| 19267 | return -ENOMEM; |
| 19268 | |
| 19269 | spec->multi_ios = num_pins; |
| 19270 | spec->ext_channel_count = 2; |
| 19271 | spec->multiout.num_dacs = num_pins + 1; |
| 19272 | } |
| 19273 | return 0; |
| 19274 | } |
| 19275 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19276 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19277 | { |
| 19278 | struct alc_spec *spec = codec->spec; |
| 19279 | int err; |
| 19280 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19281 | |
| 19282 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19283 | alc662_ignore); |
| 19284 | if (err < 0) |
| 19285 | return err; |
| 19286 | if (!spec->autocfg.line_outs) |
| 19287 | return 0; /* can't find valid BIOS pin config */ |
| 19288 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19289 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19290 | if (err < 0) |
| 19291 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19292 | err = alc_auto_add_multi_channel_mode(codec); |
| 19293 | if (err < 0) |
| 19294 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19295 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19296 | if (err < 0) |
| 19297 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19298 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19299 | spec->autocfg.speaker_pins[0], |
| 19300 | "Speaker"); |
| 19301 | if (err < 0) |
| 19302 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19303 | if (err) |
| 19304 | spec->multiout.extra_out_nid[0] = err; |
| 19305 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19306 | "Headphone"); |
| 19307 | if (err < 0) |
| 19308 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19309 | if (err) |
| 19310 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19311 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19312 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19313 | return err; |
| 19314 | |
| 19315 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19316 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19317 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19318 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19319 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19320 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19321 | |
| 19322 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19323 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19324 | |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19325 | err = alc_auto_add_mic_boost(codec); |
| 19326 | if (err < 0) |
| 19327 | return err; |
| 19328 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19329 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19330 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19331 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19332 | else |
| 19333 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19334 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19335 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19336 | } |
| 19337 | |
| 19338 | /* additional initialization for auto-configuration model */ |
| 19339 | static void alc662_auto_init(struct hda_codec *codec) |
| 19340 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19341 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19342 | alc662_auto_init_multi_out(codec); |
| 19343 | alc662_auto_init_hp_out(codec); |
| 19344 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19345 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19346 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19347 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19348 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19349 | } |
| 19350 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19351 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19352 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19353 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19354 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19355 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19356 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19357 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19358 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19359 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19360 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19361 | printk(KERN_WARNING |
| 19362 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19363 | } |
| 19364 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19365 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19366 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19367 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19368 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19369 | ALC662_FIXUP_CZC_P10T, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19370 | ALC662_FIXUP_GIGABYTE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19371 | }; |
| 19372 | |
| 19373 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19374 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19375 | .type = ALC_FIXUP_PINS, |
| 19376 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19377 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19378 | { } |
| 19379 | } |
| 19380 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19381 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19382 | .type = ALC_FIXUP_PINS, |
| 19383 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19384 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19385 | { } |
| 19386 | } |
| 19387 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19388 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19389 | .type = ALC_FIXUP_FUNC, |
| 19390 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19391 | }, |
| 19392 | [ALC662_FIXUP_CZC_P10T] = { |
| 19393 | .type = ALC_FIXUP_VERBS, |
| 19394 | .v.verbs = (const struct hda_verb[]) { |
| 19395 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19396 | {} |
| 19397 | } |
| 19398 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19399 | [ALC662_FIXUP_GIGABYTE] = { |
| 19400 | .type = ALC_FIXUP_PINS, |
| 19401 | .v.pins = (const struct alc_pincfg[]) { |
| 19402 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 19403 | { } |
| 19404 | } |
| 19405 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19406 | }; |
| 19407 | |
| 19408 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19409 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19410 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19411 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19412 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19413 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19414 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19415 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19416 | {} |
| 19417 | }; |
| 19418 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19419 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19420 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19421 | {} |
| 19422 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19423 | |
| 19424 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19425 | static int patch_alc662(struct hda_codec *codec) |
| 19426 | { |
| 19427 | struct alc_spec *spec; |
| 19428 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19429 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19430 | |
| 19431 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19432 | if (!spec) |
| 19433 | return -ENOMEM; |
| 19434 | |
| 19435 | codec->spec = spec; |
| 19436 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19437 | alc_auto_parse_customize_define(codec); |
| 19438 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19439 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19440 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19441 | coef = alc_read_coef_idx(codec, 0); |
| 19442 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19443 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19444 | else if (coef & (1 << 14) && |
| 19445 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19446 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19447 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19448 | else if (coef == 0x4011) |
| 19449 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19450 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19451 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19452 | alc662_models, |
| 19453 | alc662_cfg_tbl); |
| 19454 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19455 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19456 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19457 | board_config = ALC662_AUTO; |
| 19458 | } |
| 19459 | |
| 19460 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19461 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19462 | alc662_fixup_tbl, alc662_fixups); |
| 19463 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19464 | /* automatic parse from the BIOS config */ |
| 19465 | err = alc662_parse_auto_config(codec); |
| 19466 | if (err < 0) { |
| 19467 | alc_free(codec); |
| 19468 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19469 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19470 | printk(KERN_INFO |
| 19471 | "hda_codec: Cannot set up configuration " |
| 19472 | "from BIOS. Using base mode...\n"); |
| 19473 | board_config = ALC662_3ST_2ch_DIG; |
| 19474 | } |
| 19475 | } |
| 19476 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19477 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19478 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19479 | if (err < 0) { |
| 19480 | alc_free(codec); |
| 19481 | return err; |
| 19482 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19483 | } |
| 19484 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19485 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19486 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19487 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19488 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19489 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19490 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19491 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19492 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19493 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19494 | if (!spec->adc_nids) { |
| 19495 | spec->adc_nids = alc662_adc_nids; |
| 19496 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19497 | } |
| 19498 | if (!spec->capsrc_nids) |
| 19499 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19500 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19501 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19502 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19503 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19504 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19505 | switch (codec->vendor_id) { |
| 19506 | case 0x10ec0662: |
| 19507 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19508 | break; |
| 19509 | case 0x10ec0272: |
| 19510 | case 0x10ec0663: |
| 19511 | case 0x10ec0665: |
| 19512 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19513 | break; |
| 19514 | case 0x10ec0273: |
| 19515 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19516 | break; |
| 19517 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19518 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19519 | spec->vmaster_nid = 0x02; |
| 19520 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19521 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19522 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19523 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19524 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19525 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | 1c71615 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 19526 | spec->shutup = alc_eapd_shutup; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19527 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19528 | alc_init_jacks(codec); |
| 19529 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19530 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19531 | if (!spec->loopback.amplist) |
| 19532 | spec->loopback.amplist = alc662_loopbacks; |
| 19533 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19534 | |
| 19535 | return 0; |
| 19536 | } |
| 19537 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19538 | static int patch_alc888(struct hda_codec *codec) |
| 19539 | { |
| 19540 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19541 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19542 | if (codec->vendor_id == 0x10ec0887) |
| 19543 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19544 | else |
| 19545 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19546 | if (!codec->chip_name) { |
| 19547 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19548 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19549 | } |
| 19550 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19551 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19552 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19553 | } |
| 19554 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19555 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19556 | * ALC680 support |
| 19557 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19558 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19559 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19560 | #define alc680_modes alc260_modes |
| 19561 | |
| 19562 | static hda_nid_t alc680_dac_nids[3] = { |
| 19563 | /* Lout1, Lout2, hp */ |
| 19564 | 0x02, 0x03, 0x04 |
| 19565 | }; |
| 19566 | |
| 19567 | static hda_nid_t alc680_adc_nids[3] = { |
| 19568 | /* ADC0-2 */ |
| 19569 | /* DMIC, MIC, Line-in*/ |
| 19570 | 0x07, 0x08, 0x09 |
| 19571 | }; |
| 19572 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19573 | /* |
| 19574 | * Analog capture ADC cgange |
| 19575 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19576 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19577 | { |
| 19578 | struct alc_spec *spec = codec->spec; |
| 19579 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19580 | int pin_found = 0; |
| 19581 | int type_found = AUTO_PIN_LAST; |
| 19582 | hda_nid_t nid; |
| 19583 | int i; |
| 19584 | |
| 19585 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19586 | nid = cfg->inputs[i].pin; |
| 19587 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19588 | AC_PINCAP_PRES_DETECT)) |
| 19589 | continue; |
| 19590 | if (snd_hda_jack_detect(codec, nid)) { |
| 19591 | if (cfg->inputs[i].type < type_found) { |
| 19592 | type_found = cfg->inputs[i].type; |
| 19593 | pin_found = nid; |
| 19594 | } |
| 19595 | } |
| 19596 | } |
| 19597 | |
| 19598 | nid = 0x07; |
| 19599 | if (pin_found) |
| 19600 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19601 | |
| 19602 | if (nid != spec->cur_adc) |
| 19603 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19604 | spec->cur_adc = nid; |
| 19605 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19606 | spec->cur_adc_format); |
| 19607 | } |
| 19608 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19609 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19610 | struct hda_codec *codec, |
| 19611 | unsigned int stream_tag, |
| 19612 | unsigned int format, |
| 19613 | struct snd_pcm_substream *substream) |
| 19614 | { |
| 19615 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19616 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19617 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19618 | spec->cur_adc_stream_tag = stream_tag; |
| 19619 | spec->cur_adc_format = format; |
| 19620 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19621 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19622 | return 0; |
| 19623 | } |
| 19624 | |
| 19625 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19626 | struct hda_codec *codec, |
| 19627 | struct snd_pcm_substream *substream) |
| 19628 | { |
| 19629 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19630 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19631 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19632 | return 0; |
| 19633 | } |
| 19634 | |
| 19635 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19636 | .substreams = 1, /* can be overridden */ |
| 19637 | .channels_min = 2, |
| 19638 | .channels_max = 2, |
| 19639 | /* NID is set in alc_build_pcms */ |
| 19640 | .ops = { |
| 19641 | .prepare = alc680_capture_pcm_prepare, |
| 19642 | .cleanup = alc680_capture_pcm_cleanup |
| 19643 | }, |
| 19644 | }; |
| 19645 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19646 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19647 | /* output mixer control */ |
| 19648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19649 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19650 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19651 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19652 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19653 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19654 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19655 | { } |
| 19656 | }; |
| 19657 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19658 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19659 | .ops = &snd_hda_bind_vol, |
| 19660 | .values = { |
| 19661 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19662 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19663 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19664 | 0 |
| 19665 | }, |
| 19666 | }; |
| 19667 | |
| 19668 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19669 | .ops = &snd_hda_bind_sw, |
| 19670 | .values = { |
| 19671 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19672 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19673 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19674 | 0 |
| 19675 | }, |
| 19676 | }; |
| 19677 | |
| 19678 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19679 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19680 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19681 | { } /* end */ |
| 19682 | }; |
| 19683 | |
| 19684 | /* |
| 19685 | * generic initialization of ADC, input mixers and output mixers |
| 19686 | */ |
| 19687 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19688 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19689 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19690 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19691 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19692 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19693 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19695 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19696 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19697 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19698 | |
| 19699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19700 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19701 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19702 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19703 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19704 | |
| 19705 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19706 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19707 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19708 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19709 | { } |
| 19710 | }; |
| 19711 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19712 | /* toggle speaker-output according to the hp-jack state */ |
| 19713 | static void alc680_base_setup(struct hda_codec *codec) |
| 19714 | { |
| 19715 | struct alc_spec *spec = codec->spec; |
| 19716 | |
| 19717 | spec->autocfg.hp_pins[0] = 0x16; |
| 19718 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19719 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19720 | spec->autocfg.num_inputs = 2; |
| 19721 | spec->autocfg.inputs[0].pin = 0x18; |
| 19722 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19723 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19724 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19725 | spec->automute = 1; |
| 19726 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19727 | } |
| 19728 | |
| 19729 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19730 | unsigned int res) |
| 19731 | { |
| 19732 | if ((res >> 26) == ALC880_HP_EVENT) |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19733 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19734 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19735 | alc680_rec_autoswitch(codec); |
| 19736 | } |
| 19737 | |
| 19738 | static void alc680_inithook(struct hda_codec *codec) |
| 19739 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19740 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19741 | alc680_rec_autoswitch(codec); |
| 19742 | } |
| 19743 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19744 | /* create input playback/capture controls for the given pin */ |
| 19745 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19746 | const char *ctlname, int idx) |
| 19747 | { |
| 19748 | hda_nid_t dac; |
| 19749 | int err; |
| 19750 | |
| 19751 | switch (nid) { |
| 19752 | case 0x14: |
| 19753 | dac = 0x02; |
| 19754 | break; |
| 19755 | case 0x15: |
| 19756 | dac = 0x03; |
| 19757 | break; |
| 19758 | case 0x16: |
| 19759 | dac = 0x04; |
| 19760 | break; |
| 19761 | default: |
| 19762 | return 0; |
| 19763 | } |
| 19764 | if (spec->multiout.dac_nids[0] != dac && |
| 19765 | spec->multiout.dac_nids[1] != dac) { |
| 19766 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19767 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19768 | HDA_OUTPUT)); |
| 19769 | if (err < 0) |
| 19770 | return err; |
| 19771 | |
| 19772 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19773 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19774 | |
| 19775 | if (err < 0) |
| 19776 | return err; |
| 19777 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19778 | } |
| 19779 | |
| 19780 | return 0; |
| 19781 | } |
| 19782 | |
| 19783 | /* add playback controls from the parsed DAC table */ |
| 19784 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19785 | const struct auto_pin_cfg *cfg) |
| 19786 | { |
| 19787 | hda_nid_t nid; |
| 19788 | int err; |
| 19789 | |
| 19790 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19791 | |
| 19792 | nid = cfg->line_out_pins[0]; |
| 19793 | if (nid) { |
| 19794 | const char *name; |
| 19795 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19796 | name = "Speaker"; |
| 19797 | else |
| 19798 | name = "Front"; |
| 19799 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19800 | if (err < 0) |
| 19801 | return err; |
| 19802 | } |
| 19803 | |
| 19804 | nid = cfg->speaker_pins[0]; |
| 19805 | if (nid) { |
| 19806 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19807 | if (err < 0) |
| 19808 | return err; |
| 19809 | } |
| 19810 | nid = cfg->hp_pins[0]; |
| 19811 | if (nid) { |
| 19812 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19813 | if (err < 0) |
| 19814 | return err; |
| 19815 | } |
| 19816 | |
| 19817 | return 0; |
| 19818 | } |
| 19819 | |
| 19820 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19821 | hda_nid_t nid, int pin_type) |
| 19822 | { |
| 19823 | alc_set_pin_output(codec, nid, pin_type); |
| 19824 | } |
| 19825 | |
| 19826 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19827 | { |
| 19828 | struct alc_spec *spec = codec->spec; |
| 19829 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19830 | if (nid) { |
| 19831 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19832 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19833 | } |
| 19834 | } |
| 19835 | |
| 19836 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19837 | { |
| 19838 | struct alc_spec *spec = codec->spec; |
| 19839 | hda_nid_t pin; |
| 19840 | |
| 19841 | pin = spec->autocfg.hp_pins[0]; |
| 19842 | if (pin) |
| 19843 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19844 | pin = spec->autocfg.speaker_pins[0]; |
| 19845 | if (pin) |
| 19846 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19847 | } |
| 19848 | |
| 19849 | /* pcm configuration: identical with ALC880 */ |
| 19850 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19851 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19852 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19853 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19854 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19855 | |
| 19856 | /* |
| 19857 | * BIOS auto configuration |
| 19858 | */ |
| 19859 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19860 | { |
| 19861 | struct alc_spec *spec = codec->spec; |
| 19862 | int err; |
| 19863 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19864 | |
| 19865 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19866 | alc680_ignore); |
| 19867 | if (err < 0) |
| 19868 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19869 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19870 | if (!spec->autocfg.line_outs) { |
| 19871 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19872 | spec->multiout.max_channels = 2; |
| 19873 | spec->no_analog = 1; |
| 19874 | goto dig_only; |
| 19875 | } |
| 19876 | return 0; /* can't find valid BIOS pin config */ |
| 19877 | } |
| 19878 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19879 | if (err < 0) |
| 19880 | return err; |
| 19881 | |
| 19882 | spec->multiout.max_channels = 2; |
| 19883 | |
| 19884 | dig_only: |
| 19885 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19886 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19887 | if (spec->kctls.list) |
| 19888 | add_mixer(spec, spec->kctls.list); |
| 19889 | |
| 19890 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19891 | |
| 19892 | err = alc_auto_add_mic_boost(codec); |
| 19893 | if (err < 0) |
| 19894 | return err; |
| 19895 | |
| 19896 | return 1; |
| 19897 | } |
| 19898 | |
| 19899 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19900 | |
| 19901 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19902 | static void alc680_auto_init(struct hda_codec *codec) |
| 19903 | { |
| 19904 | struct alc_spec *spec = codec->spec; |
| 19905 | alc680_auto_init_multi_out(codec); |
| 19906 | alc680_auto_init_hp_out(codec); |
| 19907 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19908 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19909 | if (spec->unsol_event) |
| 19910 | alc_inithook(codec); |
| 19911 | } |
| 19912 | |
| 19913 | /* |
| 19914 | * configuration and preset |
| 19915 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19916 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19917 | [ALC680_BASE] = "base", |
| 19918 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19919 | }; |
| 19920 | |
| 19921 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19922 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19923 | {} |
| 19924 | }; |
| 19925 | |
| 19926 | static struct alc_config_preset alc680_presets[] = { |
| 19927 | [ALC680_BASE] = { |
| 19928 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19929 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19930 | .init_verbs = { alc680_init_verbs }, |
| 19931 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19932 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19933 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19934 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19935 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19936 | .unsol_event = alc680_unsol_event, |
| 19937 | .setup = alc680_base_setup, |
| 19938 | .init_hook = alc680_inithook, |
| 19939 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19940 | }, |
| 19941 | }; |
| 19942 | |
| 19943 | static int patch_alc680(struct hda_codec *codec) |
| 19944 | { |
| 19945 | struct alc_spec *spec; |
| 19946 | int board_config; |
| 19947 | int err; |
| 19948 | |
| 19949 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19950 | if (spec == NULL) |
| 19951 | return -ENOMEM; |
| 19952 | |
| 19953 | codec->spec = spec; |
| 19954 | |
| 19955 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19956 | alc680_models, |
| 19957 | alc680_cfg_tbl); |
| 19958 | |
| 19959 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19960 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19961 | codec->chip_name); |
| 19962 | board_config = ALC680_AUTO; |
| 19963 | } |
| 19964 | |
| 19965 | if (board_config == ALC680_AUTO) { |
| 19966 | /* automatic parse from the BIOS config */ |
| 19967 | err = alc680_parse_auto_config(codec); |
| 19968 | if (err < 0) { |
| 19969 | alc_free(codec); |
| 19970 | return err; |
| 19971 | } else if (!err) { |
| 19972 | printk(KERN_INFO |
| 19973 | "hda_codec: Cannot set up configuration " |
| 19974 | "from BIOS. Using base mode...\n"); |
| 19975 | board_config = ALC680_BASE; |
| 19976 | } |
| 19977 | } |
| 19978 | |
| 19979 | if (board_config != ALC680_AUTO) |
| 19980 | setup_preset(codec, &alc680_presets[board_config]); |
| 19981 | |
| 19982 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19983 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19984 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19985 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19986 | |
| 19987 | if (!spec->adc_nids) { |
| 19988 | spec->adc_nids = alc680_adc_nids; |
| 19989 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19990 | } |
| 19991 | |
| 19992 | if (!spec->cap_mixer) |
| 19993 | set_capture_mixer(codec); |
| 19994 | |
| 19995 | spec->vmaster_nid = 0x02; |
| 19996 | |
| 19997 | codec->patch_ops = alc_patch_ops; |
| 19998 | if (board_config == ALC680_AUTO) |
| 19999 | spec->init_hook = alc680_auto_init; |
| 20000 | |
| 20001 | return 0; |
| 20002 | } |
| 20003 | |
| 20004 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20005 | * patch entries |
| 20006 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20007 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20008 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20009 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20010 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20011 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20012 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20013 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20014 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20015 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20016 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20017 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20018 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20019 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20020 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20021 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20022 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20023 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20024 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20025 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20026 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20027 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20028 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20029 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20030 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20031 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20032 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20033 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20034 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20035 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20036 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20037 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20038 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20039 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20040 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20041 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20042 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20043 | {} /* terminator */ |
| 20044 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20045 | |
| 20046 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20047 | |
| 20048 | MODULE_LICENSE("GPL"); |
| 20049 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20050 | |
| 20051 | static struct hda_codec_preset_list realtek_list = { |
| 20052 | .preset = snd_hda_preset_realtek, |
| 20053 | .owner = THIS_MODULE, |
| 20054 | }; |
| 20055 | |
| 20056 | static int __init patch_realtek_init(void) |
| 20057 | { |
| 20058 | return snd_hda_add_codec_preset(&realtek_list); |
| 20059 | } |
| 20060 | |
| 20061 | static void __exit patch_realtek_exit(void) |
| 20062 | { |
| 20063 | snd_hda_delete_codec_preset(&realtek_list); |
| 20064 | } |
| 20065 | |
| 20066 | module_init(patch_realtek_init) |
| 20067 | module_exit(patch_realtek_exit) |