Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 297 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 298 | }; |
| 299 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 300 | struct alc_fixup; |
| 301 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 302 | struct alc_multi_io { |
| 303 | hda_nid_t pin; /* multi-io widget pin NID */ |
| 304 | hda_nid_t dac; /* DAC to be connected */ |
| 305 | unsigned int ctl_in; /* cached input-pin control value */ |
| 306 | }; |
| 307 | |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 308 | enum { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 309 | ALC_AUTOMUTE_PIN, /* change the pin control */ |
| 310 | ALC_AUTOMUTE_AMP, /* mute/unmute the pin AMP */ |
| 311 | ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 312 | }; |
| 313 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | struct alc_spec { |
| 315 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 316 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 318 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 319 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 321 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 322 | * don't forget NULL |
| 323 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 324 | */ |
| 325 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 327 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | struct hda_pcm_stream *stream_analog_playback; |
| 329 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 330 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 331 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 333 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | struct hda_pcm_stream *stream_digital_playback; |
| 335 | struct hda_pcm_stream *stream_digital_capture; |
| 336 | |
| 337 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 338 | struct hda_multi_out multiout; /* playback set-up |
| 339 | * max_channels, dacs must be set |
| 340 | * dig_out_nid and hp_nid are optional |
| 341 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 342 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 343 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 344 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | |
| 346 | /* capture */ |
| 347 | unsigned int num_adc_nids; |
| 348 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 349 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 350 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 352 | /* capture setup for dynamic dual-adc switch */ |
| 353 | unsigned int cur_adc_idx; |
| 354 | hda_nid_t cur_adc; |
| 355 | unsigned int cur_adc_stream_tag; |
| 356 | unsigned int cur_adc_format; |
| 357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 359 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | const struct hda_input_mux *input_mux; |
| 361 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 362 | struct alc_mic_route ext_mic; |
| 363 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | |
| 365 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 366 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 368 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 369 | int const_channel_count; |
| 370 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | |
| 372 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 373 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 374 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 375 | /* dynamic controls, init_verbs and input_mux */ |
| 376 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 377 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 378 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 379 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 380 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 381 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 382 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 383 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 384 | /* hooks */ |
| 385 | void (*init_hook)(struct hda_codec *codec); |
| 386 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 387 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 388 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 389 | #endif |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 390 | void (*shutup)(struct hda_codec *codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 391 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 392 | /* for pin sensing */ |
| 393 | unsigned int sense_updated: 1; |
| 394 | unsigned int jack_present: 1; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 395 | unsigned int line_jack_present:1; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 396 | unsigned int master_mute:1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 397 | unsigned int auto_mic:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 398 | unsigned int automute:1; /* HP automute enabled */ |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 399 | unsigned int detect_line:1; /* Line-out detection enabled */ |
| 400 | unsigned int automute_lines:1; /* automute line-out as well */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 401 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 402 | /* other flags */ |
| 403 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 404 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 405 | unsigned int single_input_src:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 406 | |
| 407 | /* auto-mute control */ |
| 408 | int automute_mode; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 409 | hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 410 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 411 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 412 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 413 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 414 | /* for virtual master */ |
| 415 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 416 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 417 | struct hda_loopback_check loopback; |
| 418 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 419 | |
| 420 | /* for PLL fix */ |
| 421 | hda_nid_t pll_nid; |
| 422 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 423 | |
| 424 | /* fix-up list */ |
| 425 | int fixup_id; |
| 426 | const struct alc_fixup *fixup_list; |
| 427 | const char *fixup_name; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 428 | |
| 429 | /* multi-io */ |
| 430 | int multi_ios; |
| 431 | struct alc_multi_io multi_io[4]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 432 | }; |
| 433 | |
| 434 | /* |
| 435 | * configuration template - to be copied to the spec instance |
| 436 | */ |
| 437 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 438 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 439 | * with spec |
| 440 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 441 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 442 | const struct hda_verb *init_verbs[5]; |
| 443 | unsigned int num_dacs; |
| 444 | hda_nid_t *dac_nids; |
| 445 | hda_nid_t dig_out_nid; /* optional */ |
| 446 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 447 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 448 | unsigned int num_adc_nids; |
| 449 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 450 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 451 | hda_nid_t dig_in_nid; |
| 452 | unsigned int num_channel_mode; |
| 453 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 454 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 455 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 456 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 457 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 458 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 459 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 460 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 461 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 462 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 463 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 464 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | }; |
| 466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | |
| 468 | /* |
| 469 | * input MUX handling |
| 470 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 471 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 472 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | { |
| 474 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 475 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 476 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 477 | if (mux_idx >= spec->num_mux_defs) |
| 478 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 479 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 480 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 481 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | } |
| 483 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 484 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 485 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | { |
| 487 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 488 | struct alc_spec *spec = codec->spec; |
| 489 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 490 | |
| 491 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 492 | return 0; |
| 493 | } |
| 494 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 495 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 496 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | { |
| 498 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 499 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 500 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 502 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 503 | hda_nid_t nid = spec->capsrc_nids ? |
| 504 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 505 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 507 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 508 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 509 | if (!imux->num_items && mux_idx > 0) |
| 510 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 511 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 512 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 513 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 514 | /* Matrix-mixer style (e.g. ALC882) */ |
| 515 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 516 | unsigned int i, idx; |
| 517 | |
| 518 | idx = ucontrol->value.enumerated.item[0]; |
| 519 | if (idx >= imux->num_items) |
| 520 | idx = imux->num_items - 1; |
| 521 | if (*cur_val == idx) |
| 522 | return 0; |
| 523 | for (i = 0; i < imux->num_items; i++) { |
| 524 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 525 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 526 | imux->items[i].index, |
| 527 | HDA_AMP_MUTE, v); |
| 528 | } |
| 529 | *cur_val = idx; |
| 530 | return 1; |
| 531 | } else { |
| 532 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 533 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 534 | &spec->cur_mux[adc_idx]); |
| 535 | } |
| 536 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 537 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | /* |
| 539 | * channel mode setting |
| 540 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 541 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 542 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | { |
| 544 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 545 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 546 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 547 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | } |
| 549 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 551 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | { |
| 553 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 554 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 555 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 557 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | } |
| 559 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 561 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | { |
| 563 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 564 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 565 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 566 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 567 | &spec->ext_channel_count); |
| 568 | if (err >= 0 && !spec->const_channel_count) { |
| 569 | spec->multiout.max_channels = spec->ext_channel_count; |
| 570 | if (spec->need_dac_fix) |
| 571 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 572 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 573 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | } |
| 575 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | * 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] | 578 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | * being part of a format specifier. Maximum allowed length of a value is |
| 580 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 581 | * |
| 582 | * Note: some retasking pin complexes seem to ignore requests for input |
| 583 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 584 | * are requested. Therefore order this list so that this behaviour will not |
| 585 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 586 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 587 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 588 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 589 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 590 | "Mic 50pc bias", "Mic 80pc bias", |
| 591 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | }; |
| 593 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 594 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 595 | }; |
| 596 | /* 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] | 597 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 598 | * addition, "input" pins may or may not process the mic bias option |
| 599 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 600 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 601 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 602 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 603 | #define ALC_PIN_DIR_IN 0x00 |
| 604 | #define ALC_PIN_DIR_OUT 0x01 |
| 605 | #define ALC_PIN_DIR_INOUT 0x02 |
| 606 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 607 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 608 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 609 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 610 | * For each direction the minimum and maximum values are given. |
| 611 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 612 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 613 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 614 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 615 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 616 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 617 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 618 | }; |
| 619 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 620 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 621 | #define alc_pin_mode_n_items(_dir) \ |
| 622 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 624 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 625 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 626 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 627 | unsigned int item_num = uinfo->value.enumerated.item; |
| 628 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 629 | |
| 630 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 631 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 632 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 633 | |
| 634 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 635 | item_num = alc_pin_mode_min(dir); |
| 636 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 637 | return 0; |
| 638 | } |
| 639 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 640 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 641 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 642 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 643 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 644 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 645 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 646 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 647 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 648 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 649 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 650 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 651 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 652 | /* Find enumerated value for current pinctl setting */ |
| 653 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 654 | 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] | 655 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 656 | *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] | 657 | return 0; |
| 658 | } |
| 659 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 660 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 661 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 662 | { |
| 663 | signed int change; |
| 664 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 665 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 666 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 667 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 668 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 669 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 670 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 671 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 672 | 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] | 673 | val = alc_pin_mode_min(dir); |
| 674 | |
| 675 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 676 | if (change) { |
| 677 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 678 | snd_hda_codec_write_cache(codec, nid, 0, |
| 679 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 680 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 681 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 682 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 683 | * for the requested pin mode. Enum values of 2 or less are |
| 684 | * input modes. |
| 685 | * |
| 686 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 687 | * reduces noise slightly (particularly on input) so we'll |
| 688 | * do it. However, having both input and output buffers |
| 689 | * enabled simultaneously doesn't seem to be problematic if |
| 690 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 691 | */ |
| 692 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 693 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 694 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 695 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 696 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 697 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 698 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 699 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 700 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 701 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 702 | } |
| 703 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 704 | return change; |
| 705 | } |
| 706 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 707 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 708 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 709 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 710 | .info = alc_pin_mode_info, \ |
| 711 | .get = alc_pin_mode_get, \ |
| 712 | .put = alc_pin_mode_put, \ |
| 713 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 714 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 715 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 716 | * together using a mask with more than one bit set. This control is |
| 717 | * currently used only by the ALC260 test model. At this stage they are not |
| 718 | * needed for any "production" models. |
| 719 | */ |
| 720 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 721 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 722 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 723 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 724 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 725 | { |
| 726 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 727 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 728 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 729 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 730 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 731 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 732 | |
| 733 | *valp = (val & mask) != 0; |
| 734 | return 0; |
| 735 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 736 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 737 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 738 | { |
| 739 | signed int change; |
| 740 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 741 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 742 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 743 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 744 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 745 | AC_VERB_GET_GPIO_DATA, |
| 746 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 747 | |
| 748 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 749 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 750 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 751 | gpio_data &= ~mask; |
| 752 | else |
| 753 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 754 | snd_hda_codec_write_cache(codec, nid, 0, |
| 755 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 756 | |
| 757 | return change; |
| 758 | } |
| 759 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 760 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 761 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 762 | .info = alc_gpio_data_info, \ |
| 763 | .get = alc_gpio_data_get, \ |
| 764 | .put = alc_gpio_data_put, \ |
| 765 | .private_value = nid | (mask<<16) } |
| 766 | #endif /* CONFIG_SND_DEBUG */ |
| 767 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 768 | /* A switch control to allow the enabling of the digital IO pins on the |
| 769 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 770 | * to provide something in the test model allowing digital outputs to be |
| 771 | * identified if present. If models are found which can utilise these |
| 772 | * outputs a more complete mixer control can be devised for those models if |
| 773 | * necessary. |
| 774 | */ |
| 775 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 776 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 777 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 778 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 779 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 780 | { |
| 781 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 782 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 783 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 784 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 785 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 786 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 787 | |
| 788 | *valp = (val & mask) != 0; |
| 789 | return 0; |
| 790 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 791 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 792 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 793 | { |
| 794 | signed int change; |
| 795 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 796 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 797 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 798 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 799 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 800 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 801 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 802 | |
| 803 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 804 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 805 | if (val==0) |
| 806 | ctrl_data &= ~mask; |
| 807 | else |
| 808 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 809 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 810 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 811 | |
| 812 | return change; |
| 813 | } |
| 814 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 815 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 816 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 817 | .info = alc_spdif_ctrl_info, \ |
| 818 | .get = alc_spdif_ctrl_get, \ |
| 819 | .put = alc_spdif_ctrl_put, \ |
| 820 | .private_value = nid | (mask<<16) } |
| 821 | #endif /* CONFIG_SND_DEBUG */ |
| 822 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 823 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 824 | * Again, this is only used in the ALC26x test models to help identify when |
| 825 | * the EAPD line must be asserted for features to work. |
| 826 | */ |
| 827 | #ifdef CONFIG_SND_DEBUG |
| 828 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 829 | |
| 830 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 831 | struct snd_ctl_elem_value *ucontrol) |
| 832 | { |
| 833 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 834 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 835 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 836 | long *valp = ucontrol->value.integer.value; |
| 837 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 838 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 839 | |
| 840 | *valp = (val & mask) != 0; |
| 841 | return 0; |
| 842 | } |
| 843 | |
| 844 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 845 | struct snd_ctl_elem_value *ucontrol) |
| 846 | { |
| 847 | int change; |
| 848 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 849 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 850 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 851 | long val = *ucontrol->value.integer.value; |
| 852 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 853 | AC_VERB_GET_EAPD_BTLENABLE, |
| 854 | 0x00); |
| 855 | |
| 856 | /* Set/unset the masked control bit(s) as needed */ |
| 857 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 858 | if (!val) |
| 859 | ctrl_data &= ~mask; |
| 860 | else |
| 861 | ctrl_data |= mask; |
| 862 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 863 | ctrl_data); |
| 864 | |
| 865 | return change; |
| 866 | } |
| 867 | |
| 868 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 869 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 870 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 871 | .info = alc_eapd_ctrl_info, \ |
| 872 | .get = alc_eapd_ctrl_get, \ |
| 873 | .put = alc_eapd_ctrl_put, \ |
| 874 | .private_value = nid | (mask<<16) } |
| 875 | #endif /* CONFIG_SND_DEBUG */ |
| 876 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 877 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 878 | * set up the input pin config (depending on the given auto-pin type) |
| 879 | */ |
| 880 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 881 | int auto_pin_type) |
| 882 | { |
| 883 | unsigned int val = PIN_IN; |
| 884 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 885 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 886 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 887 | unsigned int oldval; |
| 888 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 889 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 890 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 891 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 892 | /* if the default pin setup is vref50, we give it priority */ |
| 893 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 894 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 895 | else if (pincap & AC_PINCAP_VREF_50) |
| 896 | val = PIN_VREF50; |
| 897 | else if (pincap & AC_PINCAP_VREF_100) |
| 898 | val = PIN_VREF100; |
| 899 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 900 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 901 | } |
| 902 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 903 | } |
| 904 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 905 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 906 | { |
| 907 | struct alc_spec *spec = codec->spec; |
| 908 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 909 | |
| 910 | if (!cfg->line_outs) { |
| 911 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 912 | cfg->line_out_pins[cfg->line_outs]) |
| 913 | cfg->line_outs++; |
| 914 | } |
| 915 | if (!cfg->speaker_outs) { |
| 916 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 917 | cfg->speaker_pins[cfg->speaker_outs]) |
| 918 | cfg->speaker_outs++; |
| 919 | } |
| 920 | if (!cfg->hp_outs) { |
| 921 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 922 | cfg->hp_pins[cfg->hp_outs]) |
| 923 | cfg->hp_outs++; |
| 924 | } |
| 925 | } |
| 926 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 927 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 928 | */ |
| 929 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 930 | { |
| 931 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 932 | return; |
| 933 | spec->mixers[spec->num_mixers++] = mix; |
| 934 | } |
| 935 | |
| 936 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 937 | { |
| 938 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 939 | return; |
| 940 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 941 | } |
| 942 | |
| 943 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 944 | * set up from the preset table |
| 945 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 946 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 947 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 948 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 949 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 950 | int i; |
| 951 | |
| 952 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 953 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 954 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 955 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 956 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 957 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 958 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 959 | spec->channel_mode = preset->channel_mode; |
| 960 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 961 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 962 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 963 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 964 | if (preset->const_channel_count) |
| 965 | spec->multiout.max_channels = preset->const_channel_count; |
| 966 | else |
| 967 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 968 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 969 | |
| 970 | spec->multiout.num_dacs = preset->num_dacs; |
| 971 | spec->multiout.dac_nids = preset->dac_nids; |
| 972 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 973 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 974 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 975 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 976 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 977 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 978 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 979 | spec->input_mux = preset->input_mux; |
| 980 | |
| 981 | spec->num_adc_nids = preset->num_adc_nids; |
| 982 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 983 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 984 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 985 | |
| 986 | spec->unsol_event = preset->unsol_event; |
| 987 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 988 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 989 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 990 | spec->loopback.amplist = preset->loopbacks; |
| 991 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 992 | |
| 993 | if (preset->setup) |
| 994 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 995 | |
| 996 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 997 | } |
| 998 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 999 | /* Enable GPIO mask and set output */ |
| 1000 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 1001 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 1002 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 1003 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 1004 | { } |
| 1005 | }; |
| 1006 | |
| 1007 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 1008 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 1009 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 1010 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 1011 | { } |
| 1012 | }; |
| 1013 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1014 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 1015 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 1016 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 1017 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 1018 | { } |
| 1019 | }; |
| 1020 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 1021 | /* |
| 1022 | * Fix hardware PLL issue |
| 1023 | * On some codecs, the analog PLL gating control must be off while |
| 1024 | * the default value is 1. |
| 1025 | */ |
| 1026 | static void alc_fix_pll(struct hda_codec *codec) |
| 1027 | { |
| 1028 | struct alc_spec *spec = codec->spec; |
| 1029 | unsigned int val; |
| 1030 | |
| 1031 | if (!spec->pll_nid) |
| 1032 | return; |
| 1033 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1034 | spec->pll_coef_idx); |
| 1035 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1036 | AC_VERB_GET_PROC_COEF, 0); |
| 1037 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1038 | spec->pll_coef_idx); |
| 1039 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1040 | val & ~(1 << spec->pll_coef_bit)); |
| 1041 | } |
| 1042 | |
| 1043 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1044 | unsigned int coef_idx, unsigned int coef_bit) |
| 1045 | { |
| 1046 | struct alc_spec *spec = codec->spec; |
| 1047 | spec->pll_nid = nid; |
| 1048 | spec->pll_coef_idx = coef_idx; |
| 1049 | spec->pll_coef_bit = coef_bit; |
| 1050 | alc_fix_pll(codec); |
| 1051 | } |
| 1052 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1053 | static int alc_init_jacks(struct hda_codec *codec) |
| 1054 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1055 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1056 | struct alc_spec *spec = codec->spec; |
| 1057 | int err; |
| 1058 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1059 | unsigned int mic_nid = spec->ext_mic.pin; |
| 1060 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1061 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1062 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1063 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1064 | if (err < 0) |
| 1065 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1066 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1067 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1068 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1069 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1070 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1071 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1072 | if (err < 0) |
| 1073 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1074 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1075 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1076 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1077 | return 0; |
| 1078 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1079 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1080 | 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] | 1081 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1082 | int i, present = 0; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1083 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1084 | for (i = 0; i < num_pins; i++) { |
| 1085 | hda_nid_t nid = pins[i]; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1086 | if (!nid) |
| 1087 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1088 | snd_hda_input_jack_report(codec, nid); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1089 | present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1090 | } |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1091 | return present; |
| 1092 | } |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1093 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1094 | 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^] | 1095 | bool mute, bool hp_out) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1096 | { |
| 1097 | struct alc_spec *spec = codec->spec; |
| 1098 | unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 1099 | unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1100 | int i; |
| 1101 | |
| 1102 | for (i = 0; i < num_pins; i++) { |
| 1103 | hda_nid_t nid = pins[i]; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1104 | if (!nid) |
| 1105 | break; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1106 | switch (spec->automute_mode) { |
| 1107 | case ALC_AUTOMUTE_PIN: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1108 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1109 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1110 | pin_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1111 | break; |
| 1112 | case ALC_AUTOMUTE_AMP: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1113 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1114 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1115 | break; |
| 1116 | case ALC_AUTOMUTE_MIXER: |
| 1117 | nid = spec->automute_mixer_nid[i]; |
| 1118 | if (!nid) |
| 1119 | break; |
| 1120 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1121 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1122 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1123 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1124 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1125 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1126 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | } |
| 1128 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1129 | /* Toggle internal speakers muting */ |
| 1130 | static void update_speakers(struct hda_codec *codec) |
| 1131 | { |
| 1132 | struct alc_spec *spec = codec->spec; |
| 1133 | |
| 1134 | do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), |
| 1135 | spec->autocfg.speaker_pins, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 1136 | spec->jack_present | spec->line_jack_present | |
| 1137 | spec->master_mute, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1138 | |
| 1139 | /* toggle line-out mutes if needed, too */ |
| 1140 | if (!spec->automute_lines) |
| 1141 | return; |
| 1142 | do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
| 1143 | spec->autocfg.line_out_pins, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 1144 | spec->jack_present | spec->master_mute, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1145 | } |
| 1146 | |
| 1147 | static void alc_hp_automute(struct hda_codec *codec) |
| 1148 | { |
| 1149 | struct alc_spec *spec = codec->spec; |
| 1150 | |
| 1151 | if (!spec->automute) |
| 1152 | return; |
| 1153 | spec->jack_present = |
| 1154 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 1155 | spec->autocfg.hp_pins); |
| 1156 | update_speakers(codec); |
| 1157 | } |
| 1158 | |
| 1159 | static void alc_line_automute(struct hda_codec *codec) |
| 1160 | { |
| 1161 | struct alc_spec *spec = codec->spec; |
| 1162 | |
| 1163 | if (!spec->automute || !spec->detect_line) |
| 1164 | return; |
| 1165 | spec->line_jack_present = |
| 1166 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
| 1167 | spec->autocfg.line_out_pins); |
| 1168 | update_speakers(codec); |
| 1169 | } |
| 1170 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1171 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1172 | hda_nid_t nid) |
| 1173 | { |
| 1174 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1175 | int i, nums; |
| 1176 | |
| 1177 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1178 | for (i = 0; i < nums; i++) |
| 1179 | if (conn[i] == nid) |
| 1180 | return i; |
| 1181 | return -1; |
| 1182 | } |
| 1183 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1184 | /* switch the current ADC according to the jack state */ |
| 1185 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1186 | { |
| 1187 | struct alc_spec *spec = codec->spec; |
| 1188 | unsigned int present; |
| 1189 | hda_nid_t new_adc; |
| 1190 | |
| 1191 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1192 | if (present) |
| 1193 | spec->cur_adc_idx = 1; |
| 1194 | else |
| 1195 | spec->cur_adc_idx = 0; |
| 1196 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1197 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1198 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1199 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1200 | spec->cur_adc = new_adc; |
| 1201 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1202 | spec->cur_adc_stream_tag, 0, |
| 1203 | spec->cur_adc_format); |
| 1204 | } |
| 1205 | } |
| 1206 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1207 | static void alc_mic_automute(struct hda_codec *codec) |
| 1208 | { |
| 1209 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1210 | struct alc_mic_route *dead, *alive; |
| 1211 | unsigned int present, type; |
| 1212 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1213 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1214 | if (!spec->auto_mic) |
| 1215 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1216 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1217 | return; |
| 1218 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1219 | return; |
| 1220 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1221 | if (spec->dual_adc_switch) { |
| 1222 | alc_dual_mic_adc_auto_switch(codec); |
| 1223 | return; |
| 1224 | } |
| 1225 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1226 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1227 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1228 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1229 | if (present) { |
| 1230 | alive = &spec->ext_mic; |
| 1231 | dead = &spec->int_mic; |
| 1232 | } else { |
| 1233 | alive = &spec->int_mic; |
| 1234 | dead = &spec->ext_mic; |
| 1235 | } |
| 1236 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1237 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1238 | if (type == AC_WID_AUD_MIX) { |
| 1239 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1240 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1241 | alive->mux_idx, |
| 1242 | HDA_AMP_MUTE, 0); |
| 1243 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1244 | dead->mux_idx, |
| 1245 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1246 | } else { |
| 1247 | /* MUX style (e.g. ALC880) */ |
| 1248 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1249 | AC_VERB_SET_CONNECT_SEL, |
| 1250 | alive->mux_idx); |
| 1251 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1252 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1253 | |
| 1254 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1255 | } |
| 1256 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1257 | /* unsolicited event for HP jack sensing */ |
| 1258 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1259 | { |
| 1260 | if (codec->vendor_id == 0x10ec0880) |
| 1261 | res >>= 28; |
| 1262 | else |
| 1263 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1264 | switch (res) { |
| 1265 | case ALC880_HP_EVENT: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1266 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1267 | break; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1268 | case ALC880_FRONT_EVENT: |
| 1269 | alc_line_automute(codec); |
| 1270 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1271 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1272 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1273 | break; |
| 1274 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1275 | } |
| 1276 | |
| 1277 | static void alc_inithook(struct hda_codec *codec) |
| 1278 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1279 | alc_hp_automute(codec); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1280 | alc_line_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1281 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1282 | } |
| 1283 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1284 | /* additional initialization for ALC888 variants */ |
| 1285 | static void alc888_coef_init(struct hda_codec *codec) |
| 1286 | { |
| 1287 | unsigned int tmp; |
| 1288 | |
| 1289 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1290 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1291 | 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] | 1292 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1293 | /* alc888S-VC */ |
| 1294 | snd_hda_codec_read(codec, 0x20, 0, |
| 1295 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1296 | else |
| 1297 | /* alc888-VB */ |
| 1298 | snd_hda_codec_read(codec, 0x20, 0, |
| 1299 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1300 | } |
| 1301 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1302 | static void alc889_coef_init(struct hda_codec *codec) |
| 1303 | { |
| 1304 | unsigned int tmp; |
| 1305 | |
| 1306 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1307 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1308 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1309 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1310 | } |
| 1311 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1312 | /* turn on/off EAPD control (only if available) */ |
| 1313 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1314 | { |
| 1315 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1316 | return; |
| 1317 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1318 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1319 | on ? 2 : 0); |
| 1320 | } |
| 1321 | |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1322 | /* turn on/off EAPD controls of the codec */ |
| 1323 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) |
| 1324 | { |
| 1325 | /* We currently only handle front, HP */ |
| 1326 | switch (codec->vendor_id) { |
| 1327 | case 0x10ec0260: |
| 1328 | set_eapd(codec, 0x0f, on); |
| 1329 | set_eapd(codec, 0x10, on); |
| 1330 | break; |
| 1331 | case 0x10ec0262: |
| 1332 | case 0x10ec0267: |
| 1333 | case 0x10ec0268: |
| 1334 | case 0x10ec0269: |
| 1335 | case 0x10ec0270: |
| 1336 | case 0x10ec0272: |
| 1337 | case 0x10ec0660: |
| 1338 | case 0x10ec0662: |
| 1339 | case 0x10ec0663: |
| 1340 | case 0x10ec0665: |
| 1341 | case 0x10ec0862: |
| 1342 | case 0x10ec0889: |
| 1343 | case 0x10ec0892: |
| 1344 | set_eapd(codec, 0x14, on); |
| 1345 | set_eapd(codec, 0x15, on); |
| 1346 | break; |
| 1347 | } |
| 1348 | } |
| 1349 | |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 1350 | /* generic shutup callback; |
| 1351 | * just turning off EPAD and a little pause for avoiding pop-noise |
| 1352 | */ |
| 1353 | static void alc_eapd_shutup(struct hda_codec *codec) |
| 1354 | { |
| 1355 | alc_auto_setup_eapd(codec, false); |
| 1356 | msleep(200); |
| 1357 | } |
| 1358 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1359 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1360 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1361 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1362 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1363 | switch (type) { |
| 1364 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1365 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1366 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1367 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1368 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1369 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1370 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1371 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1372 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1373 | case ALC_INIT_DEFAULT: |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1374 | alc_auto_setup_eapd(codec, true); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1375 | switch (codec->vendor_id) { |
| 1376 | case 0x10ec0260: |
| 1377 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1378 | AC_VERB_SET_COEF_INDEX, 7); |
| 1379 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1380 | AC_VERB_GET_PROC_COEF, 0); |
| 1381 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1382 | AC_VERB_SET_COEF_INDEX, 7); |
| 1383 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1384 | AC_VERB_SET_PROC_COEF, |
| 1385 | tmp | 0x2010); |
| 1386 | break; |
| 1387 | case 0x10ec0262: |
| 1388 | case 0x10ec0880: |
| 1389 | case 0x10ec0882: |
| 1390 | case 0x10ec0883: |
| 1391 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1392 | case 0x10ec0887: |
Takashi Iwai | 20b67dd | 2011-03-23 22:54:32 +0100 | [diff] [blame] | 1393 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1394 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1395 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1396 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1397 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1398 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1399 | #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] | 1400 | case 0x10ec0267: |
| 1401 | case 0x10ec0268: |
| 1402 | snd_hda_codec_write(codec, 0x20, 0, |
| 1403 | AC_VERB_SET_COEF_INDEX, 7); |
| 1404 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1405 | AC_VERB_GET_PROC_COEF, 0); |
| 1406 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1407 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1408 | snd_hda_codec_write(codec, 0x20, 0, |
| 1409 | AC_VERB_SET_PROC_COEF, |
| 1410 | tmp | 0x3000); |
| 1411 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1412 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1413 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1414 | break; |
| 1415 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1416 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1417 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1418 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1419 | { |
| 1420 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1421 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1422 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1423 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1424 | if (!cfg->hp_pins[0]) { |
| 1425 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1426 | return; |
| 1427 | } |
| 1428 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1429 | if (!cfg->speaker_pins[0]) { |
| 1430 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1431 | return; |
| 1432 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1433 | sizeof(cfg->speaker_pins)); |
| 1434 | cfg->speaker_outs = cfg->line_outs; |
| 1435 | } |
| 1436 | |
| 1437 | if (!cfg->hp_pins[0]) { |
| 1438 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1439 | sizeof(cfg->hp_pins)); |
| 1440 | cfg->hp_outs = cfg->line_outs; |
| 1441 | } |
| 1442 | |
| 1443 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1444 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1445 | cfg->hp_pins[i]); |
| 1446 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1447 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1448 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1449 | spec->automute = 1; |
| 1450 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1451 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1452 | spec->unsol_event = alc_sku_unsol_event; |
| 1453 | } |
| 1454 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1455 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1456 | { |
| 1457 | struct alc_spec *spec = codec->spec; |
| 1458 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1459 | hda_nid_t fixed, ext; |
| 1460 | int i; |
| 1461 | |
| 1462 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1463 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 1464 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1465 | return; |
| 1466 | |
| 1467 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1468 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1469 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1470 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1471 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1472 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1473 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1474 | if (fixed) |
| 1475 | return; /* already occupied */ |
| 1476 | fixed = nid; |
| 1477 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1478 | case INPUT_PIN_ATTR_UNUSED: |
| 1479 | return; /* invalid entry */ |
| 1480 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1481 | if (ext) |
| 1482 | return; /* already occupied */ |
| 1483 | ext = nid; |
| 1484 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1485 | } |
| 1486 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1487 | if (!ext || !fixed) |
| 1488 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1489 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1490 | return; /* no unsol support */ |
| 1491 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1492 | ext, fixed); |
| 1493 | spec->ext_mic.pin = ext; |
| 1494 | spec->int_mic.pin = fixed; |
| 1495 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1496 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1497 | spec->auto_mic = 1; |
| 1498 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1499 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1500 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1501 | spec->unsol_event = alc_sku_unsol_event; |
| 1502 | } |
| 1503 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1504 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1505 | * the driver to ignore any present sku defines. |
| 1506 | */ |
| 1507 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1508 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1509 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1510 | { |
| 1511 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1512 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1513 | struct alc_spec *spec = codec->spec; |
| 1514 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1515 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1516 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1517 | if (spec->cdefine.fixup) { |
| 1518 | ass = spec->cdefine.sku_cfg; |
| 1519 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1520 | return -1; |
| 1521 | goto do_sku; |
| 1522 | } |
| 1523 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1524 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1525 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1526 | goto do_sku; |
| 1527 | |
| 1528 | nid = 0x1d; |
| 1529 | if (codec->vendor_id == 0x10ec0260) |
| 1530 | nid = 0x17; |
| 1531 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1532 | |
| 1533 | if (!(ass & 1)) { |
| 1534 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1535 | codec->chip_name, ass); |
| 1536 | return -1; |
| 1537 | } |
| 1538 | |
| 1539 | /* check sum */ |
| 1540 | tmp = 0; |
| 1541 | for (i = 1; i < 16; i++) { |
| 1542 | if ((ass >> i) & 1) |
| 1543 | tmp++; |
| 1544 | } |
| 1545 | if (((ass >> 16) & 0xf) != tmp) |
| 1546 | return -1; |
| 1547 | |
| 1548 | spec->cdefine.port_connectivity = ass >> 30; |
| 1549 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1550 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1551 | spec->cdefine.customization = ass >> 8; |
| 1552 | do_sku: |
| 1553 | spec->cdefine.sku_cfg = ass; |
| 1554 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1555 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1556 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1557 | spec->cdefine.override = ass & 0x1; |
| 1558 | |
| 1559 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1560 | nid, spec->cdefine.sku_cfg); |
| 1561 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1562 | spec->cdefine.port_connectivity); |
| 1563 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1564 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1565 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1566 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1567 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1568 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1569 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1570 | |
| 1571 | return 0; |
| 1572 | } |
| 1573 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1574 | /* check subsystem ID and set up device-specific initialization; |
| 1575 | * return 1 if initialized, 0 if invalid SSID |
| 1576 | */ |
| 1577 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1578 | * 31 ~ 16 : Manufacture ID |
| 1579 | * 15 ~ 8 : SKU ID |
| 1580 | * 7 ~ 0 : Assembly ID |
| 1581 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1582 | */ |
| 1583 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1584 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1585 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1586 | { |
| 1587 | unsigned int ass, tmp, i; |
| 1588 | unsigned nid; |
| 1589 | struct alc_spec *spec = codec->spec; |
| 1590 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1591 | if (spec->cdefine.fixup) { |
| 1592 | ass = spec->cdefine.sku_cfg; |
| 1593 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1594 | return 0; |
| 1595 | goto do_sku; |
| 1596 | } |
| 1597 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1598 | ass = codec->subsystem_id & 0xffff; |
| 1599 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1600 | goto do_sku; |
| 1601 | |
| 1602 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1603 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1604 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1605 | * 29~21 : reserve |
| 1606 | * 20 : PCBEEP input |
| 1607 | * 19~16 : Check sum (15:1) |
| 1608 | * 15~1 : Custom |
| 1609 | * 0 : override |
| 1610 | */ |
| 1611 | nid = 0x1d; |
| 1612 | if (codec->vendor_id == 0x10ec0260) |
| 1613 | nid = 0x17; |
| 1614 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1615 | snd_printd("realtek: No valid SSID, " |
| 1616 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1617 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1618 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1619 | return 0; |
| 1620 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1621 | return 0; |
| 1622 | |
| 1623 | /* check sum */ |
| 1624 | tmp = 0; |
| 1625 | for (i = 1; i < 16; i++) { |
| 1626 | if ((ass >> i) & 1) |
| 1627 | tmp++; |
| 1628 | } |
| 1629 | if (((ass >> 16) & 0xf) != tmp) |
| 1630 | return 0; |
| 1631 | do_sku: |
| 1632 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1633 | ass & 0xffff, codec->vendor_id); |
| 1634 | /* |
| 1635 | * 0 : override |
| 1636 | * 1 : Swap Jack |
| 1637 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1638 | * 3~5 : External Amplifier control |
| 1639 | * 7~6 : Reserved |
| 1640 | */ |
| 1641 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1642 | switch (tmp) { |
| 1643 | case 1: |
| 1644 | spec->init_amp = ALC_INIT_GPIO1; |
| 1645 | break; |
| 1646 | case 3: |
| 1647 | spec->init_amp = ALC_INIT_GPIO2; |
| 1648 | break; |
| 1649 | case 7: |
| 1650 | spec->init_amp = ALC_INIT_GPIO3; |
| 1651 | break; |
| 1652 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1653 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1654 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1655 | break; |
| 1656 | } |
| 1657 | |
| 1658 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1659 | * when the external headphone out jack is plugged" |
| 1660 | */ |
| 1661 | if (!(ass & 0x8000)) |
| 1662 | return 1; |
| 1663 | /* |
| 1664 | * 10~8 : Jack location |
| 1665 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1666 | * 14~13: Resvered |
| 1667 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1668 | * when the external headphone out jack is plugged" |
| 1669 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1670 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1671 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1672 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1673 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1674 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1675 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1676 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1677 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1678 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1679 | else if (tmp == 3) |
| 1680 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1681 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1682 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1683 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1684 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1685 | return 1; |
| 1686 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1687 | } |
| 1688 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1689 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1690 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1691 | return 1; |
| 1692 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1693 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1694 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1695 | hda_nid_t porta, hda_nid_t porte, |
| 1696 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1697 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1698 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1699 | struct alc_spec *spec = codec->spec; |
| 1700 | snd_printd("realtek: " |
| 1701 | "Enable default setup for auto mode as fallback\n"); |
| 1702 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1703 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1704 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1705 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1706 | } |
| 1707 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1708 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1709 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1710 | */ |
| 1711 | |
| 1712 | struct alc_pincfg { |
| 1713 | hda_nid_t nid; |
| 1714 | u32 val; |
| 1715 | }; |
| 1716 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1717 | struct alc_model_fixup { |
| 1718 | const int id; |
| 1719 | const char *name; |
| 1720 | }; |
| 1721 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1722 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1723 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1724 | bool chained; |
| 1725 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1726 | union { |
| 1727 | unsigned int sku; |
| 1728 | const struct alc_pincfg *pins; |
| 1729 | const struct hda_verb *verbs; |
| 1730 | void (*func)(struct hda_codec *codec, |
| 1731 | const struct alc_fixup *fix, |
| 1732 | int action); |
| 1733 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1734 | }; |
| 1735 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1736 | enum { |
| 1737 | ALC_FIXUP_INVALID, |
| 1738 | ALC_FIXUP_SKU, |
| 1739 | ALC_FIXUP_PINS, |
| 1740 | ALC_FIXUP_VERBS, |
| 1741 | ALC_FIXUP_FUNC, |
| 1742 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1743 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1744 | enum { |
| 1745 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1746 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1747 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1748 | }; |
| 1749 | |
| 1750 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1751 | { |
| 1752 | struct alc_spec *spec = codec->spec; |
| 1753 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1754 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1755 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1756 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1757 | int depth = 0; |
| 1758 | |
| 1759 | if (!spec->fixup_list) |
| 1760 | return; |
| 1761 | |
| 1762 | while (id >= 0) { |
| 1763 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1764 | const struct alc_pincfg *cfg; |
| 1765 | |
| 1766 | switch (fix->type) { |
| 1767 | case ALC_FIXUP_SKU: |
| 1768 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1769 | break;; |
| 1770 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1771 | "Apply sku override for %s\n", |
| 1772 | codec->chip_name, modelname); |
| 1773 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1774 | spec->cdefine.fixup = 1; |
| 1775 | break; |
| 1776 | case ALC_FIXUP_PINS: |
| 1777 | cfg = fix->v.pins; |
| 1778 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1779 | break; |
| 1780 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1781 | "Apply pincfg for %s\n", |
| 1782 | codec->chip_name, modelname); |
| 1783 | for (; cfg->nid; cfg++) |
| 1784 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1785 | cfg->val); |
| 1786 | break; |
| 1787 | case ALC_FIXUP_VERBS: |
| 1788 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1789 | break; |
| 1790 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1791 | "Apply fix-verbs for %s\n", |
| 1792 | codec->chip_name, modelname); |
| 1793 | add_verb(codec->spec, fix->v.verbs); |
| 1794 | break; |
| 1795 | case ALC_FIXUP_FUNC: |
| 1796 | if (!fix->v.func) |
| 1797 | break; |
| 1798 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1799 | "Apply fix-func for %s\n", |
| 1800 | codec->chip_name, modelname); |
| 1801 | fix->v.func(codec, fix, action); |
| 1802 | break; |
| 1803 | default: |
| 1804 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1805 | "Invalid fixup type %d\n", |
| 1806 | codec->chip_name, fix->type); |
| 1807 | break; |
| 1808 | } |
| 1809 | if (!fix[id].chained) |
| 1810 | break; |
| 1811 | if (++depth > 10) |
| 1812 | break; |
| 1813 | id = fix[id].chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1814 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1815 | } |
| 1816 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1817 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1818 | const struct alc_model_fixup *models, |
| 1819 | const struct snd_pci_quirk *quirk, |
| 1820 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1821 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1822 | struct alc_spec *spec = codec->spec; |
| 1823 | int id = -1; |
| 1824 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1825 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1826 | if (codec->modelname && models) { |
| 1827 | while (models->name) { |
| 1828 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1829 | id = models->id; |
| 1830 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1831 | break; |
| 1832 | } |
| 1833 | models++; |
| 1834 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1835 | } |
| 1836 | if (id < 0) { |
| 1837 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1838 | if (quirk) { |
| 1839 | id = quirk->value; |
| 1840 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1841 | name = quirk->name; |
| 1842 | #endif |
| 1843 | } |
| 1844 | } |
| 1845 | |
| 1846 | spec->fixup_id = id; |
| 1847 | if (id >= 0) { |
| 1848 | spec->fixup_list = fixlist; |
| 1849 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1850 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1851 | } |
| 1852 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1853 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1854 | unsigned int coef_idx) |
| 1855 | { |
| 1856 | unsigned int val; |
| 1857 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1858 | coef_idx); |
| 1859 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1860 | AC_VERB_GET_PROC_COEF, 0); |
| 1861 | return val; |
| 1862 | } |
| 1863 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 1864 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 1865 | unsigned int coef_val) |
| 1866 | { |
| 1867 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1868 | coef_idx); |
| 1869 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 1870 | coef_val); |
| 1871 | } |
| 1872 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1873 | /* set right pin controls for digital I/O */ |
| 1874 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1875 | { |
| 1876 | struct alc_spec *spec = codec->spec; |
| 1877 | int i; |
| 1878 | hda_nid_t pin; |
| 1879 | |
| 1880 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1881 | pin = spec->autocfg.dig_out_pins[i]; |
| 1882 | if (pin) { |
| 1883 | snd_hda_codec_write(codec, pin, 0, |
| 1884 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1885 | PIN_OUT); |
| 1886 | } |
| 1887 | } |
| 1888 | pin = spec->autocfg.dig_in_pin; |
| 1889 | if (pin) |
| 1890 | snd_hda_codec_write(codec, pin, 0, |
| 1891 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1892 | PIN_IN); |
| 1893 | } |
| 1894 | |
| 1895 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1896 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1897 | { |
| 1898 | struct alc_spec *spec = codec->spec; |
| 1899 | int i, err; |
| 1900 | hda_nid_t dig_nid; |
| 1901 | |
| 1902 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1903 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1904 | err = snd_hda_get_connections(codec, |
| 1905 | spec->autocfg.dig_out_pins[i], |
| 1906 | &dig_nid, 1); |
| 1907 | if (err < 0) |
| 1908 | continue; |
| 1909 | if (!i) { |
| 1910 | spec->multiout.dig_out_nid = dig_nid; |
| 1911 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1912 | } else { |
| 1913 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1914 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1915 | break; |
| 1916 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1917 | } |
| 1918 | } |
| 1919 | |
| 1920 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 1921 | dig_nid = codec->start_nid; |
| 1922 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 1923 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 1924 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 1925 | continue; |
| 1926 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 1927 | continue; |
| 1928 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 1929 | continue; |
| 1930 | err = get_connection_index(codec, dig_nid, |
| 1931 | spec->autocfg.dig_in_pin); |
| 1932 | if (err >= 0) { |
| 1933 | spec->dig_in_nid = dig_nid; |
| 1934 | break; |
| 1935 | } |
| 1936 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1937 | } |
| 1938 | } |
| 1939 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1940 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1941 | * ALC888 |
| 1942 | */ |
| 1943 | |
| 1944 | /* |
| 1945 | * 2ch mode |
| 1946 | */ |
| 1947 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1948 | /* Mic-in jack as mic in */ |
| 1949 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1950 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1951 | /* Line-in jack as Line in */ |
| 1952 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1953 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1954 | /* Line-Out as Front */ |
| 1955 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1956 | { } /* end */ |
| 1957 | }; |
| 1958 | |
| 1959 | /* |
| 1960 | * 4ch mode |
| 1961 | */ |
| 1962 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1963 | /* Mic-in jack as mic in */ |
| 1964 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1965 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1966 | /* Line-in jack as Surround */ |
| 1967 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1968 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1969 | /* Line-Out as Front */ |
| 1970 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1971 | { } /* end */ |
| 1972 | }; |
| 1973 | |
| 1974 | /* |
| 1975 | * 6ch mode |
| 1976 | */ |
| 1977 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1978 | /* Mic-in jack as CLFE */ |
| 1979 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1980 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1981 | /* Line-in jack as Surround */ |
| 1982 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1983 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1984 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1985 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1986 | { } /* end */ |
| 1987 | }; |
| 1988 | |
| 1989 | /* |
| 1990 | * 8ch mode |
| 1991 | */ |
| 1992 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1993 | /* Mic-in jack as CLFE */ |
| 1994 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1995 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1996 | /* Line-in jack as Surround */ |
| 1997 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1998 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1999 | /* Line-Out as Side */ |
| 2000 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2001 | { } /* end */ |
| 2002 | }; |
| 2003 | |
| 2004 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 2005 | { 2, alc888_4ST_ch2_intel_init }, |
| 2006 | { 4, alc888_4ST_ch4_intel_init }, |
| 2007 | { 6, alc888_4ST_ch6_intel_init }, |
| 2008 | { 8, alc888_4ST_ch8_intel_init }, |
| 2009 | }; |
| 2010 | |
| 2011 | /* |
| 2012 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 2013 | */ |
| 2014 | |
| 2015 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 2016 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2017 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2018 | /* Connect Internal HP to Front */ |
| 2019 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2020 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2021 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2022 | /* Connect Bass HP to Front */ |
| 2023 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2024 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2025 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2026 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 2027 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2028 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2029 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2030 | /* Connect Mic jack to CLFE */ |
| 2031 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2032 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2033 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2034 | /* Connect Line-in jack to Surround */ |
| 2035 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2036 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2037 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2038 | /* Connect HP out jack to Front */ |
| 2039 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2040 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2041 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2042 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2043 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2044 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2045 | {} |
| 2046 | }; |
| 2047 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2048 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2049 | { |
| 2050 | struct alc_spec *spec = codec->spec; |
| 2051 | |
| 2052 | spec->autocfg.hp_pins[0] = 0x15; |
| 2053 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2054 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2055 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2056 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2057 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2058 | spec->automute = 1; |
| 2059 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2060 | } |
| 2061 | |
| 2062 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2063 | { |
| 2064 | alc889_coef_init(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2065 | alc_hp_automute(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2066 | } |
| 2067 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2068 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2069 | { |
| 2070 | struct alc_spec *spec = codec->spec; |
| 2071 | |
| 2072 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2073 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2074 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2075 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2076 | spec->automute = 1; |
| 2077 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2078 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2079 | |
| 2080 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2081 | * ALC888 Acer Aspire 4930G model |
| 2082 | */ |
| 2083 | |
| 2084 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 2085 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2086 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2087 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2089 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2090 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2091 | /* Connect Internal HP to front */ |
| 2092 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2093 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2094 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2095 | /* Connect HP out to front */ |
| 2096 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2097 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2098 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2099 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2100 | { } |
| 2101 | }; |
| 2102 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2103 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2104 | * ALC888 Acer Aspire 6530G model |
| 2105 | */ |
| 2106 | |
| 2107 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2108 | /* Route to built-in subwoofer as well as speakers */ |
| 2109 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2110 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2111 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2112 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2113 | /* Bias voltage on for external mic port */ |
| 2114 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2115 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2116 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2117 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2119 | /* Enable unsolicited event for HP jack */ |
| 2120 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2121 | /* Enable speaker output */ |
| 2122 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2123 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2124 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2125 | /* Enable headphone output */ |
| 2126 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2127 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2128 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2129 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2130 | { } |
| 2131 | }; |
| 2132 | |
| 2133 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2134 | *ALC888 Acer Aspire 7730G model |
| 2135 | */ |
| 2136 | |
| 2137 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 2138 | /* Bias voltage on for external mic port */ |
| 2139 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2140 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2141 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2142 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2143 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2144 | /* Enable unsolicited event for HP jack */ |
| 2145 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2146 | /* Enable speaker output */ |
| 2147 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2148 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2149 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2150 | /* Enable headphone output */ |
| 2151 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2152 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2153 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2154 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2155 | /*Enable internal subwoofer */ |
| 2156 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2157 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2158 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2159 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2160 | { } |
| 2161 | }; |
| 2162 | |
| 2163 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2164 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2165 | */ |
| 2166 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2167 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2168 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2169 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2170 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2172 | /* Enable unsolicited event for HP jack */ |
| 2173 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2174 | /* Connect Internal Front to Front */ |
| 2175 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2176 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2177 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2178 | /* Connect Internal Rear to Rear */ |
| 2179 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2180 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2181 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2182 | /* Connect Internal CLFE to CLFE */ |
| 2183 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2184 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2185 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2186 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2189 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2190 | /* Enable all DACs */ |
| 2191 | /* DAC DISABLE/MUTE 1? */ |
| 2192 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2193 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2194 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2195 | /* DAC DISABLE/MUTE 2? */ |
| 2196 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2197 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2198 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2199 | /* DMIC fix |
| 2200 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2201 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2202 | * makes the signal become a difference/sum signal instead of standard |
| 2203 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2204 | * codec replicate the sum signal to both channels, turning it into a |
| 2205 | * normal mono mic. |
| 2206 | */ |
| 2207 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2208 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2209 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2210 | { } |
| 2211 | }; |
| 2212 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2213 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2214 | /* Front mic only available on one ADC */ |
| 2215 | { |
| 2216 | .num_items = 4, |
| 2217 | .items = { |
| 2218 | { "Mic", 0x0 }, |
| 2219 | { "Line", 0x2 }, |
| 2220 | { "CD", 0x4 }, |
| 2221 | { "Front Mic", 0xb }, |
| 2222 | }, |
| 2223 | }, |
| 2224 | { |
| 2225 | .num_items = 3, |
| 2226 | .items = { |
| 2227 | { "Mic", 0x0 }, |
| 2228 | { "Line", 0x2 }, |
| 2229 | { "CD", 0x4 }, |
| 2230 | }, |
| 2231 | } |
| 2232 | }; |
| 2233 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2234 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 2235 | /* Interal mic only available on one ADC */ |
| 2236 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2237 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2238 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2239 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2240 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2241 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2242 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2243 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2244 | }, |
| 2245 | }, |
| 2246 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2247 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2248 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2249 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2250 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2251 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2252 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2253 | }, |
| 2254 | } |
| 2255 | }; |
| 2256 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2257 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 2258 | /* Digital mic only available on first "ADC" */ |
| 2259 | { |
| 2260 | .num_items = 5, |
| 2261 | .items = { |
| 2262 | { "Mic", 0x0 }, |
| 2263 | { "Line", 0x2 }, |
| 2264 | { "CD", 0x4 }, |
| 2265 | { "Front Mic", 0xb }, |
| 2266 | { "Input Mix", 0xa }, |
| 2267 | }, |
| 2268 | }, |
| 2269 | { |
| 2270 | .num_items = 4, |
| 2271 | .items = { |
| 2272 | { "Mic", 0x0 }, |
| 2273 | { "Line", 0x2 }, |
| 2274 | { "CD", 0x4 }, |
| 2275 | { "Input Mix", 0xa }, |
| 2276 | }, |
| 2277 | }, |
| 2278 | { |
| 2279 | .num_items = 4, |
| 2280 | .items = { |
| 2281 | { "Mic", 0x0 }, |
| 2282 | { "Line", 0x2 }, |
| 2283 | { "CD", 0x4 }, |
| 2284 | { "Input Mix", 0xa }, |
| 2285 | }, |
| 2286 | } |
| 2287 | }; |
| 2288 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2289 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2291 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2292 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2293 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2294 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2295 | HDA_OUTPUT), |
| 2296 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2297 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2298 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2299 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2300 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2301 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2302 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2303 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2304 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2305 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2306 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2307 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2308 | { } /* end */ |
| 2309 | }; |
| 2310 | |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2311 | static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
| 2312 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2313 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2314 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2315 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2316 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2317 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2318 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2319 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2320 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2321 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2322 | 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] | 2323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2325 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2326 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2328 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2330 | { } /* end */ |
| 2331 | }; |
| 2332 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2333 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 2334 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2335 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2336 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2337 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2338 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2339 | HDA_OUTPUT), |
| 2340 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2341 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2342 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2343 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2344 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2345 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2346 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2347 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2348 | { } /* end */ |
| 2349 | }; |
| 2350 | |
| 2351 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2352 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2353 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2354 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2355 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2356 | spec->autocfg.hp_pins[0] = 0x15; |
| 2357 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2358 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2359 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2360 | spec->automute = 1; |
| 2361 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2362 | } |
| 2363 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2364 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2365 | { |
| 2366 | struct alc_spec *spec = codec->spec; |
| 2367 | |
| 2368 | spec->autocfg.hp_pins[0] = 0x15; |
| 2369 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2370 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2371 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2372 | spec->automute = 1; |
| 2373 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2374 | } |
| 2375 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2376 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2377 | { |
| 2378 | struct alc_spec *spec = codec->spec; |
| 2379 | |
| 2380 | spec->autocfg.hp_pins[0] = 0x15; |
| 2381 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2382 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2383 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2384 | spec->automute = 1; |
| 2385 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2386 | } |
| 2387 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2388 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2389 | { |
| 2390 | struct alc_spec *spec = codec->spec; |
| 2391 | |
| 2392 | spec->autocfg.hp_pins[0] = 0x15; |
| 2393 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2394 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2395 | spec->autocfg.speaker_pins[2] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2396 | spec->automute = 1; |
| 2397 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2398 | } |
| 2399 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2400 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2401 | * ALC880 3-stack model |
| 2402 | * |
| 2403 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2404 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2405 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2406 | */ |
| 2407 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2408 | static hda_nid_t alc880_dac_nids[4] = { |
| 2409 | /* front, rear, clfe, rear_surr */ |
| 2410 | 0x02, 0x05, 0x04, 0x03 |
| 2411 | }; |
| 2412 | |
| 2413 | static hda_nid_t alc880_adc_nids[3] = { |
| 2414 | /* ADC0-2 */ |
| 2415 | 0x07, 0x08, 0x09, |
| 2416 | }; |
| 2417 | |
| 2418 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2419 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2420 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2421 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2422 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2423 | /* ADC1-2 */ |
| 2424 | 0x08, 0x09, |
| 2425 | }; |
| 2426 | |
| 2427 | #define ALC880_DIGOUT_NID 0x06 |
| 2428 | #define ALC880_DIGIN_NID 0x0a |
| 2429 | |
| 2430 | static struct hda_input_mux alc880_capture_source = { |
| 2431 | .num_items = 4, |
| 2432 | .items = { |
| 2433 | { "Mic", 0x0 }, |
| 2434 | { "Front Mic", 0x3 }, |
| 2435 | { "Line", 0x2 }, |
| 2436 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2437 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2438 | }; |
| 2439 | |
| 2440 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2441 | /* 2ch mode */ |
| 2442 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2443 | /* set line-in to input, mute it */ |
| 2444 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2445 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2446 | /* set mic-in to input vref 80%, mute it */ |
| 2447 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2448 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2449 | { } /* end */ |
| 2450 | }; |
| 2451 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2452 | /* 6ch mode */ |
| 2453 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2454 | /* set line-in to output, unmute it */ |
| 2455 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2456 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2457 | /* set mic-in to output, unmute it */ |
| 2458 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2459 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2460 | { } /* end */ |
| 2461 | }; |
| 2462 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2463 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2464 | { 2, alc880_threestack_ch2_init }, |
| 2465 | { 6, alc880_threestack_ch6_init }, |
| 2466 | }; |
| 2467 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2468 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2469 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2470 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2471 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2472 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2473 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2474 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2475 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2476 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2477 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2478 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2479 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2480 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2481 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2482 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2483 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2484 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2486 | { |
| 2487 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2488 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2489 | .info = alc_ch_mode_info, |
| 2490 | .get = alc_ch_mode_get, |
| 2491 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2492 | }, |
| 2493 | { } /* end */ |
| 2494 | }; |
| 2495 | |
| 2496 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2497 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2498 | struct snd_ctl_elem_info *uinfo) |
| 2499 | { |
| 2500 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2501 | struct alc_spec *spec = codec->spec; |
| 2502 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2503 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2504 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2505 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2506 | HDA_INPUT); |
| 2507 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2508 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2509 | return err; |
| 2510 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2512 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2513 | unsigned int size, unsigned int __user *tlv) |
| 2514 | { |
| 2515 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2516 | struct alc_spec *spec = codec->spec; |
| 2517 | int err; |
| 2518 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2519 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2520 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2521 | HDA_INPUT); |
| 2522 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2523 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2524 | return err; |
| 2525 | } |
| 2526 | |
| 2527 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2528 | struct snd_ctl_elem_value *ucontrol); |
| 2529 | |
| 2530 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2531 | struct snd_ctl_elem_value *ucontrol, |
| 2532 | getput_call_t func) |
| 2533 | { |
| 2534 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2535 | struct alc_spec *spec = codec->spec; |
| 2536 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2537 | int err; |
| 2538 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2539 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2540 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2541 | 3, 0, HDA_INPUT); |
| 2542 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2543 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2544 | return err; |
| 2545 | } |
| 2546 | |
| 2547 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2548 | struct snd_ctl_elem_value *ucontrol) |
| 2549 | { |
| 2550 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2551 | snd_hda_mixer_amp_volume_get); |
| 2552 | } |
| 2553 | |
| 2554 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2555 | struct snd_ctl_elem_value *ucontrol) |
| 2556 | { |
| 2557 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2558 | snd_hda_mixer_amp_volume_put); |
| 2559 | } |
| 2560 | |
| 2561 | /* capture mixer elements */ |
| 2562 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2563 | |
| 2564 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2565 | struct snd_ctl_elem_value *ucontrol) |
| 2566 | { |
| 2567 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2568 | snd_hda_mixer_amp_switch_get); |
| 2569 | } |
| 2570 | |
| 2571 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2572 | struct snd_ctl_elem_value *ucontrol) |
| 2573 | { |
| 2574 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2575 | snd_hda_mixer_amp_switch_put); |
| 2576 | } |
| 2577 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2578 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2579 | { \ |
| 2580 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2581 | .name = "Capture Switch", \ |
| 2582 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2583 | .count = num, \ |
| 2584 | .info = alc_cap_sw_info, \ |
| 2585 | .get = alc_cap_sw_get, \ |
| 2586 | .put = alc_cap_sw_put, \ |
| 2587 | }, \ |
| 2588 | { \ |
| 2589 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2590 | .name = "Capture Volume", \ |
| 2591 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2592 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2593 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2594 | .count = num, \ |
| 2595 | .info = alc_cap_vol_info, \ |
| 2596 | .get = alc_cap_vol_get, \ |
| 2597 | .put = alc_cap_vol_put, \ |
| 2598 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2599 | } |
| 2600 | |
| 2601 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2602 | { \ |
| 2603 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2604 | /* .name = "Capture Source", */ \ |
| 2605 | .name = "Input Source", \ |
| 2606 | .count = num, \ |
| 2607 | .info = alc_mux_enum_info, \ |
| 2608 | .get = alc_mux_enum_get, \ |
| 2609 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2610 | } |
| 2611 | |
| 2612 | #define DEFINE_CAPMIX(num) \ |
| 2613 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2614 | _DEFINE_CAPMIX(num), \ |
| 2615 | _DEFINE_CAPSRC(num), \ |
| 2616 | { } /* end */ \ |
| 2617 | } |
| 2618 | |
| 2619 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2620 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2621 | _DEFINE_CAPMIX(num), \ |
| 2622 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2623 | } |
| 2624 | |
| 2625 | /* up to three ADCs */ |
| 2626 | DEFINE_CAPMIX(1); |
| 2627 | DEFINE_CAPMIX(2); |
| 2628 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2629 | DEFINE_CAPMIX_NOSRC(1); |
| 2630 | DEFINE_CAPMIX_NOSRC(2); |
| 2631 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | |
| 2633 | /* |
| 2634 | * ALC880 5-stack model |
| 2635 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2636 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2637 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2638 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2639 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2640 | */ |
| 2641 | |
| 2642 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2643 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2644 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2645 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2646 | { } /* end */ |
| 2647 | }; |
| 2648 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2649 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2650 | /* 6ch mode */ |
| 2651 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2652 | /* set line-in to input, mute it */ |
| 2653 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2654 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2655 | { } /* end */ |
| 2656 | }; |
| 2657 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2658 | /* 8ch mode */ |
| 2659 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2660 | /* set line-in to output, unmute it */ |
| 2661 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2662 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2663 | { } /* end */ |
| 2664 | }; |
| 2665 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2666 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2667 | { 6, alc880_fivestack_ch6_init }, |
| 2668 | { 8, alc880_fivestack_ch8_init }, |
| 2669 | }; |
| 2670 | |
| 2671 | |
| 2672 | /* |
| 2673 | * ALC880 6-stack model |
| 2674 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2675 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2676 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2677 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2678 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2679 | */ |
| 2680 | |
| 2681 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2682 | /* front, rear, clfe, rear_surr */ |
| 2683 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2684 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2685 | |
| 2686 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2687 | .num_items = 4, |
| 2688 | .items = { |
| 2689 | { "Mic", 0x0 }, |
| 2690 | { "Front Mic", 0x1 }, |
| 2691 | { "Line", 0x2 }, |
| 2692 | { "CD", 0x4 }, |
| 2693 | }, |
| 2694 | }; |
| 2695 | |
| 2696 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2697 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2698 | { 8, NULL }, |
| 2699 | }; |
| 2700 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2701 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2702 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2703 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2704 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2705 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2706 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2707 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2708 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2709 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2710 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2711 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2712 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2713 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2714 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2715 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2716 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2717 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2718 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2719 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2720 | { |
| 2721 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2722 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2723 | .info = alc_ch_mode_info, |
| 2724 | .get = alc_ch_mode_get, |
| 2725 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2726 | }, |
| 2727 | { } /* end */ |
| 2728 | }; |
| 2729 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2730 | |
| 2731 | /* |
| 2732 | * ALC880 W810 model |
| 2733 | * |
| 2734 | * W810 has rear IO for: |
| 2735 | * Front (DAC 02) |
| 2736 | * Surround (DAC 03) |
| 2737 | * Center/LFE (DAC 04) |
| 2738 | * Digital out (06) |
| 2739 | * |
| 2740 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2741 | * 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] | 2742 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2743 | * There is a variable resistor to control the speaker or headphone |
| 2744 | * volume. This is a hardware-only device without a software API. |
| 2745 | * |
| 2746 | * Plugging headphones in will disable the internal speakers. This is |
| 2747 | * implemented in hardware, not via the driver using jack sense. In |
| 2748 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2749 | * disable both the speakers and headphones. |
| 2750 | * |
| 2751 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2752 | * These may not do anything useful with this driver yet, because I |
| 2753 | * haven't setup any initialization verbs for these yet... |
| 2754 | */ |
| 2755 | |
| 2756 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2757 | /* front, rear/surround, clfe */ |
| 2758 | 0x02, 0x03, 0x04 |
| 2759 | }; |
| 2760 | |
| 2761 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2762 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2763 | { 6, NULL } |
| 2764 | }; |
| 2765 | |
| 2766 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2767 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2768 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2769 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2770 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2771 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2772 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2773 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2774 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2775 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2776 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2777 | { } /* end */ |
| 2778 | }; |
| 2779 | |
| 2780 | |
| 2781 | /* |
| 2782 | * Z710V model |
| 2783 | * |
| 2784 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2785 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2786 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2787 | */ |
| 2788 | |
| 2789 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2790 | 0x02 |
| 2791 | }; |
| 2792 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2793 | |
| 2794 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2795 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2796 | { 2, NULL } |
| 2797 | }; |
| 2798 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2799 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2801 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2802 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2803 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2808 | { } /* end */ |
| 2809 | }; |
| 2810 | |
| 2811 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2812 | /* |
| 2813 | * ALC880 F1734 model |
| 2814 | * |
| 2815 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2816 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2817 | */ |
| 2818 | |
| 2819 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2820 | 0x03 |
| 2821 | }; |
| 2822 | #define ALC880_F1734_HP_DAC 0x02 |
| 2823 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2824 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2825 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2826 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2827 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2828 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2829 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2830 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2831 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2832 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2833 | { } /* end */ |
| 2834 | }; |
| 2835 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2836 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2837 | .num_items = 2, |
| 2838 | .items = { |
| 2839 | { "Mic", 0x1 }, |
| 2840 | { "CD", 0x4 }, |
| 2841 | }, |
| 2842 | }; |
| 2843 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2844 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2845 | /* |
| 2846 | * ALC880 ASUS model |
| 2847 | * |
| 2848 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2849 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2850 | * Mic = 0x18, Line = 0x1a |
| 2851 | */ |
| 2852 | |
| 2853 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2854 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2855 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2856 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2857 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2858 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2859 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2860 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2861 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2862 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2863 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2864 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2865 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2866 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2867 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2868 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2869 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2870 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2871 | { |
| 2872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2873 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2874 | .info = alc_ch_mode_info, |
| 2875 | .get = alc_ch_mode_get, |
| 2876 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2877 | }, |
| 2878 | { } /* end */ |
| 2879 | }; |
| 2880 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2881 | /* |
| 2882 | * ALC880 ASUS W1V model |
| 2883 | * |
| 2884 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2885 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2886 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2887 | */ |
| 2888 | |
| 2889 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2890 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2891 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2892 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2893 | { } /* end */ |
| 2894 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2895 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2896 | /* TCL S700 */ |
| 2897 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2898 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2899 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2900 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2901 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2902 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2905 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2906 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2907 | { } /* end */ |
| 2908 | }; |
| 2909 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2910 | /* Uniwill */ |
| 2911 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2912 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2913 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2915 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2916 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2917 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2918 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2919 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2920 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2921 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2923 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2926 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2927 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2928 | { |
| 2929 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2930 | .name = "Channel Mode", |
| 2931 | .info = alc_ch_mode_info, |
| 2932 | .get = alc_ch_mode_get, |
| 2933 | .put = alc_ch_mode_put, |
| 2934 | }, |
| 2935 | { } /* end */ |
| 2936 | }; |
| 2937 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2938 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2939 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2940 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2941 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2942 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2943 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2944 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2945 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2946 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2947 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2948 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2949 | { } /* end */ |
| 2950 | }; |
| 2951 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2952 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2953 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2954 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2955 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2956 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2959 | { } /* end */ |
| 2960 | }; |
| 2961 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2962 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2963 | * virtual master controls |
| 2964 | */ |
| 2965 | |
| 2966 | /* |
| 2967 | * slave controls for virtual master |
| 2968 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2969 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2970 | "Front Playback Volume", |
| 2971 | "Surround Playback Volume", |
| 2972 | "Center Playback Volume", |
| 2973 | "LFE Playback Volume", |
| 2974 | "Side Playback Volume", |
| 2975 | "Headphone Playback Volume", |
| 2976 | "Speaker Playback Volume", |
| 2977 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2978 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2979 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2980 | NULL, |
| 2981 | }; |
| 2982 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2983 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2984 | "Front Playback Switch", |
| 2985 | "Surround Playback Switch", |
| 2986 | "Center Playback Switch", |
| 2987 | "LFE Playback Switch", |
| 2988 | "Side Playback Switch", |
| 2989 | "Headphone Playback Switch", |
| 2990 | "Speaker Playback Switch", |
| 2991 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2992 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2993 | "Line-Out Playback Switch", |
| 2994 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2995 | NULL, |
| 2996 | }; |
| 2997 | |
| 2998 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2999 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3000 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3001 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3002 | #define NID_MAPPING (-1) |
| 3003 | |
| 3004 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 3005 | #define SUBDEV_HP_ (1 << 6) |
| 3006 | #define SUBDEV_LINE_ (2 << 6) |
| 3007 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 3008 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 3009 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 3010 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3011 | static void alc_free_kctls(struct hda_codec *codec); |
| 3012 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3013 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3014 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 3015 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 3016 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3017 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3018 | { } /* end */ |
| 3019 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3020 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3021 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3022 | static int alc_build_controls(struct hda_codec *codec) |
| 3023 | { |
| 3024 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 3025 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3026 | struct snd_kcontrol_new *knew; |
| 3027 | int i, j, err; |
| 3028 | unsigned int u; |
| 3029 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3030 | |
| 3031 | for (i = 0; i < spec->num_mixers; i++) { |
| 3032 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3033 | if (err < 0) |
| 3034 | return err; |
| 3035 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3036 | if (spec->cap_mixer) { |
| 3037 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3038 | if (err < 0) |
| 3039 | return err; |
| 3040 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3041 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3042 | err = snd_hda_create_spdif_out_ctls(codec, |
| 3043 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3044 | if (err < 0) |
| 3045 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3046 | if (!spec->no_analog) { |
| 3047 | err = snd_hda_create_spdif_share_sw(codec, |
| 3048 | &spec->multiout); |
| 3049 | if (err < 0) |
| 3050 | return err; |
| 3051 | spec->multiout.share_spdif = 1; |
| 3052 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3053 | } |
| 3054 | if (spec->dig_in_nid) { |
| 3055 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3056 | if (err < 0) |
| 3057 | return err; |
| 3058 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3059 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3060 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3061 | /* create beep controls if needed */ |
| 3062 | if (spec->beep_amp) { |
| 3063 | struct snd_kcontrol_new *knew; |
| 3064 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3065 | struct snd_kcontrol *kctl; |
| 3066 | kctl = snd_ctl_new1(knew, codec); |
| 3067 | if (!kctl) |
| 3068 | return -ENOMEM; |
| 3069 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3070 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3071 | if (err < 0) |
| 3072 | return err; |
| 3073 | } |
| 3074 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3075 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3076 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3077 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3078 | if (!spec->no_analog && |
| 3079 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3080 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3081 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3082 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3083 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3084 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3085 | if (err < 0) |
| 3086 | return err; |
| 3087 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3088 | if (!spec->no_analog && |
| 3089 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3090 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3091 | NULL, alc_slave_sws); |
| 3092 | if (err < 0) |
| 3093 | return err; |
| 3094 | } |
| 3095 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3096 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3097 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3098 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3099 | if (!kctl) |
| 3100 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3101 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3102 | hda_nid_t *nids = spec->capsrc_nids; |
| 3103 | if (!nids) |
| 3104 | nids = spec->adc_nids; |
| 3105 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3106 | if (err < 0) |
| 3107 | return err; |
| 3108 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3109 | } |
| 3110 | if (spec->cap_mixer) { |
| 3111 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3112 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3113 | if (kname && strcmp(knew->name, kname) == 0) |
| 3114 | continue; |
| 3115 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3116 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3117 | err = snd_hda_add_nid(codec, kctl, i, |
| 3118 | spec->adc_nids[i]); |
| 3119 | if (err < 0) |
| 3120 | return err; |
| 3121 | } |
| 3122 | } |
| 3123 | } |
| 3124 | |
| 3125 | /* other nid->control mapping */ |
| 3126 | for (i = 0; i < spec->num_mixers; i++) { |
| 3127 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3128 | if (knew->iface != NID_MAPPING) |
| 3129 | continue; |
| 3130 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3131 | if (kctl == NULL) |
| 3132 | continue; |
| 3133 | u = knew->subdevice; |
| 3134 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3135 | nid = u & 0x3f; |
| 3136 | if (nid == 0) |
| 3137 | continue; |
| 3138 | switch (u & 0xc0) { |
| 3139 | case SUBDEV_SPEAKER_: |
| 3140 | nid = spec->autocfg.speaker_pins[nid]; |
| 3141 | break; |
| 3142 | case SUBDEV_LINE_: |
| 3143 | nid = spec->autocfg.line_out_pins[nid]; |
| 3144 | break; |
| 3145 | case SUBDEV_HP_: |
| 3146 | nid = spec->autocfg.hp_pins[nid]; |
| 3147 | break; |
| 3148 | default: |
| 3149 | continue; |
| 3150 | } |
| 3151 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3152 | if (err < 0) |
| 3153 | return err; |
| 3154 | } |
| 3155 | u = knew->private_value; |
| 3156 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3157 | nid = u & 0xff; |
| 3158 | if (nid == 0) |
| 3159 | continue; |
| 3160 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3161 | if (err < 0) |
| 3162 | return err; |
| 3163 | } |
| 3164 | } |
| 3165 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3166 | |
| 3167 | alc_free_kctls(codec); /* no longer needed */ |
| 3168 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3169 | return 0; |
| 3170 | } |
| 3171 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3173 | /* |
| 3174 | * initialize the codec volumes, etc |
| 3175 | */ |
| 3176 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3177 | /* |
| 3178 | * generic initialization of ADC, input mixers and output mixers |
| 3179 | */ |
| 3180 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 3181 | /* |
| 3182 | * Unmute ADC0-2 and set the default input to mic-in |
| 3183 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3184 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3185 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3186 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3187 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3188 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3189 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3190 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3191 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3192 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3193 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3194 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3195 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3196 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3197 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3198 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3200 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3204 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3205 | /* |
| 3206 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3207 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3208 | /* set vol=0 to output mixers */ |
| 3209 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3210 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3212 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3213 | /* set up input amps for analog loopback */ |
| 3214 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3216 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3217 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3218 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3219 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3220 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3221 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3222 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3223 | |
| 3224 | { } |
| 3225 | }; |
| 3226 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3227 | /* |
| 3228 | * 3-stack pin configuration: |
| 3229 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3230 | */ |
| 3231 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 3232 | /* |
| 3233 | * preset connection lists of input pins |
| 3234 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3235 | */ |
| 3236 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3237 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3238 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3239 | |
| 3240 | /* |
| 3241 | * Set pin mode and muting |
| 3242 | */ |
| 3243 | /* set front pin widgets 0x14 for output */ |
| 3244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3245 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3246 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3247 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3248 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3249 | /* Mic2 (as headphone out) for HP output */ |
| 3250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3251 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3252 | /* Line In pin widget for input */ |
| 3253 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3254 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3255 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3256 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3257 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3258 | /* CD pin widget for input */ |
| 3259 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3260 | |
| 3261 | { } |
| 3262 | }; |
| 3263 | |
| 3264 | /* |
| 3265 | * 5-stack pin configuration: |
| 3266 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3267 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3268 | */ |
| 3269 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 3270 | /* |
| 3271 | * preset connection lists of input pins |
| 3272 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3273 | */ |
| 3274 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3275 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3276 | |
| 3277 | /* |
| 3278 | * Set pin mode and muting |
| 3279 | */ |
| 3280 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3281 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3283 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3284 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3285 | /* unmute pins for output (no gain on this amp) */ |
| 3286 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3288 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3289 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3291 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3292 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3293 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3294 | /* Mic2 (as headphone out) for HP output */ |
| 3295 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3296 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3297 | /* Line In pin widget for input */ |
| 3298 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3299 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3300 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3301 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3302 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3303 | /* CD pin widget for input */ |
| 3304 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3305 | |
| 3306 | { } |
| 3307 | }; |
| 3308 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | /* |
| 3310 | * W810 pin configuration: |
| 3311 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3312 | */ |
| 3313 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3314 | /* hphone/speaker input selector: front DAC */ |
| 3315 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3316 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3317 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3318 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3319 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3320 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3321 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3322 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3323 | |
| 3324 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3325 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3326 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3327 | { } |
| 3328 | }; |
| 3329 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3330 | /* |
| 3331 | * Z71V pin configuration: |
| 3332 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3333 | */ |
| 3334 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3336 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3337 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3338 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3339 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3340 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3341 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3342 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3343 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3344 | |
| 3345 | { } |
| 3346 | }; |
| 3347 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3348 | /* |
| 3349 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3350 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3351 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3352 | */ |
| 3353 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 3354 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3355 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3357 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3359 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3360 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3361 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3362 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3363 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3364 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3365 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3367 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3368 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3369 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3370 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3371 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3372 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3373 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3374 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3375 | { } |
| 3376 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3377 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3378 | /* |
| 3379 | * Uniwill pin configuration: |
| 3380 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3381 | * line = 0x1a |
| 3382 | */ |
| 3383 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3384 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3385 | |
| 3386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3387 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3388 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3390 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3391 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3392 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3393 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3395 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3396 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3399 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3400 | |
| 3401 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3402 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3403 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3404 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3405 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3406 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3407 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3408 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3409 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3410 | |
| 3411 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3412 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3413 | |
| 3414 | { } |
| 3415 | }; |
| 3416 | |
| 3417 | /* |
| 3418 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3419 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3420 | */ |
| 3421 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3422 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3423 | |
| 3424 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3425 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3426 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3427 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3428 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3429 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3432 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3433 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3435 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3436 | |
| 3437 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3439 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3440 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3441 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3442 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3443 | |
| 3444 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3445 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3446 | |
| 3447 | { } |
| 3448 | }; |
| 3449 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3450 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3451 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3452 | { } |
| 3453 | }; |
| 3454 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3455 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3456 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3457 | { |
| 3458 | unsigned int present; |
| 3459 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3460 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3461 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3462 | bits = present ? HDA_AMP_MUTE : 0; |
| 3463 | 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] | 3464 | } |
| 3465 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3466 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3467 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3468 | struct alc_spec *spec = codec->spec; |
| 3469 | |
| 3470 | spec->autocfg.hp_pins[0] = 0x14; |
| 3471 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3472 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3473 | spec->automute = 1; |
| 3474 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3475 | } |
| 3476 | |
| 3477 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3478 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3479 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3480 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3481 | } |
| 3482 | |
| 3483 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3484 | unsigned int res) |
| 3485 | { |
| 3486 | /* Looks like the unsol event is incompatible with the standard |
| 3487 | * definition. 4bit tag is placed at 28 bit! |
| 3488 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3489 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3490 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3491 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3492 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3493 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3494 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3495 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3496 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3497 | } |
| 3498 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3499 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3500 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3501 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3502 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3503 | spec->autocfg.hp_pins[0] = 0x14; |
| 3504 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3505 | spec->automute = 1; |
| 3506 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3507 | } |
| 3508 | |
| 3509 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3510 | { |
| 3511 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3512 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3513 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3514 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3515 | present &= HDA_AMP_VOLMASK; |
| 3516 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3517 | HDA_AMP_VOLMASK, present); |
| 3518 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3519 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3520 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3521 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3522 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3523 | unsigned int res) |
| 3524 | { |
| 3525 | /* Looks like the unsol event is incompatible with the standard |
| 3526 | * definition. 4bit tag is placed at 28 bit! |
| 3527 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3528 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3529 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3530 | else |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3531 | alc_sku_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3532 | } |
| 3533 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3534 | /* |
| 3535 | * F1734 pin configuration: |
| 3536 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3537 | */ |
| 3538 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3539 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3540 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3541 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3542 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3543 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3544 | |
| 3545 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3546 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3547 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3548 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3549 | |
| 3550 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3551 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3552 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3553 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3554 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3555 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3556 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3557 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3558 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3559 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3560 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3561 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3562 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3563 | { } |
| 3564 | }; |
| 3565 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3566 | /* |
| 3567 | * ASUS pin configuration: |
| 3568 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3569 | */ |
| 3570 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3571 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3572 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3573 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3574 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3575 | |
| 3576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3577 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3578 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3579 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3580 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3581 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3582 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3583 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3584 | |
| 3585 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3586 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3587 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3588 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3589 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3590 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3591 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3593 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3594 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3595 | { } |
| 3596 | }; |
| 3597 | |
| 3598 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3599 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3600 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3601 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3602 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3603 | /* Clevo m520g init */ |
| 3604 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3605 | /* headphone output */ |
| 3606 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3607 | /* line-out */ |
| 3608 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3609 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3610 | /* Line-in */ |
| 3611 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3612 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3613 | /* CD */ |
| 3614 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3615 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3616 | /* Mic1 (rear panel) */ |
| 3617 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3618 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3619 | /* Mic2 (front panel) */ |
| 3620 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3621 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3622 | /* headphone */ |
| 3623 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3624 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3625 | /* change to EAPD mode */ |
| 3626 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3627 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3628 | |
| 3629 | { } |
| 3630 | }; |
| 3631 | |
| 3632 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3633 | /* change to EAPD mode */ |
| 3634 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3635 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3636 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3637 | /* Headphone output */ |
| 3638 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3639 | /* Front output*/ |
| 3640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3641 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3642 | |
| 3643 | /* Line In pin widget for input */ |
| 3644 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3645 | /* CD pin widget for input */ |
| 3646 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3647 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3648 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3649 | |
| 3650 | /* change to EAPD mode */ |
| 3651 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3652 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3653 | |
| 3654 | { } |
| 3655 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3656 | |
| 3657 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3658 | * LG m1 express dual |
| 3659 | * |
| 3660 | * Pin assignment: |
| 3661 | * Rear Line-In/Out (blue): 0x14 |
| 3662 | * Build-in Mic-In: 0x15 |
| 3663 | * Speaker-out: 0x17 |
| 3664 | * HP-Out (green): 0x1b |
| 3665 | * Mic-In/Out (red): 0x19 |
| 3666 | * SPDIF-Out: 0x1e |
| 3667 | */ |
| 3668 | |
| 3669 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3670 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3671 | 0x05, 0x02, 0x03 |
| 3672 | }; |
| 3673 | |
| 3674 | /* seems analog CD is not working */ |
| 3675 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3676 | .num_items = 3, |
| 3677 | .items = { |
| 3678 | { "Mic", 0x1 }, |
| 3679 | { "Line", 0x5 }, |
| 3680 | { "Internal Mic", 0x6 }, |
| 3681 | }, |
| 3682 | }; |
| 3683 | |
| 3684 | /* 2,4,6 channel modes */ |
| 3685 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3686 | /* set line-in and mic-in to input */ |
| 3687 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3688 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3689 | { } |
| 3690 | }; |
| 3691 | |
| 3692 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3693 | /* set line-in to out and mic-in to input */ |
| 3694 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3695 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3696 | { } |
| 3697 | }; |
| 3698 | |
| 3699 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3700 | /* set line-in and mic-in to output */ |
| 3701 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3702 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3703 | { } |
| 3704 | }; |
| 3705 | |
| 3706 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3707 | { 2, alc880_lg_ch2_init }, |
| 3708 | { 4, alc880_lg_ch4_init }, |
| 3709 | { 6, alc880_lg_ch6_init }, |
| 3710 | }; |
| 3711 | |
| 3712 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3713 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3714 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3715 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3716 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3717 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3718 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3719 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3720 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3722 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3723 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3724 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3725 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3726 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3727 | { |
| 3728 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3729 | .name = "Channel Mode", |
| 3730 | .info = alc_ch_mode_info, |
| 3731 | .get = alc_ch_mode_get, |
| 3732 | .put = alc_ch_mode_put, |
| 3733 | }, |
| 3734 | { } /* end */ |
| 3735 | }; |
| 3736 | |
| 3737 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3738 | /* set capture source to mic-in */ |
| 3739 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3740 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3741 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3742 | /* mute all amp mixer inputs */ |
| 3743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3746 | /* line-in to input */ |
| 3747 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3748 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3749 | /* built-in mic */ |
| 3750 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3752 | /* speaker-out */ |
| 3753 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3754 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3755 | /* mic-in to input */ |
| 3756 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3757 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3758 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3759 | /* HP-out */ |
| 3760 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3761 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3762 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3763 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3764 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3765 | { } |
| 3766 | }; |
| 3767 | |
| 3768 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3769 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3770 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3771 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3772 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3773 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3774 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3775 | spec->automute = 1; |
| 3776 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3777 | } |
| 3778 | |
| 3779 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3780 | * LG LW20 |
| 3781 | * |
| 3782 | * Pin assignment: |
| 3783 | * Speaker-out: 0x14 |
| 3784 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3785 | * Built-in Mic-In: 0x19 |
| 3786 | * Line-In: 0x1b |
| 3787 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3788 | * SPDIF-Out: 0x1e |
| 3789 | */ |
| 3790 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3791 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3792 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3793 | .items = { |
| 3794 | { "Mic", 0x0 }, |
| 3795 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3796 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3797 | }, |
| 3798 | }; |
| 3799 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3800 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3801 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3802 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3803 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3804 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3805 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3806 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3807 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3808 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3809 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3810 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3811 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3812 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3813 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3814 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3815 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3816 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3817 | { |
| 3818 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3819 | .name = "Channel Mode", |
| 3820 | .info = alc_ch_mode_info, |
| 3821 | .get = alc_ch_mode_get, |
| 3822 | .put = alc_ch_mode_put, |
| 3823 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3824 | { } /* end */ |
| 3825 | }; |
| 3826 | |
| 3827 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3828 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3829 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3830 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3831 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3832 | /* set capture source to mic-in */ |
| 3833 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3835 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3837 | /* speaker-out */ |
| 3838 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3839 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3840 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3841 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3842 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3843 | /* mic-in to input */ |
| 3844 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3845 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3846 | /* built-in mic */ |
| 3847 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3849 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3850 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3851 | { } |
| 3852 | }; |
| 3853 | |
| 3854 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3855 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3856 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3857 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3858 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3859 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3860 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3861 | spec->automute = 1; |
| 3862 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3863 | } |
| 3864 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3865 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3866 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3867 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3868 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3869 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3870 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3871 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3872 | { } /* end */ |
| 3873 | }; |
| 3874 | |
| 3875 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3876 | .num_items = 2, |
| 3877 | .items = { |
| 3878 | { "Mic", 0x0 }, |
| 3879 | { "Internal Mic", 0x1 }, |
| 3880 | }, |
| 3881 | }; |
| 3882 | |
| 3883 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3884 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3885 | |
| 3886 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3887 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3888 | |
| 3889 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3890 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3891 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3892 | /* Mic2 (as headphone out) for HP output */ |
| 3893 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3894 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3895 | /* Internal Speaker */ |
| 3896 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3897 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3898 | |
| 3899 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3900 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3901 | |
| 3902 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3903 | { } |
| 3904 | }; |
| 3905 | |
| 3906 | /* toggle speaker-output according to the hp-jack state */ |
| 3907 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3908 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3909 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3910 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3911 | /* toggle EAPD */ |
| 3912 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3913 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3914 | else |
| 3915 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3916 | } |
| 3917 | |
| 3918 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3919 | unsigned int res) |
| 3920 | { |
| 3921 | /* Looks like the unsol event is incompatible with the standard |
| 3922 | * definition. 4bit tag is placed at 28 bit! |
| 3923 | */ |
| 3924 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3925 | alc880_medion_rim_automute(codec); |
| 3926 | } |
| 3927 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3928 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3929 | { |
| 3930 | struct alc_spec *spec = codec->spec; |
| 3931 | |
| 3932 | spec->autocfg.hp_pins[0] = 0x14; |
| 3933 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3934 | spec->automute = 1; |
| 3935 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3936 | } |
| 3937 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3938 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3939 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3940 | { 0x0b, HDA_INPUT, 0 }, |
| 3941 | { 0x0b, HDA_INPUT, 1 }, |
| 3942 | { 0x0b, HDA_INPUT, 2 }, |
| 3943 | { 0x0b, HDA_INPUT, 3 }, |
| 3944 | { 0x0b, HDA_INPUT, 4 }, |
| 3945 | { } /* end */ |
| 3946 | }; |
| 3947 | |
| 3948 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3949 | { 0x0b, HDA_INPUT, 1 }, |
| 3950 | { 0x0b, HDA_INPUT, 6 }, |
| 3951 | { 0x0b, HDA_INPUT, 7 }, |
| 3952 | { } /* end */ |
| 3953 | }; |
| 3954 | #endif |
| 3955 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3956 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3957 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3958 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3959 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3960 | static void alc_init_special_input_src(struct hda_codec *codec); |
| 3961 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3962 | static int alc_init(struct hda_codec *codec) |
| 3963 | { |
| 3964 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3965 | unsigned int i; |
| 3966 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3967 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3968 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3969 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3970 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3971 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 3972 | alc_init_special_input_src(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3973 | |
| 3974 | if (spec->init_hook) |
| 3975 | spec->init_hook(codec); |
| 3976 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 3977 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 3978 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 3979 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3980 | return 0; |
| 3981 | } |
| 3982 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3983 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3984 | { |
| 3985 | struct alc_spec *spec = codec->spec; |
| 3986 | |
| 3987 | if (spec->unsol_event) |
| 3988 | spec->unsol_event(codec, res); |
| 3989 | } |
| 3990 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3991 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3992 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3993 | { |
| 3994 | struct alc_spec *spec = codec->spec; |
| 3995 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3996 | } |
| 3997 | #endif |
| 3998 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3999 | /* |
| 4000 | * Analog playback callbacks |
| 4001 | */ |
| 4002 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4003 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4004 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4005 | { |
| 4006 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 4007 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 4008 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4009 | } |
| 4010 | |
| 4011 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4012 | struct hda_codec *codec, |
| 4013 | unsigned int stream_tag, |
| 4014 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4015 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4016 | { |
| 4017 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4018 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 4019 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4020 | } |
| 4021 | |
| 4022 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4023 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4024 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4025 | { |
| 4026 | struct alc_spec *spec = codec->spec; |
| 4027 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 4028 | } |
| 4029 | |
| 4030 | /* |
| 4031 | * Digital out |
| 4032 | */ |
| 4033 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4034 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4035 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4036 | { |
| 4037 | struct alc_spec *spec = codec->spec; |
| 4038 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 4039 | } |
| 4040 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4041 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4042 | struct hda_codec *codec, |
| 4043 | unsigned int stream_tag, |
| 4044 | unsigned int format, |
| 4045 | struct snd_pcm_substream *substream) |
| 4046 | { |
| 4047 | struct alc_spec *spec = codec->spec; |
| 4048 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 4049 | stream_tag, format, substream); |
| 4050 | } |
| 4051 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4052 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4053 | struct hda_codec *codec, |
| 4054 | struct snd_pcm_substream *substream) |
| 4055 | { |
| 4056 | struct alc_spec *spec = codec->spec; |
| 4057 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 4058 | } |
| 4059 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4060 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 4061 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4062 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4063 | { |
| 4064 | struct alc_spec *spec = codec->spec; |
| 4065 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4066 | } |
| 4067 | |
| 4068 | /* |
| 4069 | * Analog capture |
| 4070 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4071 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4072 | struct hda_codec *codec, |
| 4073 | unsigned int stream_tag, |
| 4074 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4075 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4076 | { |
| 4077 | struct alc_spec *spec = codec->spec; |
| 4078 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4079 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4080 | stream_tag, 0, format); |
| 4081 | return 0; |
| 4082 | } |
| 4083 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4084 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4085 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4086 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4087 | { |
| 4088 | struct alc_spec *spec = codec->spec; |
| 4089 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4090 | snd_hda_codec_cleanup_stream(codec, |
| 4091 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4092 | return 0; |
| 4093 | } |
| 4094 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4095 | /* analog capture with dynamic dual-adc changes */ |
| 4096 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4097 | struct hda_codec *codec, |
| 4098 | unsigned int stream_tag, |
| 4099 | unsigned int format, |
| 4100 | struct snd_pcm_substream *substream) |
| 4101 | { |
| 4102 | struct alc_spec *spec = codec->spec; |
| 4103 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4104 | spec->cur_adc_stream_tag = stream_tag; |
| 4105 | spec->cur_adc_format = format; |
| 4106 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4107 | return 0; |
| 4108 | } |
| 4109 | |
| 4110 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4111 | struct hda_codec *codec, |
| 4112 | struct snd_pcm_substream *substream) |
| 4113 | { |
| 4114 | struct alc_spec *spec = codec->spec; |
| 4115 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4116 | spec->cur_adc = 0; |
| 4117 | return 0; |
| 4118 | } |
| 4119 | |
| 4120 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 4121 | .substreams = 1, |
| 4122 | .channels_min = 2, |
| 4123 | .channels_max = 2, |
| 4124 | .nid = 0, /* fill later */ |
| 4125 | .ops = { |
| 4126 | .prepare = dualmic_capture_pcm_prepare, |
| 4127 | .cleanup = dualmic_capture_pcm_cleanup |
| 4128 | }, |
| 4129 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4130 | |
| 4131 | /* |
| 4132 | */ |
| 4133 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 4134 | .substreams = 1, |
| 4135 | .channels_min = 2, |
| 4136 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4137 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4138 | .ops = { |
| 4139 | .open = alc880_playback_pcm_open, |
| 4140 | .prepare = alc880_playback_pcm_prepare, |
| 4141 | .cleanup = alc880_playback_pcm_cleanup |
| 4142 | }, |
| 4143 | }; |
| 4144 | |
| 4145 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4146 | .substreams = 1, |
| 4147 | .channels_min = 2, |
| 4148 | .channels_max = 2, |
| 4149 | /* NID is set in alc_build_pcms */ |
| 4150 | }; |
| 4151 | |
| 4152 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 4153 | .substreams = 1, |
| 4154 | .channels_min = 2, |
| 4155 | .channels_max = 2, |
| 4156 | /* NID is set in alc_build_pcms */ |
| 4157 | }; |
| 4158 | |
| 4159 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 4160 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4161 | .channels_min = 2, |
| 4162 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4163 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4164 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4165 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4166 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4167 | }, |
| 4168 | }; |
| 4169 | |
| 4170 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 4171 | .substreams = 1, |
| 4172 | .channels_min = 2, |
| 4173 | .channels_max = 2, |
| 4174 | /* NID is set in alc_build_pcms */ |
| 4175 | .ops = { |
| 4176 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4177 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4178 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4179 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4180 | }, |
| 4181 | }; |
| 4182 | |
| 4183 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 4184 | .substreams = 1, |
| 4185 | .channels_min = 2, |
| 4186 | .channels_max = 2, |
| 4187 | /* NID is set in alc_build_pcms */ |
| 4188 | }; |
| 4189 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4190 | /* 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] | 4191 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4192 | .substreams = 0, |
| 4193 | .channels_min = 0, |
| 4194 | .channels_max = 0, |
| 4195 | }; |
| 4196 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4197 | static int alc_build_pcms(struct hda_codec *codec) |
| 4198 | { |
| 4199 | struct alc_spec *spec = codec->spec; |
| 4200 | struct hda_pcm *info = spec->pcm_rec; |
| 4201 | int i; |
| 4202 | |
| 4203 | codec->num_pcms = 1; |
| 4204 | codec->pcm_info = info; |
| 4205 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4206 | if (spec->no_analog) |
| 4207 | goto skip_analog; |
| 4208 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4209 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4210 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4211 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4212 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4213 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4214 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4215 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4216 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4217 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4218 | } |
| 4219 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4220 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4221 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4222 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4223 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4224 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4225 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4226 | if (spec->channel_mode) { |
| 4227 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4228 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4229 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4230 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4231 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4232 | } |
| 4233 | } |
| 4234 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4235 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4236 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4237 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4238 | snprintf(spec->stream_name_digital, |
| 4239 | sizeof(spec->stream_name_digital), |
| 4240 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4241 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4242 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4243 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4244 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4245 | if (spec->dig_out_type) |
| 4246 | info->pcm_type = spec->dig_out_type; |
| 4247 | else |
| 4248 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4249 | if (spec->multiout.dig_out_nid && |
| 4250 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4251 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4252 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4253 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4254 | if (spec->dig_in_nid && |
| 4255 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4256 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4257 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4258 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4259 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4260 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4261 | } |
| 4262 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4263 | if (spec->no_analog) |
| 4264 | return 0; |
| 4265 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4266 | /* If the use of more than one ADC is requested for the current |
| 4267 | * model, configure a second analog capture-only PCM. |
| 4268 | */ |
| 4269 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4270 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4271 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4272 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4273 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4274 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4275 | if (spec->alt_dac_nid) { |
| 4276 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4277 | *spec->stream_analog_alt_playback; |
| 4278 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4279 | spec->alt_dac_nid; |
| 4280 | } else { |
| 4281 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4282 | alc_pcm_null_stream; |
| 4283 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4284 | } |
| 4285 | if (spec->num_adc_nids > 1) { |
| 4286 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4287 | *spec->stream_analog_alt_capture; |
| 4288 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4289 | spec->adc_nids[1]; |
| 4290 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4291 | spec->num_adc_nids - 1; |
| 4292 | } else { |
| 4293 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4294 | alc_pcm_null_stream; |
| 4295 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4296 | } |
| 4297 | } |
| 4298 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4299 | return 0; |
| 4300 | } |
| 4301 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4302 | static inline void alc_shutup(struct hda_codec *codec) |
| 4303 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4304 | struct alc_spec *spec = codec->spec; |
| 4305 | |
| 4306 | if (spec && spec->shutup) |
| 4307 | spec->shutup(codec); |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4308 | snd_hda_shutup_pins(codec); |
| 4309 | } |
| 4310 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4311 | static void alc_free_kctls(struct hda_codec *codec) |
| 4312 | { |
| 4313 | struct alc_spec *spec = codec->spec; |
| 4314 | |
| 4315 | if (spec->kctls.list) { |
| 4316 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4317 | int i; |
| 4318 | for (i = 0; i < spec->kctls.used; i++) |
| 4319 | kfree(kctl[i].name); |
| 4320 | } |
| 4321 | snd_array_free(&spec->kctls); |
| 4322 | } |
| 4323 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4324 | static void alc_free(struct hda_codec *codec) |
| 4325 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4326 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4328 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4329 | return; |
| 4330 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4331 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4332 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4333 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4334 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4335 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4336 | } |
| 4337 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4338 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4339 | static void alc_power_eapd(struct hda_codec *codec) |
| 4340 | { |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 4341 | alc_auto_setup_eapd(codec, false); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4342 | } |
| 4343 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4344 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4345 | { |
| 4346 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4347 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4348 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4349 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4350 | return 0; |
| 4351 | } |
| 4352 | #endif |
| 4353 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4354 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4355 | static int alc_resume(struct hda_codec *codec) |
| 4356 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4357 | msleep(150); /* to avoid pop noise */ |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4358 | codec->patch_ops.init(codec); |
| 4359 | snd_hda_codec_resume_amp(codec); |
| 4360 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4361 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4362 | return 0; |
| 4363 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4364 | #endif |
| 4365 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4366 | /* |
| 4367 | */ |
| 4368 | static struct hda_codec_ops alc_patch_ops = { |
| 4369 | .build_controls = alc_build_controls, |
| 4370 | .build_pcms = alc_build_pcms, |
| 4371 | .init = alc_init, |
| 4372 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4373 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4374 | #ifdef SND_HDA_NEEDS_RESUME |
| 4375 | .resume = alc_resume, |
| 4376 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4377 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4378 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4379 | .check_power_status = alc_check_power_status, |
| 4380 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4381 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4382 | }; |
| 4383 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4384 | /* replace the codec chip_name with the given string */ |
| 4385 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4386 | { |
| 4387 | kfree(codec->chip_name); |
| 4388 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4389 | if (!codec->chip_name) { |
| 4390 | alc_free(codec); |
| 4391 | return -ENOMEM; |
| 4392 | } |
| 4393 | return 0; |
| 4394 | } |
| 4395 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4396 | /* |
| 4397 | * Test configuration for debugging |
| 4398 | * |
| 4399 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4400 | * enum controls. |
| 4401 | */ |
| 4402 | #ifdef CONFIG_SND_DEBUG |
| 4403 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4404 | 0x02, 0x03, 0x04, 0x05 |
| 4405 | }; |
| 4406 | |
| 4407 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4408 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4409 | .items = { |
| 4410 | { "In-1", 0x0 }, |
| 4411 | { "In-2", 0x1 }, |
| 4412 | { "In-3", 0x2 }, |
| 4413 | { "In-4", 0x3 }, |
| 4414 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4415 | { "Front", 0x5 }, |
| 4416 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4417 | }, |
| 4418 | }; |
| 4419 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4420 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4421 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4422 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4423 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4424 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4425 | }; |
| 4426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4427 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4428 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4429 | { |
| 4430 | static char *texts[] = { |
| 4431 | "N/A", "Line Out", "HP Out", |
| 4432 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4433 | }; |
| 4434 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4435 | uinfo->count = 1; |
| 4436 | uinfo->value.enumerated.items = 8; |
| 4437 | if (uinfo->value.enumerated.item >= 8) |
| 4438 | uinfo->value.enumerated.item = 7; |
| 4439 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4440 | return 0; |
| 4441 | } |
| 4442 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4443 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4444 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4445 | { |
| 4446 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4447 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4448 | unsigned int pin_ctl, item = 0; |
| 4449 | |
| 4450 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4451 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4452 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4453 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4454 | item = 2; |
| 4455 | else |
| 4456 | item = 1; |
| 4457 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4458 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4459 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4460 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4461 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4462 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4463 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4464 | } |
| 4465 | } |
| 4466 | ucontrol->value.enumerated.item[0] = item; |
| 4467 | return 0; |
| 4468 | } |
| 4469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4470 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4471 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4472 | { |
| 4473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4474 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4475 | static unsigned int ctls[] = { |
| 4476 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4477 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4478 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4479 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4480 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4481 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4482 | }; |
| 4483 | unsigned int old_ctl, new_ctl; |
| 4484 | |
| 4485 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4486 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4487 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4488 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4489 | int val; |
| 4490 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4491 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4492 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4493 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4494 | HDA_AMP_MUTE : 0; |
| 4495 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4496 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4497 | return 1; |
| 4498 | } |
| 4499 | return 0; |
| 4500 | } |
| 4501 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4502 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4503 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4504 | { |
| 4505 | static char *texts[] = { |
| 4506 | "Front", "Surround", "CLFE", "Side" |
| 4507 | }; |
| 4508 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4509 | uinfo->count = 1; |
| 4510 | uinfo->value.enumerated.items = 4; |
| 4511 | if (uinfo->value.enumerated.item >= 4) |
| 4512 | uinfo->value.enumerated.item = 3; |
| 4513 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4514 | return 0; |
| 4515 | } |
| 4516 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4517 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4518 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4519 | { |
| 4520 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4521 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4522 | unsigned int sel; |
| 4523 | |
| 4524 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4525 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4526 | return 0; |
| 4527 | } |
| 4528 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4529 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4530 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4531 | { |
| 4532 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4533 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4534 | unsigned int sel; |
| 4535 | |
| 4536 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4537 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4538 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4539 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4540 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4541 | return 1; |
| 4542 | } |
| 4543 | return 0; |
| 4544 | } |
| 4545 | |
| 4546 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4547 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4548 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4549 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4550 | .info = alc_test_pin_ctl_info, \ |
| 4551 | .get = alc_test_pin_ctl_get, \ |
| 4552 | .put = alc_test_pin_ctl_put, \ |
| 4553 | .private_value = nid \ |
| 4554 | } |
| 4555 | |
| 4556 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4557 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4558 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4559 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4560 | .info = alc_test_pin_src_info, \ |
| 4561 | .get = alc_test_pin_src_get, \ |
| 4562 | .put = alc_test_pin_src_put, \ |
| 4563 | .private_value = nid \ |
| 4564 | } |
| 4565 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4566 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4568 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4569 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4570 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4571 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4572 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4573 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4574 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4575 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4576 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4577 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4578 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4579 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4580 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4581 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4582 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4583 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4584 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4585 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4586 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4587 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4588 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4589 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4590 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4591 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4592 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4593 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4594 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4595 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4596 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4597 | { |
| 4598 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4599 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4600 | .info = alc_ch_mode_info, |
| 4601 | .get = alc_ch_mode_get, |
| 4602 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4603 | }, |
| 4604 | { } /* end */ |
| 4605 | }; |
| 4606 | |
| 4607 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4608 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4610 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4611 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4612 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4613 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4614 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4615 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4616 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4617 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4620 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4621 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4622 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4623 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4624 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4625 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4626 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4627 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4628 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4630 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4631 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4632 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4633 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4634 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4635 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4636 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4637 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4638 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4639 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4640 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4641 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4642 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4643 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4645 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4646 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4647 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4648 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4649 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4650 | /* Analog input/passthru */ |
| 4651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4653 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4655 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4656 | { } |
| 4657 | }; |
| 4658 | #endif |
| 4659 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4660 | /* |
| 4661 | */ |
| 4662 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4663 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4664 | [ALC880_3ST] = "3stack", |
| 4665 | [ALC880_TCL_S700] = "tcl", |
| 4666 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4667 | [ALC880_CLEVO] = "clevo", |
| 4668 | [ALC880_5ST] = "5stack", |
| 4669 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4670 | [ALC880_W810] = "w810", |
| 4671 | [ALC880_Z71V] = "z71v", |
| 4672 | [ALC880_6ST] = "6stack", |
| 4673 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4674 | [ALC880_ASUS] = "asus", |
| 4675 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4676 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4677 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4678 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4679 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4680 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4681 | [ALC880_F1734] = "F1734", |
| 4682 | [ALC880_LG] = "lg", |
| 4683 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4684 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4685 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4686 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4687 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4688 | [ALC880_AUTO] = "auto", |
| 4689 | }; |
| 4690 | |
| 4691 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4692 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4693 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4694 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4695 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4696 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4697 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4698 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4699 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4700 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4701 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4702 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4703 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4704 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4705 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4706 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4707 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4708 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4709 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4710 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4711 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4712 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4713 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4714 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4715 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4716 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4717 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4718 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4719 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4720 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4721 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4722 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4723 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4724 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4725 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4726 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4727 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4728 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4729 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4730 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4731 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Justin P. Mattock | a2e2bc2 | 2011-02-24 22:16:02 -0800 | [diff] [blame] | 4732 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4733 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4734 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4735 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4736 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4737 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4738 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4739 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4740 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4741 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4742 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4743 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4744 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4745 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4746 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4747 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4748 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4749 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4750 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4751 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4752 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4753 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4754 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4755 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4756 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4757 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4758 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4759 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4760 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4761 | /* default Intel */ |
| 4762 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4763 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4764 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4765 | {} |
| 4766 | }; |
| 4767 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4768 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4769 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4770 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4771 | static struct alc_config_preset alc880_presets[] = { |
| 4772 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4773 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4774 | .init_verbs = { alc880_volume_init_verbs, |
| 4775 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4776 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4777 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4778 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4779 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4780 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4781 | .input_mux = &alc880_capture_source, |
| 4782 | }, |
| 4783 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4784 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4785 | .init_verbs = { alc880_volume_init_verbs, |
| 4786 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4787 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4788 | .dac_nids = alc880_dac_nids, |
| 4789 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4790 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4791 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4792 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4793 | .input_mux = &alc880_capture_source, |
| 4794 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4795 | [ALC880_TCL_S700] = { |
| 4796 | .mixers = { alc880_tcl_s700_mixer }, |
| 4797 | .init_verbs = { alc880_volume_init_verbs, |
| 4798 | alc880_pin_tcl_S700_init_verbs, |
| 4799 | alc880_gpio2_init_verbs }, |
| 4800 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4801 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4802 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4803 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4804 | .hp_nid = 0x03, |
| 4805 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4806 | .channel_mode = alc880_2_jack_modes, |
| 4807 | .input_mux = &alc880_capture_source, |
| 4808 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4809 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4810 | .mixers = { alc880_three_stack_mixer, |
| 4811 | alc880_five_stack_mixer}, |
| 4812 | .init_verbs = { alc880_volume_init_verbs, |
| 4813 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4814 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4815 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4816 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4817 | .channel_mode = alc880_fivestack_modes, |
| 4818 | .input_mux = &alc880_capture_source, |
| 4819 | }, |
| 4820 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4821 | .mixers = { alc880_three_stack_mixer, |
| 4822 | alc880_five_stack_mixer }, |
| 4823 | .init_verbs = { alc880_volume_init_verbs, |
| 4824 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4825 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4826 | .dac_nids = alc880_dac_nids, |
| 4827 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4828 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4829 | .channel_mode = alc880_fivestack_modes, |
| 4830 | .input_mux = &alc880_capture_source, |
| 4831 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4832 | [ALC880_6ST] = { |
| 4833 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4834 | .init_verbs = { alc880_volume_init_verbs, |
| 4835 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4836 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4837 | .dac_nids = alc880_6st_dac_nids, |
| 4838 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4839 | .channel_mode = alc880_sixstack_modes, |
| 4840 | .input_mux = &alc880_6stack_capture_source, |
| 4841 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4842 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4843 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4844 | .init_verbs = { alc880_volume_init_verbs, |
| 4845 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4846 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4847 | .dac_nids = alc880_6st_dac_nids, |
| 4848 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4849 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4850 | .channel_mode = alc880_sixstack_modes, |
| 4851 | .input_mux = &alc880_6stack_capture_source, |
| 4852 | }, |
| 4853 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4854 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4855 | .init_verbs = { alc880_volume_init_verbs, |
| 4856 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4857 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4858 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4859 | .dac_nids = alc880_w810_dac_nids, |
| 4860 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4861 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4862 | .channel_mode = alc880_w810_modes, |
| 4863 | .input_mux = &alc880_capture_source, |
| 4864 | }, |
| 4865 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4866 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4867 | .init_verbs = { alc880_volume_init_verbs, |
| 4868 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4869 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4870 | .dac_nids = alc880_z71v_dac_nids, |
| 4871 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4872 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4873 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4874 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4875 | .input_mux = &alc880_capture_source, |
| 4876 | }, |
| 4877 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4878 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4879 | .init_verbs = { alc880_volume_init_verbs, |
| 4880 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4881 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4882 | .dac_nids = alc880_f1734_dac_nids, |
| 4883 | .hp_nid = 0x02, |
| 4884 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4885 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4886 | .input_mux = &alc880_f1734_capture_source, |
| 4887 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4888 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4889 | .init_hook = alc_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4890 | }, |
| 4891 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4892 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4893 | .init_verbs = { alc880_volume_init_verbs, |
| 4894 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4895 | alc880_gpio1_init_verbs }, |
| 4896 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4897 | .dac_nids = alc880_asus_dac_nids, |
| 4898 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4899 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4900 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4901 | .input_mux = &alc880_capture_source, |
| 4902 | }, |
| 4903 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4904 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4905 | .init_verbs = { alc880_volume_init_verbs, |
| 4906 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4907 | alc880_gpio1_init_verbs }, |
| 4908 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4909 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4910 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4911 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4912 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4913 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4914 | .input_mux = &alc880_capture_source, |
| 4915 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4916 | [ALC880_ASUS_DIG2] = { |
| 4917 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4918 | .init_verbs = { alc880_volume_init_verbs, |
| 4919 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4920 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4921 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4922 | .dac_nids = alc880_asus_dac_nids, |
| 4923 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4924 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4925 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4926 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4927 | .input_mux = &alc880_capture_source, |
| 4928 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4929 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4930 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4931 | .init_verbs = { alc880_volume_init_verbs, |
| 4932 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4933 | alc880_gpio1_init_verbs }, |
| 4934 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4935 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4936 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4937 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4938 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4939 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4940 | .input_mux = &alc880_capture_source, |
| 4941 | }, |
| 4942 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4943 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4944 | .init_verbs = { alc880_volume_init_verbs, |
| 4945 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4946 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4947 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4948 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4949 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4950 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4951 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4952 | .input_mux = &alc880_capture_source, |
| 4953 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4954 | [ALC880_UNIWILL] = { |
| 4955 | .mixers = { alc880_uniwill_mixer }, |
| 4956 | .init_verbs = { alc880_volume_init_verbs, |
| 4957 | alc880_uniwill_init_verbs }, |
| 4958 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4959 | .dac_nids = alc880_asus_dac_nids, |
| 4960 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4961 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4962 | .channel_mode = alc880_threestack_modes, |
| 4963 | .need_dac_fix = 1, |
| 4964 | .input_mux = &alc880_capture_source, |
| 4965 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4966 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4967 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4968 | }, |
| 4969 | [ALC880_UNIWILL_P53] = { |
| 4970 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4971 | .init_verbs = { alc880_volume_init_verbs, |
| 4972 | alc880_uniwill_p53_init_verbs }, |
| 4973 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4974 | .dac_nids = alc880_asus_dac_nids, |
| 4975 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4976 | .channel_mode = alc880_threestack_modes, |
| 4977 | .input_mux = &alc880_capture_source, |
| 4978 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4979 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4980 | .init_hook = alc_hp_automute, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4981 | }, |
| 4982 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4983 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4984 | .init_verbs = { alc880_volume_init_verbs, |
| 4985 | alc880_uniwill_p53_init_verbs, |
| 4986 | alc880_beep_init_verbs }, |
| 4987 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4988 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4989 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4990 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4991 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4992 | .input_mux = &alc880_capture_source, |
| 4993 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4994 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4995 | .init_hook = alc_hp_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4996 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4997 | [ALC880_CLEVO] = { |
| 4998 | .mixers = { alc880_three_stack_mixer }, |
| 4999 | .init_verbs = { alc880_volume_init_verbs, |
| 5000 | alc880_pin_clevo_init_verbs }, |
| 5001 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5002 | .dac_nids = alc880_dac_nids, |
| 5003 | .hp_nid = 0x03, |
| 5004 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5005 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5006 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5007 | .input_mux = &alc880_capture_source, |
| 5008 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5009 | [ALC880_LG] = { |
| 5010 | .mixers = { alc880_lg_mixer }, |
| 5011 | .init_verbs = { alc880_volume_init_verbs, |
| 5012 | alc880_lg_init_verbs }, |
| 5013 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 5014 | .dac_nids = alc880_lg_dac_nids, |
| 5015 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5016 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 5017 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5018 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5019 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5020 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5021 | .setup = alc880_lg_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5022 | .init_hook = alc_hp_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5023 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5024 | .loopbacks = alc880_lg_loopbacks, |
| 5025 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5026 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5027 | [ALC880_LG_LW] = { |
| 5028 | .mixers = { alc880_lg_lw_mixer }, |
| 5029 | .init_verbs = { alc880_volume_init_verbs, |
| 5030 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5031 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5032 | .dac_nids = alc880_dac_nids, |
| 5033 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5034 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5035 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5036 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5037 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5038 | .setup = alc880_lg_lw_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5039 | .init_hook = alc_hp_automute, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5040 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5041 | [ALC880_MEDION_RIM] = { |
| 5042 | .mixers = { alc880_medion_rim_mixer }, |
| 5043 | .init_verbs = { alc880_volume_init_verbs, |
| 5044 | alc880_medion_rim_init_verbs, |
| 5045 | alc_gpio2_init_verbs }, |
| 5046 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5047 | .dac_nids = alc880_dac_nids, |
| 5048 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5049 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5050 | .channel_mode = alc880_2_jack_modes, |
| 5051 | .input_mux = &alc880_medion_rim_capture_source, |
| 5052 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5053 | .setup = alc880_medion_rim_setup, |
| 5054 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5055 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5056 | #ifdef CONFIG_SND_DEBUG |
| 5057 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5058 | .mixers = { alc880_test_mixer }, |
| 5059 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5060 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5061 | .dac_nids = alc880_test_dac_nids, |
| 5062 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5063 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5064 | .channel_mode = alc880_test_modes, |
| 5065 | .input_mux = &alc880_test_capture_source, |
| 5066 | }, |
| 5067 | #endif |
| 5068 | }; |
| 5069 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5070 | /* |
| 5071 | * Automatic parse of I/O pins from the BIOS configuration |
| 5072 | */ |
| 5073 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5074 | enum { |
| 5075 | ALC_CTL_WIDGET_VOL, |
| 5076 | ALC_CTL_WIDGET_MUTE, |
| 5077 | ALC_CTL_BIND_MUTE, |
| 5078 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5079 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5080 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5081 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5082 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5083 | }; |
| 5084 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5085 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) |
| 5086 | { |
| 5087 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
| 5088 | return snd_array_new(&spec->kctls); |
| 5089 | } |
| 5090 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5091 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5092 | 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] | 5093 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5094 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5095 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5096 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5097 | knew = alc_kcontrol_new(spec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5098 | if (!knew) |
| 5099 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5100 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5101 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5102 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5103 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5104 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5105 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5106 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5107 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5108 | return 0; |
| 5109 | } |
| 5110 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5111 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5112 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5113 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5114 | { |
| 5115 | char name[32]; |
| 5116 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5117 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5118 | } |
| 5119 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5120 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5121 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5122 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5123 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5124 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5125 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5126 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5127 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5128 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5129 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5130 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5131 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5132 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5133 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5134 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5135 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5136 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5137 | #define ALC880_PIN_CD_NID 0x1c |
| 5138 | |
| 5139 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5140 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5141 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5142 | { |
| 5143 | hda_nid_t nid; |
| 5144 | int assigned[4]; |
| 5145 | int i, j; |
| 5146 | |
| 5147 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5148 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5149 | |
| 5150 | /* check the pins hardwired to audio widget */ |
| 5151 | for (i = 0; i < cfg->line_outs; i++) { |
| 5152 | nid = cfg->line_out_pins[i]; |
| 5153 | if (alc880_is_fixed_pin(nid)) { |
| 5154 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 5155 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5156 | assigned[idx] = 1; |
| 5157 | } |
| 5158 | } |
| 5159 | /* left pins can be connect to any audio widget */ |
| 5160 | for (i = 0; i < cfg->line_outs; i++) { |
| 5161 | nid = cfg->line_out_pins[i]; |
| 5162 | if (alc880_is_fixed_pin(nid)) |
| 5163 | continue; |
| 5164 | /* search for an empty channel */ |
| 5165 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5166 | if (!assigned[j]) { |
| 5167 | spec->multiout.dac_nids[i] = |
| 5168 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5169 | assigned[j] = 1; |
| 5170 | break; |
| 5171 | } |
| 5172 | } |
| 5173 | } |
| 5174 | spec->multiout.num_dacs = cfg->line_outs; |
| 5175 | return 0; |
| 5176 | } |
| 5177 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5178 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5179 | bool can_be_master) |
| 5180 | { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5181 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 5182 | |
| 5183 | if (cfg->line_outs == 1 && !spec->multi_ios && |
| 5184 | !cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5185 | return "Master"; |
| 5186 | |
| 5187 | switch (cfg->line_out_type) { |
| 5188 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5189 | if (cfg->line_outs == 1) |
| 5190 | return "Speaker"; |
| 5191 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5192 | case AUTO_PIN_HP_OUT: |
| 5193 | return "Headphone"; |
| 5194 | default: |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5195 | if (cfg->line_outs == 1 && !spec->multi_ios) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5196 | return "PCM"; |
| 5197 | break; |
| 5198 | } |
| 5199 | return NULL; |
| 5200 | } |
| 5201 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5202 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5203 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5204 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5205 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5206 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5207 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5208 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5209 | const char *pfx = alc_get_line_out_pfx(spec, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5210 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5211 | int i, err, noutputs; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5212 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5213 | noutputs = cfg->line_outs; |
| 5214 | if (spec->multi_ios > 0) |
| 5215 | noutputs += spec->multi_ios; |
| 5216 | |
| 5217 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5218 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5219 | continue; |
| 5220 | 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] | 5221 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5222 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5223 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5224 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5225 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5226 | HDA_OUTPUT)); |
| 5227 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5228 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5229 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5230 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5231 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5232 | HDA_OUTPUT)); |
| 5233 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5234 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5235 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5236 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5237 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5238 | HDA_INPUT)); |
| 5239 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5240 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5241 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5242 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5243 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5244 | HDA_INPUT)); |
| 5245 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5246 | return err; |
| 5247 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5248 | const char *name = pfx; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5249 | int index = i; |
| 5250 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5251 | name = chname[i]; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5252 | index = 0; |
| 5253 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5254 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5255 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5256 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5257 | HDA_OUTPUT)); |
| 5258 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5259 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5260 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5261 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5262 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5263 | HDA_INPUT)); |
| 5264 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5265 | return err; |
| 5266 | } |
| 5267 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5268 | return 0; |
| 5269 | } |
| 5270 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5271 | /* add playback controls for speaker and HP outputs */ |
| 5272 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5273 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5274 | { |
| 5275 | hda_nid_t nid; |
| 5276 | int err; |
| 5277 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5278 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5279 | return 0; |
| 5280 | |
| 5281 | if (alc880_is_fixed_pin(pin)) { |
| 5282 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5283 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5284 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5285 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5286 | else |
| 5287 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5288 | /* control HP volume/switch on the output mixer amp */ |
| 5289 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5290 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5291 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5292 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5293 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5294 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5295 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5296 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5297 | return err; |
| 5298 | } else if (alc880_is_multi_pin(pin)) { |
| 5299 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5300 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5301 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5302 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5303 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5304 | return err; |
| 5305 | } |
| 5306 | return 0; |
| 5307 | } |
| 5308 | |
| 5309 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5310 | 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] | 5311 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5312 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5313 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5314 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5315 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5316 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5317 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5318 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5319 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5320 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5321 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5322 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5323 | return err; |
| 5324 | return 0; |
| 5325 | } |
| 5326 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5327 | 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] | 5328 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5329 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5330 | return (pincap & AC_PINCAP_IN) != 0; |
| 5331 | } |
| 5332 | |
| 5333 | /* create playback/capture controls for input pins */ |
| 5334 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5335 | const struct auto_pin_cfg *cfg, |
| 5336 | hda_nid_t mixer, |
| 5337 | hda_nid_t cap1, hda_nid_t cap2) |
| 5338 | { |
| 5339 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5340 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5341 | int i, err, idx, type_idx = 0; |
| 5342 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5343 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5344 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5345 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5346 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5347 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5348 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5349 | if (!alc_is_input_pin(codec, pin)) |
| 5350 | continue; |
| 5351 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5352 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5353 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5354 | type_idx++; |
| 5355 | else |
| 5356 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5357 | prev_label = label; |
| 5358 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5359 | if (mixer) { |
| 5360 | idx = get_connection_index(codec, mixer, pin); |
| 5361 | if (idx >= 0) { |
| 5362 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5363 | label, type_idx, |
| 5364 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5365 | if (err < 0) |
| 5366 | return err; |
| 5367 | } |
| 5368 | } |
| 5369 | |
| 5370 | if (!cap1) |
| 5371 | continue; |
| 5372 | idx = get_connection_index(codec, cap1, pin); |
| 5373 | if (idx < 0 && cap2) |
| 5374 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5375 | if (idx >= 0) |
| 5376 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5377 | } |
| 5378 | return 0; |
| 5379 | } |
| 5380 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5381 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5382 | const struct auto_pin_cfg *cfg) |
| 5383 | { |
| 5384 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5385 | } |
| 5386 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5387 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5388 | unsigned int pin_type) |
| 5389 | { |
| 5390 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5391 | pin_type); |
| 5392 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5393 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5394 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5395 | } |
| 5396 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5397 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5398 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5399 | int dac_idx) |
| 5400 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5401 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5402 | /* need the manual connection? */ |
| 5403 | if (alc880_is_multi_pin(nid)) { |
| 5404 | struct alc_spec *spec = codec->spec; |
| 5405 | int idx = alc880_multi_pin_idx(nid); |
| 5406 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5407 | AC_VERB_SET_CONNECT_SEL, |
| 5408 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5409 | } |
| 5410 | } |
| 5411 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5412 | static int get_pin_type(int line_out_type) |
| 5413 | { |
| 5414 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5415 | return PIN_HP; |
| 5416 | else |
| 5417 | return PIN_OUT; |
| 5418 | } |
| 5419 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5420 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5421 | { |
| 5422 | struct alc_spec *spec = codec->spec; |
| 5423 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5424 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5425 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5426 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5427 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5428 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5429 | } |
| 5430 | } |
| 5431 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5432 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5433 | { |
| 5434 | struct alc_spec *spec = codec->spec; |
| 5435 | hda_nid_t pin; |
| 5436 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5437 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5438 | if (pin) /* connect to front */ |
| 5439 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5440 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5441 | if (pin) /* connect to front */ |
| 5442 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5443 | } |
| 5444 | |
| 5445 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5446 | { |
| 5447 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5448 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5449 | int i; |
| 5450 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5451 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5452 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5453 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5454 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5455 | if (nid != ALC880_PIN_CD_NID && |
| 5456 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5457 | snd_hda_codec_write(codec, nid, 0, |
| 5458 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5459 | AMP_OUT_MUTE); |
| 5460 | } |
| 5461 | } |
| 5462 | } |
| 5463 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5464 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5465 | { |
| 5466 | struct alc_spec *spec = codec->spec; |
| 5467 | int c; |
| 5468 | |
| 5469 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5470 | unsigned int mux_idx; |
| 5471 | const struct hda_input_mux *imux; |
| 5472 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5473 | imux = &spec->input_mux[mux_idx]; |
| 5474 | if (!imux->num_items && mux_idx > 0) |
| 5475 | imux = &spec->input_mux[0]; |
| 5476 | if (imux) |
| 5477 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5478 | AC_VERB_SET_CONNECT_SEL, |
| 5479 | imux->items[0].index); |
| 5480 | } |
| 5481 | } |
| 5482 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5483 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec); |
| 5484 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5485 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5486 | /* return 1 if successful, 0 if the proper config is not found, |
| 5487 | * or a negative error code |
| 5488 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5489 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5490 | { |
| 5491 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5492 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5493 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5494 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5495 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5496 | alc880_ignore); |
| 5497 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5498 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5499 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5500 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5501 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5502 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5503 | if (err < 0) |
| 5504 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5505 | err = alc_auto_add_multi_channel_mode(codec); |
| 5506 | if (err < 0) |
| 5507 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5508 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5509 | if (err < 0) |
| 5510 | return err; |
| 5511 | err = alc880_auto_create_extra_out(spec, |
| 5512 | spec->autocfg.speaker_pins[0], |
| 5513 | "Speaker"); |
| 5514 | if (err < 0) |
| 5515 | return err; |
| 5516 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5517 | "Headphone"); |
| 5518 | if (err < 0) |
| 5519 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5520 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5521 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5522 | return err; |
| 5523 | |
| 5524 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5525 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5526 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5527 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5528 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5529 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5530 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5531 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5532 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5533 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5534 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5535 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5536 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5537 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5538 | return 1; |
| 5539 | } |
| 5540 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5541 | /* additional initialization for auto-configuration model */ |
| 5542 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5543 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5544 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5545 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5546 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5547 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5548 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5549 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5550 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5551 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5552 | } |
| 5553 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5554 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5555 | * one of two digital mic pins, e.g. on ALC272 |
| 5556 | */ |
| 5557 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5558 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5559 | struct alc_spec *spec = codec->spec; |
| 5560 | int i; |
| 5561 | |
| 5562 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5563 | hda_nid_t cap = spec->capsrc_nids ? |
| 5564 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5565 | int iidx, eidx; |
| 5566 | |
| 5567 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5568 | if (iidx < 0) |
| 5569 | continue; |
| 5570 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5571 | if (eidx < 0) |
| 5572 | continue; |
| 5573 | spec->int_mic.mux_idx = iidx; |
| 5574 | spec->ext_mic.mux_idx = eidx; |
| 5575 | if (spec->capsrc_nids) |
| 5576 | spec->capsrc_nids += i; |
| 5577 | spec->adc_nids += i; |
| 5578 | spec->num_adc_nids = 1; |
| 5579 | return; |
| 5580 | } |
| 5581 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5582 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5583 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5584 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5585 | } |
| 5586 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5587 | /* select or unmute the given capsrc route */ |
| 5588 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5589 | int idx) |
| 5590 | { |
| 5591 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5592 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5593 | HDA_AMP_MUTE, 0); |
| 5594 | } else { |
| 5595 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5596 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5597 | } |
| 5598 | } |
| 5599 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5600 | /* set the default connection to that pin */ |
| 5601 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5602 | { |
| 5603 | struct alc_spec *spec = codec->spec; |
| 5604 | int i; |
| 5605 | |
| 5606 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5607 | hda_nid_t cap = spec->capsrc_nids ? |
| 5608 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5609 | int idx; |
| 5610 | |
| 5611 | idx = get_connection_index(codec, cap, pin); |
| 5612 | if (idx < 0) |
| 5613 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5614 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5615 | return i; /* return the found index */ |
| 5616 | } |
| 5617 | return -1; /* not found */ |
| 5618 | } |
| 5619 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5620 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5621 | static void fixup_single_adc(struct hda_codec *codec) |
| 5622 | { |
| 5623 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5624 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5625 | int i; |
| 5626 | |
| 5627 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5628 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5629 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5630 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5631 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5632 | /* use only this ADC */ |
| 5633 | if (spec->capsrc_nids) |
| 5634 | spec->capsrc_nids += i; |
| 5635 | spec->adc_nids += i; |
| 5636 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5637 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5638 | } |
| 5639 | } |
| 5640 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5641 | /* initialize dual adcs */ |
| 5642 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5643 | { |
| 5644 | struct alc_spec *spec = codec->spec; |
| 5645 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5646 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5647 | } |
| 5648 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5649 | /* initialize some special cases for input sources */ |
| 5650 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5651 | { |
| 5652 | struct alc_spec *spec = codec->spec; |
| 5653 | if (spec->dual_adc_switch) |
| 5654 | fixup_dual_adc_switch(codec); |
| 5655 | else if (spec->single_input_src) |
| 5656 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5657 | } |
| 5658 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5659 | static void set_capture_mixer(struct hda_codec *codec) |
| 5660 | { |
| 5661 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5662 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5663 | { alc_capture_mixer_nosrc1, |
| 5664 | alc_capture_mixer_nosrc2, |
| 5665 | alc_capture_mixer_nosrc3 }, |
| 5666 | { alc_capture_mixer1, |
| 5667 | alc_capture_mixer2, |
| 5668 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5669 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5670 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5671 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5672 | int num_adcs = spec->num_adc_nids; |
| 5673 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5674 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5675 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5676 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5677 | else if (spec->input_mux) { |
| 5678 | if (spec->input_mux->num_items > 1) |
| 5679 | mux = 1; |
| 5680 | else if (spec->input_mux->num_items == 1) |
| 5681 | fixup_single_adc(codec); |
| 5682 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5683 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5684 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5685 | } |
| 5686 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5687 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5688 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5689 | int num_nids) |
| 5690 | { |
| 5691 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5692 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5693 | int n; |
| 5694 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5695 | |
| 5696 | for (n = 0; n < num_nids; n++) { |
| 5697 | hda_nid_t adc, cap; |
| 5698 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5699 | int nconns, i, j; |
| 5700 | |
| 5701 | adc = nids[n]; |
| 5702 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5703 | continue; |
| 5704 | cap = adc; |
| 5705 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5706 | ARRAY_SIZE(conn)); |
| 5707 | if (nconns == 1) { |
| 5708 | cap = conn[0]; |
| 5709 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5710 | ARRAY_SIZE(conn)); |
| 5711 | } |
| 5712 | if (nconns <= 0) |
| 5713 | continue; |
| 5714 | if (!fallback_adc) { |
| 5715 | fallback_adc = adc; |
| 5716 | fallback_cap = cap; |
| 5717 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5718 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5719 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5720 | for (j = 0; j < nconns; j++) { |
| 5721 | if (conn[j] == nid) |
| 5722 | break; |
| 5723 | } |
| 5724 | if (j >= nconns) |
| 5725 | break; |
| 5726 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5727 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5728 | int num_adcs = spec->num_adc_nids; |
| 5729 | spec->private_adc_nids[num_adcs] = adc; |
| 5730 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5731 | spec->num_adc_nids++; |
| 5732 | spec->adc_nids = spec->private_adc_nids; |
| 5733 | if (adc != cap) |
| 5734 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5735 | } |
| 5736 | } |
| 5737 | if (!spec->num_adc_nids) { |
| 5738 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5739 | " using fallback 0x%x\n", |
| 5740 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5741 | spec->private_adc_nids[0] = fallback_adc; |
| 5742 | spec->adc_nids = spec->private_adc_nids; |
| 5743 | if (fallback_adc != fallback_cap) { |
| 5744 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5745 | spec->capsrc_nids = spec->private_adc_nids; |
| 5746 | } |
| 5747 | } |
| 5748 | } |
| 5749 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5750 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5751 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5752 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5753 | |
| 5754 | static struct snd_pci_quirk beep_white_list[] = { |
| 5755 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5756 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5757 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5758 | {} |
| 5759 | }; |
| 5760 | |
| 5761 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5762 | { |
| 5763 | struct alc_spec *spec = codec->spec; |
| 5764 | const struct snd_pci_quirk *q; |
| 5765 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5766 | if (q) |
| 5767 | return q->value; |
| 5768 | return spec->cdefine.enable_pcbeep; |
| 5769 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5770 | #else |
| 5771 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5772 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5773 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5774 | |
| 5775 | /* |
| 5776 | * OK, here we have finally the patch for ALC880 |
| 5777 | */ |
| 5778 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5779 | static int patch_alc880(struct hda_codec *codec) |
| 5780 | { |
| 5781 | struct alc_spec *spec; |
| 5782 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5783 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5784 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5785 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5786 | if (spec == NULL) |
| 5787 | return -ENOMEM; |
| 5788 | |
| 5789 | codec->spec = spec; |
| 5790 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5791 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5792 | alc880_models, |
| 5793 | alc880_cfg_tbl); |
| 5794 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5795 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5796 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5797 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5798 | } |
| 5799 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5800 | if (board_config == ALC880_AUTO) { |
| 5801 | /* automatic parse from the BIOS config */ |
| 5802 | err = alc880_parse_auto_config(codec); |
| 5803 | if (err < 0) { |
| 5804 | alc_free(codec); |
| 5805 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5806 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5807 | printk(KERN_INFO |
| 5808 | "hda_codec: Cannot set up configuration " |
| 5809 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5810 | board_config = ALC880_3ST; |
| 5811 | } |
| 5812 | } |
| 5813 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5814 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5815 | if (err < 0) { |
| 5816 | alc_free(codec); |
| 5817 | return err; |
| 5818 | } |
| 5819 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5820 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5821 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5822 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5823 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5824 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5825 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5826 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5827 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5828 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5829 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5830 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5831 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5832 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5833 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5834 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5835 | if (wcap != AC_WID_AUD_IN) { |
| 5836 | spec->adc_nids = alc880_adc_nids_alt; |
| 5837 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5838 | } else { |
| 5839 | spec->adc_nids = alc880_adc_nids; |
| 5840 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5841 | } |
| 5842 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5843 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5844 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5845 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5846 | spec->vmaster_nid = 0x0c; |
| 5847 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5848 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5849 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5850 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5851 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5852 | if (!spec->loopback.amplist) |
| 5853 | spec->loopback.amplist = alc880_loopbacks; |
| 5854 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5855 | |
| 5856 | return 0; |
| 5857 | } |
| 5858 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5859 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5860 | /* |
| 5861 | * ALC260 support |
| 5862 | */ |
| 5863 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5864 | static hda_nid_t alc260_dac_nids[1] = { |
| 5865 | /* front */ |
| 5866 | 0x02, |
| 5867 | }; |
| 5868 | |
| 5869 | static hda_nid_t alc260_adc_nids[1] = { |
| 5870 | /* ADC0 */ |
| 5871 | 0x04, |
| 5872 | }; |
| 5873 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5874 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5875 | /* ADC1 */ |
| 5876 | 0x05, |
| 5877 | }; |
| 5878 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5879 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5880 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5881 | */ |
| 5882 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5883 | /* ADC0, ADC1 */ |
| 5884 | 0x04, 0x05 |
| 5885 | }; |
| 5886 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5887 | #define ALC260_DIGOUT_NID 0x03 |
| 5888 | #define ALC260_DIGIN_NID 0x06 |
| 5889 | |
| 5890 | static struct hda_input_mux alc260_capture_source = { |
| 5891 | .num_items = 4, |
| 5892 | .items = { |
| 5893 | { "Mic", 0x0 }, |
| 5894 | { "Front Mic", 0x1 }, |
| 5895 | { "Line", 0x2 }, |
| 5896 | { "CD", 0x4 }, |
| 5897 | }, |
| 5898 | }; |
| 5899 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5900 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5901 | * headphone jack and the internal CD lines since these are the only pins at |
| 5902 | * which audio can appear. For flexibility, also allow the option of |
| 5903 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5904 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5905 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5906 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5907 | { |
| 5908 | .num_items = 3, |
| 5909 | .items = { |
| 5910 | { "Mic/Line", 0x0 }, |
| 5911 | { "CD", 0x4 }, |
| 5912 | { "Headphone", 0x2 }, |
| 5913 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5914 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5915 | { |
| 5916 | .num_items = 4, |
| 5917 | .items = { |
| 5918 | { "Mic/Line", 0x0 }, |
| 5919 | { "CD", 0x4 }, |
| 5920 | { "Headphone", 0x2 }, |
| 5921 | { "Mixer", 0x5 }, |
| 5922 | }, |
| 5923 | }, |
| 5924 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5925 | }; |
| 5926 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5927 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5928 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5929 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5930 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5931 | { |
| 5932 | .num_items = 4, |
| 5933 | .items = { |
| 5934 | { "Mic", 0x0 }, |
| 5935 | { "Line", 0x2 }, |
| 5936 | { "CD", 0x4 }, |
| 5937 | { "Headphone", 0x5 }, |
| 5938 | }, |
| 5939 | }, |
| 5940 | { |
| 5941 | .num_items = 5, |
| 5942 | .items = { |
| 5943 | { "Mic", 0x0 }, |
| 5944 | { "Line", 0x2 }, |
| 5945 | { "CD", 0x4 }, |
| 5946 | { "Headphone", 0x6 }, |
| 5947 | { "Mixer", 0x5 }, |
| 5948 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5949 | }, |
| 5950 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5951 | |
| 5952 | /* Maxdata Favorit 100XS */ |
| 5953 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5954 | { |
| 5955 | .num_items = 2, |
| 5956 | .items = { |
| 5957 | { "Line/Mic", 0x0 }, |
| 5958 | { "CD", 0x4 }, |
| 5959 | }, |
| 5960 | }, |
| 5961 | { |
| 5962 | .num_items = 3, |
| 5963 | .items = { |
| 5964 | { "Line/Mic", 0x0 }, |
| 5965 | { "CD", 0x4 }, |
| 5966 | { "Mixer", 0x5 }, |
| 5967 | }, |
| 5968 | }, |
| 5969 | }; |
| 5970 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5971 | /* |
| 5972 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5973 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5974 | * element which allows changing the channel mode, so the verb list is |
| 5975 | * never used. |
| 5976 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5977 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5978 | { 2, NULL }, |
| 5979 | }; |
| 5980 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5981 | |
| 5982 | /* Mixer combinations |
| 5983 | * |
| 5984 | * basic: base_output + input + pc_beep + capture |
| 5985 | * HP: base_output + input + capture_alt |
| 5986 | * HP_3013: hp_3013 + input + capture |
| 5987 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5988 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5989 | */ |
| 5990 | |
| 5991 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5992 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5993 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5994 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5995 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5996 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5997 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5998 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5999 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6000 | |
| 6001 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6002 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6003 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6004 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6005 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6006 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6007 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6008 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6009 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6010 | { } /* end */ |
| 6011 | }; |
| 6012 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6013 | /* update HP, line and mono out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6014 | static void alc260_hp_master_update(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6015 | { |
| 6016 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6017 | |
| 6018 | /* change HP pins */ |
| 6019 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 6020 | spec->autocfg.hp_pins, spec->master_mute, true); |
| 6021 | update_speakers(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6022 | } |
| 6023 | |
| 6024 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 6025 | struct snd_ctl_elem_value *ucontrol) |
| 6026 | { |
| 6027 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6028 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6029 | *ucontrol->value.integer.value = !spec->master_mute; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6030 | return 0; |
| 6031 | } |
| 6032 | |
| 6033 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6034 | struct snd_ctl_elem_value *ucontrol) |
| 6035 | { |
| 6036 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6037 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6038 | int val = !*ucontrol->value.integer.value; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6039 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6040 | if (val == spec->master_mute) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6041 | return 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6042 | spec->master_mute = val; |
| 6043 | alc260_hp_master_update(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6044 | return 1; |
| 6045 | } |
| 6046 | |
| 6047 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 6048 | { |
| 6049 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6050 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6051 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6052 | .info = snd_ctl_boolean_mono_info, |
| 6053 | .get = alc260_hp_master_sw_get, |
| 6054 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6055 | }, |
| 6056 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6057 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6058 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6059 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6060 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6061 | HDA_OUTPUT), |
| 6062 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6063 | { } /* end */ |
| 6064 | }; |
| 6065 | |
| 6066 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 6067 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6068 | {}, |
| 6069 | }; |
| 6070 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6071 | static void alc260_hp_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6072 | { |
| 6073 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6074 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6075 | spec->autocfg.hp_pins[0] = 0x0f; |
| 6076 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6077 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6078 | spec->automute = 1; |
| 6079 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6080 | } |
| 6081 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6082 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6083 | { |
| 6084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6085 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6086 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6087 | .info = snd_ctl_boolean_mono_info, |
| 6088 | .get = alc260_hp_master_sw_get, |
| 6089 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6090 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6092 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6093 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6094 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6095 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6097 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6098 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6099 | { } /* end */ |
| 6100 | }; |
| 6101 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6102 | static void alc260_hp_3013_setup(struct hda_codec *codec) |
| 6103 | { |
| 6104 | struct alc_spec *spec = codec->spec; |
| 6105 | |
| 6106 | spec->autocfg.hp_pins[0] = 0x15; |
| 6107 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6108 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6109 | spec->automute = 1; |
| 6110 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 6111 | } |
| 6112 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6113 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 6114 | .ops = &snd_hda_bind_vol, |
| 6115 | .values = { |
| 6116 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6117 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6118 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6119 | 0 |
| 6120 | }, |
| 6121 | }; |
| 6122 | |
| 6123 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 6124 | .ops = &snd_hda_bind_sw, |
| 6125 | .values = { |
| 6126 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6127 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6128 | 0 |
| 6129 | }, |
| 6130 | }; |
| 6131 | |
| 6132 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 6133 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6134 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6135 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6137 | { } /* end */ |
| 6138 | }; |
| 6139 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6140 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 6141 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6142 | {}, |
| 6143 | }; |
| 6144 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6145 | static void alc260_hp_3012_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6146 | { |
| 6147 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6148 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 6149 | spec->autocfg.hp_pins[0] = 0x10; |
| 6150 | spec->autocfg.speaker_pins[0] = 0x0f; |
| 6151 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6152 | spec->autocfg.speaker_pins[2] = 0x15; |
| 6153 | spec->automute = 1; |
| 6154 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6155 | } |
| 6156 | |
| 6157 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6158 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6159 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6160 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6161 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6162 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6163 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6164 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6165 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6166 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6167 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6168 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6169 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6170 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6171 | { } /* end */ |
| 6172 | }; |
| 6173 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6174 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6175 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6176 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6177 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6178 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6179 | * revisions available in early 2006. Therefore for now allow the |
| 6180 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6181 | * that the lack of mic bias for this NID is intentional we could change the |
| 6182 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6183 | * |
| 6184 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6185 | * don't appear to make the mic bias available from the "line" jack, even |
| 6186 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6187 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6188 | * and the output jack. If this turns out to be the case for all such |
| 6189 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6190 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6191 | * |
| 6192 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6193 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6194 | * controls for such models. On models without a "mono speaker" the control |
| 6195 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6196 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6197 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 6198 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6199 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6200 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6201 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6202 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6203 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6204 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6205 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6206 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6209 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6210 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6211 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6212 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6213 | { } /* end */ |
| 6214 | }; |
| 6215 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6216 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6217 | */ |
| 6218 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 6219 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6220 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6221 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6222 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6223 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6224 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6225 | { } /* end */ |
| 6226 | }; |
| 6227 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6228 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6229 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6230 | */ |
| 6231 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 6232 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6233 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6236 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6237 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6238 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6239 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6240 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6241 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6242 | { } /* end */ |
| 6243 | }; |
| 6244 | |
| 6245 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6246 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6247 | */ |
| 6248 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 6249 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6250 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6251 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6252 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6253 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6254 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6255 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6256 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6257 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6258 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6259 | { } /* end */ |
| 6260 | }; |
| 6261 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6262 | /* |
| 6263 | * initialization verbs |
| 6264 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6265 | static struct hda_verb alc260_init_verbs[] = { |
| 6266 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6268 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6269 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6270 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6271 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6272 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6273 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6274 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6276 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6277 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6278 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6279 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6280 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6281 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6282 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6283 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6284 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6285 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6286 | /* set connection select to line in (default select for this ADC) */ |
| 6287 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6288 | /* mute capture amp left and right */ |
| 6289 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6290 | /* set connection select to line in (default select for this ADC) */ |
| 6291 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6292 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6293 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6294 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6295 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6296 | /* set vol=0 HP mixer amp left and right */ |
| 6297 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6298 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6299 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6300 | /* set vol=0 Mono mixer amp left and right */ |
| 6301 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6302 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6303 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6304 | /* unmute LINE-2 out pin */ |
| 6305 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6306 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6307 | * Line In 2 = 0x03 |
| 6308 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6309 | /* mute analog inputs */ |
| 6310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6314 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6315 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6316 | /* mute Front out path */ |
| 6317 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6318 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6319 | /* mute Headphone out path */ |
| 6320 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6321 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6322 | /* mute Mono out path */ |
| 6323 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6324 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6325 | { } |
| 6326 | }; |
| 6327 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6328 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6329 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 6330 | /* Headphone and output */ |
| 6331 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6332 | /* mono output */ |
| 6333 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6334 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6335 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6336 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6337 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6338 | /* Line In pin widget for input */ |
| 6339 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6340 | /* Line-2 pin widget for output */ |
| 6341 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6342 | /* CD pin widget for input */ |
| 6343 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6344 | /* unmute amp left and right */ |
| 6345 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6346 | /* set connection select to line in (default select for this ADC) */ |
| 6347 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6348 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6349 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6350 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6351 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6352 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6353 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6354 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6355 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6356 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6357 | * Line In 2 = 0x03 |
| 6358 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6359 | /* mute analog inputs */ |
| 6360 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6361 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6363 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6364 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6365 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6366 | /* Unmute Front out path */ |
| 6367 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6368 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6369 | /* Unmute Headphone out path */ |
| 6370 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6371 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6372 | /* Unmute Mono out path */ |
| 6373 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6374 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6375 | { } |
| 6376 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6377 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6378 | |
| 6379 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 6380 | /* Line out and output */ |
| 6381 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6382 | /* mono output */ |
| 6383 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6384 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6385 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6386 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6387 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6388 | /* Line In pin widget for input */ |
| 6389 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6390 | /* Headphone pin widget for output */ |
| 6391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6392 | /* CD pin widget for input */ |
| 6393 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6394 | /* unmute amp left and right */ |
| 6395 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6396 | /* set connection select to line in (default select for this ADC) */ |
| 6397 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6398 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6399 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6400 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6401 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6402 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6403 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6404 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6405 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6406 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6407 | * Line In 2 = 0x03 |
| 6408 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6409 | /* mute analog inputs */ |
| 6410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6412 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6413 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6414 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6415 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6416 | /* Unmute Front out path */ |
| 6417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6419 | /* Unmute Headphone out path */ |
| 6420 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6421 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6422 | /* Unmute Mono out path */ |
| 6423 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6424 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6425 | { } |
| 6426 | }; |
| 6427 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6428 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6429 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6430 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6431 | */ |
| 6432 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6433 | /* Disable all GPIOs */ |
| 6434 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6435 | /* Internal speaker is connected to headphone pin */ |
| 6436 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6437 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6438 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6439 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6440 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6441 | /* Ensure all other unused pins are disabled and muted. */ |
| 6442 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6443 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6444 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6445 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6446 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6447 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6448 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6450 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6451 | /* Disable digital (SPDIF) pins */ |
| 6452 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6453 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6454 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6455 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6456 | * when acting as an output. |
| 6457 | */ |
| 6458 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6459 | |
| 6460 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6461 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6463 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6464 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6467 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6468 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6469 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6470 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6471 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6472 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6473 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6474 | * If the pin mode is changed by the user the pin mode control will |
| 6475 | * take care of enabling the pin's input/output buffers as needed. |
| 6476 | * Therefore there's no need to enable the input buffer at this |
| 6477 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6478 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6480 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6481 | * mixer ctrl) |
| 6482 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6483 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6484 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6485 | /* Mute capture amp left and right */ |
| 6486 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6487 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6488 | * in (on mic1 pin) |
| 6489 | */ |
| 6490 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6491 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6492 | /* Do the same for the second ADC: mute capture input amp and |
| 6493 | * set ADC connection to line in (on mic1 pin) |
| 6494 | */ |
| 6495 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6496 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6497 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6498 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6506 | {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] | 6507 | |
| 6508 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6509 | }; |
| 6510 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6511 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6512 | * similar laptops (adapted from Fujitsu init verbs). |
| 6513 | */ |
| 6514 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6515 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6516 | * the headphone jack. Turn this on and rely on the standard mute |
| 6517 | * methods whenever the user wants to turn these outputs off. |
| 6518 | */ |
| 6519 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6520 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6521 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6522 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6523 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6524 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6525 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6526 | /* Line In jack is connected to Line1 pin */ |
| 6527 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6528 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6529 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6530 | /* Ensure all other unused pins are disabled and muted. */ |
| 6531 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6532 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6533 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6534 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6536 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6537 | /* Disable digital (SPDIF) pins */ |
| 6538 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6539 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6540 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6541 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6542 | * bus when acting as outputs. |
| 6543 | */ |
| 6544 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6545 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6546 | |
| 6547 | /* Start with output sum widgets muted and their output gains at min */ |
| 6548 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6550 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6551 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6552 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6553 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6554 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6555 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6556 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6557 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6558 | /* Unmute Line-out pin widget amp left and right |
| 6559 | * (no equiv mixer ctrl) |
| 6560 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6561 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6562 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6563 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6564 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6565 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6566 | * will take care of enabling the pin's input/output buffers as needed. |
| 6567 | * Therefore there's no need to enable the input buffer at this |
| 6568 | * stage. |
| 6569 | */ |
| 6570 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6571 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6572 | |
| 6573 | /* Mute capture amp left and right */ |
| 6574 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6575 | /* Set ADC connection select to match default mixer setting - mic |
| 6576 | * (on mic1 pin) |
| 6577 | */ |
| 6578 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6579 | |
| 6580 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6581 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6582 | */ |
| 6583 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6584 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6585 | |
| 6586 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6587 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6588 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6592 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6593 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6594 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6595 | |
| 6596 | { } |
| 6597 | }; |
| 6598 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6599 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6600 | * (adapted from Acer init verbs). |
| 6601 | */ |
| 6602 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6603 | /* GPIO 0 enables the output jack. |
| 6604 | * Turn this on and rely on the standard mute |
| 6605 | * methods whenever the user wants to turn these outputs off. |
| 6606 | */ |
| 6607 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6608 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6609 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6610 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6611 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6612 | /* Ensure all other unused pins are disabled and muted. */ |
| 6613 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6614 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6615 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6616 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6617 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6618 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6620 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6621 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6623 | /* Disable digital (SPDIF) pins */ |
| 6624 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6625 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6626 | |
| 6627 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6628 | * bus when acting as outputs. |
| 6629 | */ |
| 6630 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6631 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6632 | |
| 6633 | /* Start with output sum widgets muted and their output gains at min */ |
| 6634 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6635 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6636 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6637 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6639 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6640 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6641 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6642 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6643 | |
| 6644 | /* Unmute Line-out pin widget amp left and right |
| 6645 | * (no equiv mixer ctrl) |
| 6646 | */ |
| 6647 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6648 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6649 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6650 | * will take care of enabling the pin's input/output buffers as needed. |
| 6651 | * Therefore there's no need to enable the input buffer at this |
| 6652 | * stage. |
| 6653 | */ |
| 6654 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6655 | |
| 6656 | /* Mute capture amp left and right */ |
| 6657 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6658 | /* Set ADC connection select to match default mixer setting - mic |
| 6659 | * (on mic1 pin) |
| 6660 | */ |
| 6661 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6662 | |
| 6663 | /* Do similar with the second ADC: mute capture input amp and |
| 6664 | * set ADC connection to mic to match ALSA's default state. |
| 6665 | */ |
| 6666 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6667 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6668 | |
| 6669 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6670 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6671 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6674 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6676 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6677 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6678 | |
| 6679 | { } |
| 6680 | }; |
| 6681 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6682 | static struct hda_verb alc260_will_verbs[] = { |
| 6683 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6684 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6685 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6686 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6687 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6688 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6689 | {} |
| 6690 | }; |
| 6691 | |
| 6692 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6693 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6694 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6695 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6696 | |
| 6697 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6698 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6699 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6700 | |
| 6701 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6702 | {} |
| 6703 | }; |
| 6704 | |
| 6705 | /* toggle speaker-output according to the hp-jack state */ |
| 6706 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6707 | { |
| 6708 | unsigned int present; |
| 6709 | |
| 6710 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6711 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6712 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6713 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6714 | AC_VERB_SET_GPIO_DATA, 1); |
| 6715 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6716 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6717 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6718 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6719 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6720 | AC_VERB_SET_GPIO_DATA, 0); |
| 6721 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6722 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6723 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6724 | } |
| 6725 | } |
| 6726 | |
| 6727 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6728 | unsigned int res) |
| 6729 | { |
| 6730 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6731 | alc260_replacer_672v_automute(codec); |
| 6732 | } |
| 6733 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6734 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6735 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6736 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6737 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6738 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6739 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6741 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6742 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6743 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6744 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6745 | {} |
| 6746 | }; |
| 6747 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6748 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6749 | * configuration. |
| 6750 | */ |
| 6751 | #ifdef CONFIG_SND_DEBUG |
| 6752 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6753 | 0x02, |
| 6754 | }; |
| 6755 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6756 | 0x04, 0x05, |
| 6757 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6758 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6759 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6760 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6761 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6762 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6763 | { |
| 6764 | .num_items = 7, |
| 6765 | .items = { |
| 6766 | { "MIC1 pin", 0x0 }, |
| 6767 | { "MIC2 pin", 0x1 }, |
| 6768 | { "LINE1 pin", 0x2 }, |
| 6769 | { "LINE2 pin", 0x3 }, |
| 6770 | { "CD pin", 0x4 }, |
| 6771 | { "LINE-OUT pin", 0x5 }, |
| 6772 | { "HP-OUT pin", 0x6 }, |
| 6773 | }, |
| 6774 | }, |
| 6775 | { |
| 6776 | .num_items = 8, |
| 6777 | .items = { |
| 6778 | { "MIC1 pin", 0x0 }, |
| 6779 | { "MIC2 pin", 0x1 }, |
| 6780 | { "LINE1 pin", 0x2 }, |
| 6781 | { "LINE2 pin", 0x3 }, |
| 6782 | { "CD pin", 0x4 }, |
| 6783 | { "Mixer", 0x5 }, |
| 6784 | { "LINE-OUT pin", 0x6 }, |
| 6785 | { "HP-OUT pin", 0x7 }, |
| 6786 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6787 | }, |
| 6788 | }; |
| 6789 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6790 | /* Output driver widgets */ |
| 6791 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6792 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6793 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6794 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6795 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6796 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6797 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6798 | /* Modes for retasking pin widgets |
| 6799 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6800 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6801 | * mention this restriction. At this stage it's not clear whether |
| 6802 | * this behaviour is intentional or is a hardware bug in chip |
| 6803 | * revisions available at least up until early 2006. Therefore for |
| 6804 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6805 | * choices, but if it turns out that the lack of mic bias for these |
| 6806 | * NIDs is intentional we could change their modes from |
| 6807 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6808 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6809 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6810 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6811 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6812 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6813 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6814 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6815 | |
| 6816 | /* Loopback mixer controls */ |
| 6817 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6818 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6819 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6820 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6821 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6822 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6823 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6824 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6825 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6826 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6827 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6828 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6829 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6830 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6831 | |
| 6832 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6833 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6834 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6835 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6836 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6837 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6838 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6839 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6840 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6841 | */ |
| 6842 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6843 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6844 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6845 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6846 | * this output to turn on an external amplifier. |
| 6847 | */ |
| 6848 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6849 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6850 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6851 | { } /* end */ |
| 6852 | }; |
| 6853 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6854 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6855 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6856 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6857 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6858 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6859 | /* Enable retasking pins as output, initially without power amp */ |
| 6860 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6861 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6862 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6863 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6864 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6865 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6866 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6867 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6868 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6869 | * payload also sets the generation to 0, output to be in "consumer" |
| 6870 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6871 | * control. |
| 6872 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6873 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6874 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6875 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6876 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6877 | * OUT1 sum bus when acting as an output. |
| 6878 | */ |
| 6879 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6880 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6881 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6882 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6883 | |
| 6884 | /* Start with output sum widgets muted and their output gains at min */ |
| 6885 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6886 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6887 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6888 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6890 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6891 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6892 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6893 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6894 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6895 | /* Unmute retasking pin widget output buffers since the default |
| 6896 | * state appears to be output. As the pin mode is changed by the |
| 6897 | * user the pin mode control will take care of enabling the pin's |
| 6898 | * input/output buffers as needed. |
| 6899 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6900 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6901 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6902 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6903 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6904 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6905 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6906 | /* Also unmute the mono-out pin widget */ |
| 6907 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6908 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6909 | /* Mute capture amp left and right */ |
| 6910 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6911 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6912 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6913 | */ |
| 6914 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6915 | |
| 6916 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6917 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6918 | */ |
| 6919 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6920 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6921 | |
| 6922 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6923 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6924 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6925 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6926 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6927 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6931 | |
| 6932 | { } |
| 6933 | }; |
| 6934 | #endif |
| 6935 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6936 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6937 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6938 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6939 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6940 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6941 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6942 | /* |
| 6943 | * for BIOS auto-configuration |
| 6944 | */ |
| 6945 | |
| 6946 | 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] | 6947 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6948 | { |
| 6949 | hda_nid_t nid_vol; |
| 6950 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6951 | int err; |
| 6952 | |
| 6953 | if (nid >= 0x0f && nid < 0x11) { |
| 6954 | nid_vol = nid - 0x7; |
| 6955 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6956 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6957 | } else if (nid == 0x11) { |
| 6958 | nid_vol = nid - 0x7; |
| 6959 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6960 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6961 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6962 | nid_vol = 0x08; |
| 6963 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6964 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6965 | } else |
| 6966 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6967 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6968 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6969 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6970 | 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] | 6971 | if (err < 0) |
| 6972 | return err; |
| 6973 | *vol_bits |= (1 << nid_vol); |
| 6974 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6975 | 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] | 6976 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6977 | return err; |
| 6978 | return 1; |
| 6979 | } |
| 6980 | |
| 6981 | /* add playback controls from the parsed DAC table */ |
| 6982 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6983 | const struct auto_pin_cfg *cfg) |
| 6984 | { |
| 6985 | hda_nid_t nid; |
| 6986 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6987 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6988 | |
| 6989 | spec->multiout.num_dacs = 1; |
| 6990 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6991 | spec->multiout.dac_nids[0] = 0x02; |
| 6992 | |
| 6993 | nid = cfg->line_out_pins[0]; |
| 6994 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6995 | const char *pfx; |
| 6996 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6997 | pfx = "Master"; |
| 6998 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6999 | pfx = "Speaker"; |
| 7000 | else |
| 7001 | pfx = "Front"; |
| 7002 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7003 | if (err < 0) |
| 7004 | return err; |
| 7005 | } |
| 7006 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7007 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7008 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7009 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7010 | if (err < 0) |
| 7011 | return err; |
| 7012 | } |
| 7013 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7014 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7015 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7016 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 7017 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7018 | if (err < 0) |
| 7019 | return err; |
| 7020 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7021 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7022 | } |
| 7023 | |
| 7024 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7025 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7026 | const struct auto_pin_cfg *cfg) |
| 7027 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7028 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7029 | } |
| 7030 | |
| 7031 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7032 | hda_nid_t nid, int pin_type, |
| 7033 | int sel_idx) |
| 7034 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7035 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7036 | /* need the manual connection? */ |
| 7037 | if (nid >= 0x12) { |
| 7038 | int idx = nid - 0x12; |
| 7039 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7040 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7041 | } |
| 7042 | } |
| 7043 | |
| 7044 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7045 | { |
| 7046 | struct alc_spec *spec = codec->spec; |
| 7047 | hda_nid_t nid; |
| 7048 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7049 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7050 | if (nid) { |
| 7051 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7052 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7053 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7054 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7055 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7056 | if (nid) |
| 7057 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7058 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7059 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7060 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7061 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7062 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7063 | |
| 7064 | #define ALC260_PIN_CD_NID 0x16 |
| 7065 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 7066 | { |
| 7067 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7068 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7069 | int i; |
| 7070 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7071 | for (i = 0; i < cfg->num_inputs; i++) { |
| 7072 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7073 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 7074 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 7075 | if (nid != ALC260_PIN_CD_NID && |
| 7076 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7077 | snd_hda_codec_write(codec, nid, 0, |
| 7078 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7079 | AMP_OUT_MUTE); |
| 7080 | } |
| 7081 | } |
| 7082 | } |
| 7083 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7084 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7085 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7086 | /* |
| 7087 | * generic initialization of ADC, input mixers and output mixers |
| 7088 | */ |
| 7089 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 7090 | /* |
| 7091 | * Unmute ADC0-1 and set the default input to mic-in |
| 7092 | */ |
| 7093 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7094 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7095 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7096 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7097 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7098 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7099 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7100 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7101 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7102 | */ |
| 7103 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7104 | /* mute analog inputs */ |
| 7105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7106 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7110 | |
| 7111 | /* |
| 7112 | * Set up output mixers (0x08 - 0x0a) |
| 7113 | */ |
| 7114 | /* set vol=0 to output mixers */ |
| 7115 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7117 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7118 | /* set up input amps for analog loopback */ |
| 7119 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7120 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7122 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7123 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7124 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7125 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7126 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7127 | { } |
| 7128 | }; |
| 7129 | |
| 7130 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7131 | { |
| 7132 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7133 | int err; |
| 7134 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 7135 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7136 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7137 | alc260_ignore); |
| 7138 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7139 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7140 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7141 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7142 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7143 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7144 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7145 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7146 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7147 | return err; |
| 7148 | |
| 7149 | spec->multiout.max_channels = 2; |
| 7150 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7151 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7152 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7153 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7154 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7155 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7156 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7157 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7158 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7159 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7160 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7161 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7162 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7163 | return 1; |
| 7164 | } |
| 7165 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7166 | /* additional initialization for auto-configuration model */ |
| 7167 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7168 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7169 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7170 | alc260_auto_init_multi_out(codec); |
| 7171 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7172 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7173 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7174 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7175 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7176 | } |
| 7177 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7178 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7179 | static struct hda_amp_list alc260_loopbacks[] = { |
| 7180 | { 0x07, HDA_INPUT, 0 }, |
| 7181 | { 0x07, HDA_INPUT, 1 }, |
| 7182 | { 0x07, HDA_INPUT, 2 }, |
| 7183 | { 0x07, HDA_INPUT, 3 }, |
| 7184 | { 0x07, HDA_INPUT, 4 }, |
| 7185 | { } /* end */ |
| 7186 | }; |
| 7187 | #endif |
| 7188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7189 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7190 | * Pin config fixes |
| 7191 | */ |
| 7192 | enum { |
| 7193 | PINFIX_HP_DC5750, |
| 7194 | }; |
| 7195 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7196 | static const struct alc_fixup alc260_fixups[] = { |
| 7197 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7198 | .type = ALC_FIXUP_PINS, |
| 7199 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7200 | { 0x11, 0x90130110 }, /* speaker */ |
| 7201 | { } |
| 7202 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7203 | }, |
| 7204 | }; |
| 7205 | |
| 7206 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 7207 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7208 | {} |
| 7209 | }; |
| 7210 | |
| 7211 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7212 | * ALC260 configurations |
| 7213 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7214 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7215 | [ALC260_BASIC] = "basic", |
| 7216 | [ALC260_HP] = "hp", |
| 7217 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7218 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7219 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7220 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7221 | [ALC260_WILL] = "will", |
| 7222 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7223 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7224 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7225 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7226 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7227 | [ALC260_AUTO] = "auto", |
| 7228 | }; |
| 7229 | |
| 7230 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7231 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7232 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7233 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7234 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7235 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7236 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7237 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7238 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7239 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7240 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7241 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7242 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7243 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7244 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7245 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7246 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7247 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7248 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7249 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7250 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7251 | {} |
| 7252 | }; |
| 7253 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7254 | static struct alc_config_preset alc260_presets[] = { |
| 7255 | [ALC260_BASIC] = { |
| 7256 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7257 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7258 | .init_verbs = { alc260_init_verbs }, |
| 7259 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7260 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7261 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7262 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7263 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7264 | .channel_mode = alc260_modes, |
| 7265 | .input_mux = &alc260_capture_source, |
| 7266 | }, |
| 7267 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7268 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7269 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7270 | .init_verbs = { alc260_init_verbs, |
| 7271 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7272 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7273 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7274 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7275 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7276 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7277 | .channel_mode = alc260_modes, |
| 7278 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 7279 | .unsol_event = alc_sku_unsol_event, |
| 7280 | .setup = alc260_hp_setup, |
| 7281 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7282 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7283 | [ALC260_HP_DC7600] = { |
| 7284 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7285 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7286 | .init_verbs = { alc260_init_verbs, |
| 7287 | alc260_hp_dc7600_verbs }, |
| 7288 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7289 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7290 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7291 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7292 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7293 | .channel_mode = alc260_modes, |
| 7294 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 7295 | .unsol_event = alc_sku_unsol_event, |
| 7296 | .setup = alc260_hp_3012_setup, |
| 7297 | .init_hook = alc_inithook, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7298 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7299 | [ALC260_HP_3013] = { |
| 7300 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7301 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7302 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7303 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7304 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7305 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7306 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7307 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7308 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7309 | .channel_mode = alc260_modes, |
| 7310 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 7311 | .unsol_event = alc_sku_unsol_event, |
| 7312 | .setup = alc260_hp_3013_setup, |
| 7313 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7314 | }, |
| 7315 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7316 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7317 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7318 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7319 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7320 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7321 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7322 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7323 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7324 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7325 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7326 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7327 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7328 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7329 | .init_verbs = { alc260_acer_init_verbs }, |
| 7330 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7331 | .dac_nids = alc260_dac_nids, |
| 7332 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7333 | .adc_nids = alc260_dual_adc_nids, |
| 7334 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7335 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7336 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7337 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7338 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7339 | [ALC260_FAVORIT100] = { |
| 7340 | .mixers = { alc260_favorit100_mixer }, |
| 7341 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7342 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7343 | .dac_nids = alc260_dac_nids, |
| 7344 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7345 | .adc_nids = alc260_dual_adc_nids, |
| 7346 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7347 | .channel_mode = alc260_modes, |
| 7348 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7349 | .input_mux = alc260_favorit100_capture_sources, |
| 7350 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7351 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7352 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7353 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7354 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7355 | .dac_nids = alc260_dac_nids, |
| 7356 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7357 | .adc_nids = alc260_adc_nids, |
| 7358 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7359 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7360 | .channel_mode = alc260_modes, |
| 7361 | .input_mux = &alc260_capture_source, |
| 7362 | }, |
| 7363 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7364 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7365 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7366 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7367 | .dac_nids = alc260_dac_nids, |
| 7368 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7369 | .adc_nids = alc260_adc_nids, |
| 7370 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7371 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7372 | .channel_mode = alc260_modes, |
| 7373 | .input_mux = &alc260_capture_source, |
| 7374 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7375 | .init_hook = alc260_replacer_672v_automute, |
| 7376 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7377 | #ifdef CONFIG_SND_DEBUG |
| 7378 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7379 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7380 | .init_verbs = { alc260_test_init_verbs }, |
| 7381 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7382 | .dac_nids = alc260_test_dac_nids, |
| 7383 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7384 | .adc_nids = alc260_test_adc_nids, |
| 7385 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7386 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7387 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7388 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7389 | }, |
| 7390 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7391 | }; |
| 7392 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7393 | static int patch_alc260(struct hda_codec *codec) |
| 7394 | { |
| 7395 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7396 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7397 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7398 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7399 | if (spec == NULL) |
| 7400 | return -ENOMEM; |
| 7401 | |
| 7402 | codec->spec = spec; |
| 7403 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7404 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7405 | alc260_models, |
| 7406 | alc260_cfg_tbl); |
| 7407 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7408 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7409 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7410 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7411 | } |
| 7412 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7413 | if (board_config == ALC260_AUTO) { |
| 7414 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7415 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7416 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7417 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7418 | if (board_config == ALC260_AUTO) { |
| 7419 | /* automatic parse from the BIOS config */ |
| 7420 | err = alc260_parse_auto_config(codec); |
| 7421 | if (err < 0) { |
| 7422 | alc_free(codec); |
| 7423 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7424 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7425 | printk(KERN_INFO |
| 7426 | "hda_codec: Cannot set up configuration " |
| 7427 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7428 | board_config = ALC260_BASIC; |
| 7429 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7430 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7431 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7432 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7433 | if (err < 0) { |
| 7434 | alc_free(codec); |
| 7435 | return err; |
| 7436 | } |
| 7437 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7438 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7439 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7441 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7442 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7443 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7444 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7445 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7446 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7447 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7448 | if (!spec->adc_nids && spec->input_mux) { |
| 7449 | /* check whether NID 0x04 is valid */ |
| 7450 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7451 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7452 | /* get type */ |
| 7453 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7454 | spec->adc_nids = alc260_adc_nids_alt; |
| 7455 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7456 | } else { |
| 7457 | spec->adc_nids = alc260_adc_nids; |
| 7458 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7459 | } |
| 7460 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7461 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7462 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7463 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7464 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7465 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7466 | spec->vmaster_nid = 0x08; |
| 7467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7468 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7469 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7470 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 7471 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7472 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7473 | if (!spec->loopback.amplist) |
| 7474 | spec->loopback.amplist = alc260_loopbacks; |
| 7475 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7476 | |
| 7477 | return 0; |
| 7478 | } |
| 7479 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7480 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7481 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7482 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7483 | * |
| 7484 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7485 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7486 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7487 | * 6-channel independent captures. |
| 7488 | * |
| 7489 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7490 | * driver yet). |
| 7491 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7492 | #define ALC882_DIGOUT_NID 0x06 |
| 7493 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7494 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7495 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7496 | #define ALC1200_DIGOUT_NID 0x10 |
| 7497 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7498 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7499 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7500 | { 8, NULL } |
| 7501 | }; |
| 7502 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7503 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7504 | static hda_nid_t alc882_dac_nids[4] = { |
| 7505 | /* front, rear, clfe, rear_surr */ |
| 7506 | 0x02, 0x03, 0x04, 0x05 |
| 7507 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7508 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7509 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7510 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7511 | #define alc882_adc_nids alc880_adc_nids |
| 7512 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7513 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7514 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7515 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7516 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7517 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7518 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7519 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7520 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7521 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7522 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7523 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7524 | /* input MUX */ |
| 7525 | /* FIXME: should be a matrix-type input source selection */ |
| 7526 | |
| 7527 | static struct hda_input_mux alc882_capture_source = { |
| 7528 | .num_items = 4, |
| 7529 | .items = { |
| 7530 | { "Mic", 0x0 }, |
| 7531 | { "Front Mic", 0x1 }, |
| 7532 | { "Line", 0x2 }, |
| 7533 | { "CD", 0x4 }, |
| 7534 | }, |
| 7535 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7536 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7537 | #define alc883_capture_source alc882_capture_source |
| 7538 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7539 | static struct hda_input_mux alc889_capture_source = { |
| 7540 | .num_items = 3, |
| 7541 | .items = { |
| 7542 | { "Front Mic", 0x0 }, |
| 7543 | { "Mic", 0x3 }, |
| 7544 | { "Line", 0x2 }, |
| 7545 | }, |
| 7546 | }; |
| 7547 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7548 | static struct hda_input_mux mb5_capture_source = { |
| 7549 | .num_items = 3, |
| 7550 | .items = { |
| 7551 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7552 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7553 | { "CD", 0x4 }, |
| 7554 | }, |
| 7555 | }; |
| 7556 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7557 | static struct hda_input_mux macmini3_capture_source = { |
| 7558 | .num_items = 2, |
| 7559 | .items = { |
| 7560 | { "Line", 0x2 }, |
| 7561 | { "CD", 0x4 }, |
| 7562 | }, |
| 7563 | }; |
| 7564 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7565 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7566 | .num_items = 4, |
| 7567 | .items = { |
| 7568 | { "Mic", 0x1 }, |
| 7569 | { "Front Mic", 0x0 }, |
| 7570 | { "Line", 0x2 }, |
| 7571 | { "CD", 0x4 }, |
| 7572 | }, |
| 7573 | }; |
| 7574 | |
| 7575 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7576 | .num_items = 2, |
| 7577 | .items = { |
| 7578 | { "Mic", 0x1 }, |
| 7579 | { "Line", 0x2 }, |
| 7580 | }, |
| 7581 | }; |
| 7582 | |
| 7583 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7584 | .num_items = 4, |
| 7585 | .items = { |
| 7586 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7587 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7588 | { "Line", 0x2 }, |
| 7589 | { "CD", 0x4 }, |
| 7590 | }, |
| 7591 | }; |
| 7592 | |
| 7593 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7594 | .num_items = 2, |
| 7595 | .items = { |
| 7596 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7597 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7598 | }, |
| 7599 | }; |
| 7600 | |
| 7601 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7602 | .num_items = 3, |
| 7603 | .items = { |
| 7604 | { "Mic", 0x0 }, |
| 7605 | { "Front Mic", 0x1 }, |
| 7606 | { "Line", 0x4 }, |
| 7607 | }, |
| 7608 | }; |
| 7609 | |
| 7610 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7611 | .num_items = 2, |
| 7612 | .items = { |
| 7613 | { "Mic", 0x0 }, |
| 7614 | { "Line", 0x2 }, |
| 7615 | }, |
| 7616 | }; |
| 7617 | |
| 7618 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7619 | .num_items = 2, |
| 7620 | .items = { |
| 7621 | { "Mic", 0x0 }, |
| 7622 | /* Front Mic (0x01) unused */ |
| 7623 | { "Line", 0x2 }, |
| 7624 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7625 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7626 | }, |
| 7627 | }; |
| 7628 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7629 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7630 | .num_items = 2, |
| 7631 | .items = { |
| 7632 | { "Mic", 0x01 }, |
| 7633 | { "Line", 0x2 }, /* Not sure! */ |
| 7634 | }, |
| 7635 | }; |
| 7636 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7637 | /* |
| 7638 | * 2ch mode |
| 7639 | */ |
| 7640 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7641 | { 2, NULL } |
| 7642 | }; |
| 7643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7644 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7645 | * 2ch mode |
| 7646 | */ |
| 7647 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7648 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7649 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7650 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7651 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7652 | { } /* end */ |
| 7653 | }; |
| 7654 | |
| 7655 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7656 | * 4ch mode |
| 7657 | */ |
| 7658 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7659 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7660 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7661 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7662 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7663 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7664 | { } /* end */ |
| 7665 | }; |
| 7666 | |
| 7667 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7668 | * 6ch mode |
| 7669 | */ |
| 7670 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7671 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7672 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7673 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7674 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7675 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7676 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7677 | { } /* end */ |
| 7678 | }; |
| 7679 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7680 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7681 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7682 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7683 | { 6, alc882_3ST_ch6_init }, |
| 7684 | }; |
| 7685 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7686 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7687 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7688 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7689 | * 2ch mode |
| 7690 | */ |
| 7691 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7692 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7693 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7694 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7695 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7696 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7697 | { } /* end */ |
| 7698 | }; |
| 7699 | |
| 7700 | /* |
| 7701 | * 4ch mode |
| 7702 | */ |
| 7703 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7704 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7705 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7706 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7707 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7708 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7709 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7710 | { } /* end */ |
| 7711 | }; |
| 7712 | |
| 7713 | /* |
| 7714 | * 6ch mode |
| 7715 | */ |
| 7716 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7717 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7718 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7719 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7720 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7721 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7722 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7723 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7724 | { } /* end */ |
| 7725 | }; |
| 7726 | |
| 7727 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7728 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7729 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7730 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7731 | }; |
| 7732 | |
| 7733 | |
| 7734 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7735 | * 6ch mode |
| 7736 | */ |
| 7737 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7738 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7739 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7740 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7741 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7742 | { } /* end */ |
| 7743 | }; |
| 7744 | |
| 7745 | /* |
| 7746 | * 8ch mode |
| 7747 | */ |
| 7748 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7749 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7750 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7751 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7752 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7753 | { } /* end */ |
| 7754 | }; |
| 7755 | |
| 7756 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7757 | { 6, alc882_sixstack_ch6_init }, |
| 7758 | { 8, alc882_sixstack_ch8_init }, |
| 7759 | }; |
| 7760 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7761 | |
| 7762 | /* Macbook Air 2,1 */ |
| 7763 | |
| 7764 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7765 | { 2, NULL }, |
| 7766 | }; |
| 7767 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7768 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7769 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7770 | */ |
| 7771 | |
| 7772 | /* |
| 7773 | * 2ch mode |
| 7774 | */ |
| 7775 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7776 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7777 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7778 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7779 | { } /* end */ |
| 7780 | }; |
| 7781 | |
| 7782 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7783 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7784 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7785 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7786 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7787 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7788 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7789 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7790 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7791 | { } /* end */ |
| 7792 | }; |
| 7793 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7794 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7795 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7796 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7797 | }; |
| 7798 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7799 | /* |
| 7800 | * 2ch |
| 7801 | * Speakers/Woofer/HP = Front |
| 7802 | * LineIn = Input |
| 7803 | */ |
| 7804 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7805 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7806 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7807 | { } /* end */ |
| 7808 | }; |
| 7809 | |
| 7810 | /* |
| 7811 | * 6ch mode |
| 7812 | * Speakers/HP = Front |
| 7813 | * Woofer = LFE |
| 7814 | * LineIn = Surround |
| 7815 | */ |
| 7816 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7817 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7818 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7819 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7820 | { } /* end */ |
| 7821 | }; |
| 7822 | |
| 7823 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7824 | { 2, alc885_mb5_ch2_init }, |
| 7825 | { 6, alc885_mb5_ch6_init }, |
| 7826 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7827 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7828 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7829 | |
| 7830 | /* |
| 7831 | * 2ch mode |
| 7832 | */ |
| 7833 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7834 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7835 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7836 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7837 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7838 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7839 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7840 | { } /* end */ |
| 7841 | }; |
| 7842 | |
| 7843 | /* |
| 7844 | * 4ch mode |
| 7845 | */ |
| 7846 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7847 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7848 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7849 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7850 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7851 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7852 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7853 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7854 | { } /* end */ |
| 7855 | }; |
| 7856 | |
| 7857 | /* |
| 7858 | * 6ch mode |
| 7859 | */ |
| 7860 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7861 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7862 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7863 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7864 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7865 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7866 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7867 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7868 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7869 | { } /* end */ |
| 7870 | }; |
| 7871 | |
| 7872 | /* |
| 7873 | * 8ch mode |
| 7874 | */ |
| 7875 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7876 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7877 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7878 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7879 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7880 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7881 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7882 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7883 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7884 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7885 | { } /* end */ |
| 7886 | }; |
| 7887 | |
| 7888 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7889 | { 2, alc883_4ST_ch2_init }, |
| 7890 | { 4, alc883_4ST_ch4_init }, |
| 7891 | { 6, alc883_4ST_ch6_init }, |
| 7892 | { 8, alc883_4ST_ch8_init }, |
| 7893 | }; |
| 7894 | |
| 7895 | |
| 7896 | /* |
| 7897 | * 2ch mode |
| 7898 | */ |
| 7899 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7900 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7901 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7902 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7903 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7904 | { } /* end */ |
| 7905 | }; |
| 7906 | |
| 7907 | /* |
| 7908 | * 4ch mode |
| 7909 | */ |
| 7910 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7911 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7912 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7913 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7914 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7915 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7916 | { } /* end */ |
| 7917 | }; |
| 7918 | |
| 7919 | /* |
| 7920 | * 6ch mode |
| 7921 | */ |
| 7922 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7923 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7924 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7925 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7926 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7927 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7928 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7929 | { } /* end */ |
| 7930 | }; |
| 7931 | |
| 7932 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7933 | { 2, alc883_3ST_ch2_intel_init }, |
| 7934 | { 4, alc883_3ST_ch4_intel_init }, |
| 7935 | { 6, alc883_3ST_ch6_intel_init }, |
| 7936 | }; |
| 7937 | |
| 7938 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7939 | * 2ch mode |
| 7940 | */ |
| 7941 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7942 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7943 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7944 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7945 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7946 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7947 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7948 | { } /* end */ |
| 7949 | }; |
| 7950 | |
| 7951 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7952 | * 6ch mode |
| 7953 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7954 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7955 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7956 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7957 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7958 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7959 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7960 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7961 | { } /* end */ |
| 7962 | }; |
| 7963 | |
| 7964 | /* |
| 7965 | * 8ch mode |
| 7966 | */ |
| 7967 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7968 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7969 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7970 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7971 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7972 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7973 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7974 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7975 | { } /* end */ |
| 7976 | }; |
| 7977 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7978 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7979 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7980 | { 6, alc889_ch6_intel_init }, |
| 7981 | { 8, alc889_ch8_intel_init }, |
| 7982 | }; |
| 7983 | |
| 7984 | /* |
| 7985 | * 6ch mode |
| 7986 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7987 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7988 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7989 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7990 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7991 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7992 | { } /* end */ |
| 7993 | }; |
| 7994 | |
| 7995 | /* |
| 7996 | * 8ch mode |
| 7997 | */ |
| 7998 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7999 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8000 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8001 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8002 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8003 | { } /* end */ |
| 8004 | }; |
| 8005 | |
| 8006 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 8007 | { 6, alc883_sixstack_ch6_init }, |
| 8008 | { 8, alc883_sixstack_ch8_init }, |
| 8009 | }; |
| 8010 | |
| 8011 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8012 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 8013 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 8014 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 8015 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8016 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8017 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8018 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8019 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8020 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8021 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8022 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8023 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8024 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8025 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8026 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8027 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8028 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8029 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8030 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8031 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8032 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8033 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8034 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8035 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8036 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8037 | { } /* end */ |
| 8038 | }; |
| 8039 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8040 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8041 | |
| 8042 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 8043 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8044 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8045 | { } |
| 8046 | }; |
| 8047 | |
| 8048 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8049 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8050 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8051 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8052 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8053 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8054 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8055 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8056 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8058 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8059 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8060 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8061 | { } /* end */ |
| 8062 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8063 | |
| 8064 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8065 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8066 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8067 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8068 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8069 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8070 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8071 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8072 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8073 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8074 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8075 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8076 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8077 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8078 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8079 | { } /* end */ |
| 8080 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8081 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8082 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 8083 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8084 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8085 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8086 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8087 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8088 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8089 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8090 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8092 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8093 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8094 | { } /* end */ |
| 8095 | }; |
| 8096 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8097 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8098 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8099 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8100 | { } /* end */ |
| 8101 | }; |
| 8102 | |
| 8103 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8104 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 8105 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8106 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8107 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8108 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8109 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8110 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8112 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8114 | { } /* end */ |
| 8115 | }; |
| 8116 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8117 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 8118 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8119 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8120 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8121 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8122 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8123 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8124 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8125 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8127 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8128 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8129 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8130 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8131 | { } /* end */ |
| 8132 | }; |
| 8133 | |
| 8134 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8135 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8136 | */ |
| 8137 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 8138 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8139 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8141 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8142 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8143 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8144 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8145 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8146 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8147 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8148 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8150 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8151 | { } /* end */ |
| 8152 | }; |
| 8153 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8154 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 8155 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8156 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8157 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8158 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8159 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8160 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8161 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8163 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8164 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8165 | { } /* end */ |
| 8166 | }; |
| 8167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8168 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 8169 | { |
| 8170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8171 | .name = "Channel Mode", |
| 8172 | .info = alc_ch_mode_info, |
| 8173 | .get = alc_ch_mode_get, |
| 8174 | .put = alc_ch_mode_put, |
| 8175 | }, |
| 8176 | { } /* end */ |
| 8177 | }; |
| 8178 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8179 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8180 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8181 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8182 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8183 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8184 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8185 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8186 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8187 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8188 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8189 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8190 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8191 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8192 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8193 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8194 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8195 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8196 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8197 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8200 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8201 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8202 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8203 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8204 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8205 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8206 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8207 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8208 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8209 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8210 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8211 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8212 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8213 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8214 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8215 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8216 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8217 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8218 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8219 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8220 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8221 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8222 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8223 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8224 | |
| 8225 | /* FIXME: use matrix-type input source selection */ |
| 8226 | /* 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] | 8227 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8228 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8229 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8230 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8231 | /* ADC2: mute amp left and right */ |
| 8232 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8233 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8234 | /* ADC3: mute amp left and right */ |
| 8235 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8236 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8237 | |
| 8238 | { } |
| 8239 | }; |
| 8240 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8241 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 8242 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8243 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8245 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8246 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8247 | /* ADC1: mute amp left and right */ |
| 8248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8249 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8250 | { } |
| 8251 | }; |
| 8252 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8253 | static struct hda_verb alc882_eapd_verbs[] = { |
| 8254 | /* change to EAPD mode */ |
| 8255 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8256 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8257 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8258 | }; |
| 8259 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8260 | static struct hda_verb alc889_eapd_verbs[] = { |
| 8261 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8262 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8263 | { } |
| 8264 | }; |
| 8265 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8266 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 8267 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8268 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8269 | {} |
| 8270 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8271 | |
| 8272 | static struct hda_verb alc885_init_verbs[] = { |
| 8273 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8274 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8276 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8277 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8278 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8279 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8280 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8281 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8282 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8283 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8284 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8285 | |
| 8286 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8287 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8289 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8290 | /* Front Pin: output 0 (0x0c) */ |
| 8291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8292 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8293 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8294 | /* Rear Pin: output 1 (0x0d) */ |
| 8295 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8296 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8297 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8298 | /* CLFE Pin: output 2 (0x0e) */ |
| 8299 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8300 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8301 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8302 | /* Side Pin: output 3 (0x0f) */ |
| 8303 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8304 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8305 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8306 | /* Mic (rear) pin: input vref at 80% */ |
| 8307 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8308 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8309 | /* Front Mic pin: input vref at 80% */ |
| 8310 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8311 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8312 | /* Line In pin: input */ |
| 8313 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8314 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8315 | |
| 8316 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8317 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8319 | /* Input mixer2 */ |
| 8320 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8321 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8322 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8323 | /* ADC2: mute amp left and right */ |
| 8324 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8325 | /* ADC3: mute amp left and right */ |
| 8326 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8327 | |
| 8328 | { } |
| 8329 | }; |
| 8330 | |
| 8331 | static struct hda_verb alc885_init_input_verbs[] = { |
| 8332 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8335 | { } |
| 8336 | }; |
| 8337 | |
| 8338 | |
| 8339 | /* Unmute Selector 24h and set the default input to front mic */ |
| 8340 | static struct hda_verb alc889_init_input_verbs[] = { |
| 8341 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8343 | { } |
| 8344 | }; |
| 8345 | |
| 8346 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8347 | #define alc883_init_verbs alc882_base_init_verbs |
| 8348 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8349 | /* Mac Pro test */ |
| 8350 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 8351 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8352 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8353 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8354 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8355 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8356 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8357 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8358 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8359 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8360 | { } /* end */ |
| 8361 | }; |
| 8362 | |
| 8363 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 8364 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8365 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8368 | /* Front Pin: output 0 (0x0c) */ |
| 8369 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8370 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8371 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8372 | /* Front Mic pin: input vref at 80% */ |
| 8373 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8374 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8375 | /* Speaker: output */ |
| 8376 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8377 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8378 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8379 | /* Headphone output (output 0 - 0x0c) */ |
| 8380 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8381 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8382 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8383 | |
| 8384 | /* FIXME: use matrix-type input source selection */ |
| 8385 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8386 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8389 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8390 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8391 | /* Input mixer2 */ |
| 8392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8395 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8396 | /* Input mixer3 */ |
| 8397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8401 | /* ADC1: mute amp left and right */ |
| 8402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8403 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8404 | /* ADC2: mute amp left and right */ |
| 8405 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8406 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8407 | /* ADC3: mute amp left and right */ |
| 8408 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8409 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8410 | |
| 8411 | { } |
| 8412 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8413 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8414 | /* Macbook 5,1 */ |
| 8415 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8416 | /* DACs */ |
| 8417 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8418 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8419 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8420 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8421 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8425 | /* Surround mixer */ |
| 8426 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8427 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8429 | /* LFE mixer */ |
| 8430 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8431 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8432 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8433 | /* HP mixer */ |
| 8434 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8435 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8436 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8437 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8438 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8439 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8440 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8441 | /* LFE Pin (0x0e) */ |
| 8442 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8443 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8444 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8445 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8446 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8447 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8448 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8449 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8450 | /* Front Mic pin: input vref at 80% */ |
| 8451 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8452 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8453 | /* Line In pin */ |
| 8454 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8455 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8456 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8460 | { } |
| 8461 | }; |
| 8462 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8463 | /* Macmini 3,1 */ |
| 8464 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8465 | /* DACs */ |
| 8466 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8467 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8468 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8469 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8470 | /* Front mixer */ |
| 8471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8474 | /* Surround mixer */ |
| 8475 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8476 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8477 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8478 | /* LFE mixer */ |
| 8479 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8480 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8481 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8482 | /* HP mixer */ |
| 8483 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8484 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8485 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8486 | /* Front Pin (0x0c) */ |
| 8487 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8488 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8489 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8490 | /* LFE Pin (0x0e) */ |
| 8491 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8492 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8493 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8494 | /* HP Pin (0x0f) */ |
| 8495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8498 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8499 | /* Line In pin */ |
| 8500 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8502 | |
| 8503 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8504 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8505 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8506 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8507 | { } |
| 8508 | }; |
| 8509 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8510 | |
| 8511 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8512 | /*Internal and HP Speaker Mixer*/ |
| 8513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8514 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8515 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8516 | /*Internal Speaker Pin (0x0c)*/ |
| 8517 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8518 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8519 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8520 | /* HP Pin: output 0 (0x0e) */ |
| 8521 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8522 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8523 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8524 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8525 | /* Line in (is hp when jack connected)*/ |
| 8526 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8527 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8528 | |
| 8529 | { } |
| 8530 | }; |
| 8531 | |
| 8532 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8533 | /* Macbook Pro rev3 */ |
| 8534 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8535 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8537 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8538 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8539 | /* Rear mixer */ |
| 8540 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8541 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8542 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8543 | /* HP mixer */ |
| 8544 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8545 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8546 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8547 | /* Front Pin: output 0 (0x0c) */ |
| 8548 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8549 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8550 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8551 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8552 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8553 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8554 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8555 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8556 | /* Mic (rear) pin: input vref at 80% */ |
| 8557 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8558 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8559 | /* Front Mic pin: input vref at 80% */ |
| 8560 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8561 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8562 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8563 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8564 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8565 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8566 | |
| 8567 | /* FIXME: use matrix-type input source selection */ |
| 8568 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8569 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8570 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8571 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8572 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8573 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8574 | /* Input mixer2 */ |
| 8575 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8577 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8578 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8579 | /* Input mixer3 */ |
| 8580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8583 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8584 | /* ADC1: mute amp left and right */ |
| 8585 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8586 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8587 | /* ADC2: mute amp left and right */ |
| 8588 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8589 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8590 | /* ADC3: mute amp left and right */ |
| 8591 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8592 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8593 | |
| 8594 | { } |
| 8595 | }; |
| 8596 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8597 | /* iMac 9,1 */ |
| 8598 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8599 | /* Internal Speaker Pin (0x0c) */ |
| 8600 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8601 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8602 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8603 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8604 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8605 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8606 | /* HP Pin: Rear */ |
| 8607 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8608 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8609 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8610 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8611 | /* Line in Rear */ |
| 8612 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8613 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8614 | /* Front Mic pin: input vref at 80% */ |
| 8615 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8616 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8617 | /* Rear mixer */ |
| 8618 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8621 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8622 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8623 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8625 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8626 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8627 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8629 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8630 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8631 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8632 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8635 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8637 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8640 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8641 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8642 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8643 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8644 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8645 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8646 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8647 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8648 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8649 | { } |
| 8650 | }; |
| 8651 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8652 | /* iMac 24 mixer. */ |
| 8653 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8654 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8655 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8656 | { } /* end */ |
| 8657 | }; |
| 8658 | |
| 8659 | /* iMac 24 init verbs. */ |
| 8660 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8661 | /* Internal speakers: output 0 (0x0c) */ |
| 8662 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8663 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8664 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8665 | /* Internal speakers: output 0 (0x0c) */ |
| 8666 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8667 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8668 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8669 | /* Headphone: output 0 (0x0c) */ |
| 8670 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8671 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8672 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8673 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8674 | /* Front Mic: input vref at 80% */ |
| 8675 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8676 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8677 | { } |
| 8678 | }; |
| 8679 | |
| 8680 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8681 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8682 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8683 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8684 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8685 | spec->autocfg.hp_pins[0] = 0x14; |
| 8686 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8687 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8688 | spec->automute = 1; |
| 8689 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8690 | } |
| 8691 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8692 | #define alc885_mb5_setup alc885_imac24_setup |
| 8693 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8694 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8695 | /* Macbook Air 2,1 */ |
| 8696 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8697 | { |
| 8698 | struct alc_spec *spec = codec->spec; |
| 8699 | |
| 8700 | spec->autocfg.hp_pins[0] = 0x14; |
| 8701 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8702 | spec->automute = 1; |
| 8703 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8704 | } |
| 8705 | |
| 8706 | |
| 8707 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8708 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8709 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8710 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8711 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8712 | spec->autocfg.hp_pins[0] = 0x15; |
| 8713 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8714 | spec->automute = 1; |
| 8715 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8716 | } |
| 8717 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8718 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8719 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8720 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8721 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8722 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8723 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8724 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8725 | spec->automute = 1; |
| 8726 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8727 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8728 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8729 | static struct hda_verb alc882_targa_verbs[] = { |
| 8730 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8731 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8732 | |
| 8733 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8734 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8735 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8736 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8737 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8738 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8739 | |
| 8740 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8741 | { } /* end */ |
| 8742 | }; |
| 8743 | |
| 8744 | /* toggle speaker-output according to the hp-jack state */ |
| 8745 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8746 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8747 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8748 | alc_hp_automute(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8749 | 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] | 8750 | spec->jack_present ? 1 : 3); |
| 8751 | } |
| 8752 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8753 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8754 | { |
| 8755 | struct alc_spec *spec = codec->spec; |
| 8756 | |
| 8757 | spec->autocfg.hp_pins[0] = 0x14; |
| 8758 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8759 | spec->automute = 1; |
| 8760 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8761 | } |
| 8762 | |
| 8763 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8764 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8765 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8766 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8767 | } |
| 8768 | |
| 8769 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8770 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8771 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8772 | |
| 8773 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8774 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8775 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8776 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8777 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8778 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8779 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8780 | |
| 8781 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8782 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8783 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8784 | { } /* end */ |
| 8785 | }; |
| 8786 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8787 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8789 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8790 | |
| 8791 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8792 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8793 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8794 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8795 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8796 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8797 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8798 | |
| 8799 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8800 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8801 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8802 | { } /* end */ |
| 8803 | }; |
| 8804 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8805 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8806 | { |
| 8807 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8808 | |
| 8809 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8810 | AC_VERB_GET_GPIO_DATA, 0); |
| 8811 | |
| 8812 | if (!muted) |
| 8813 | gpiostate |= (1 << pin); |
| 8814 | else |
| 8815 | gpiostate &= ~(1 << pin); |
| 8816 | |
| 8817 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8818 | AC_VERB_GET_GPIO_MASK, 0); |
| 8819 | gpiomask |= (1 << pin); |
| 8820 | |
| 8821 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8822 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8823 | gpiodir |= (1 << pin); |
| 8824 | |
| 8825 | |
| 8826 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8827 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8828 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8829 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8830 | |
| 8831 | msleep(1); |
| 8832 | |
| 8833 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8834 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8835 | } |
| 8836 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8837 | /* set up GPIO at initialization */ |
| 8838 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8839 | { |
| 8840 | alc882_gpio_mute(codec, 0, 0); |
| 8841 | alc882_gpio_mute(codec, 1, 0); |
| 8842 | } |
| 8843 | |
| 8844 | /* set up GPIO and update auto-muting at initialization */ |
| 8845 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8846 | { |
| 8847 | alc885_macpro_init_hook(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8848 | alc_hp_automute(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8849 | } |
| 8850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8851 | /* |
| 8852 | * generic initialization of ADC, input mixers and output mixers |
| 8853 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8854 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8855 | /* |
| 8856 | * Unmute ADC0-2 and set the default input to mic-in |
| 8857 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8858 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8859 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8860 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8861 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8863 | /* |
| 8864 | * Set up output mixers (0x0c - 0x0f) |
| 8865 | */ |
| 8866 | /* set vol=0 to output mixers */ |
| 8867 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8868 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8869 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8870 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8871 | /* set up input amps for analog loopback */ |
| 8872 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8873 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8874 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8875 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8876 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8877 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8878 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8879 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8880 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8881 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8882 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8883 | |
| 8884 | /* FIXME: use matrix-type input source selection */ |
| 8885 | /* 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] | 8886 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8888 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8890 | { } |
| 8891 | }; |
| 8892 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8893 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8894 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8895 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8896 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8897 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8898 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8899 | { } /* end */ |
| 8900 | }; |
| 8901 | |
| 8902 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8903 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8904 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8905 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8906 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8907 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8908 | { } /* end */ |
| 8909 | }; |
| 8910 | |
| 8911 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8912 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8913 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8915 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8916 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8917 | { } /* end */ |
| 8918 | }; |
| 8919 | |
| 8920 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8921 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8922 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8923 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8924 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8925 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8926 | { } /* end */ |
| 8927 | }; |
| 8928 | |
| 8929 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8930 | { 2, alc889A_mb31_ch2_init }, |
| 8931 | { 4, alc889A_mb31_ch4_init }, |
| 8932 | { 5, alc889A_mb31_ch5_init }, |
| 8933 | { 6, alc889A_mb31_ch6_init }, |
| 8934 | }; |
| 8935 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8936 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8937 | /* eanable EAPD on medion laptop */ |
| 8938 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8939 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8940 | { } |
| 8941 | }; |
| 8942 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8943 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8944 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8945 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8946 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8947 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8948 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8949 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8950 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8951 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8952 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8953 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8954 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8956 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8957 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8958 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8959 | { } /* end */ |
| 8960 | }; |
| 8961 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8962 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8963 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8964 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8965 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8966 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8967 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8968 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8969 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8970 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8971 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8972 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8973 | { } /* end */ |
| 8974 | }; |
| 8975 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8976 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8977 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8978 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8979 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8980 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8981 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8982 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8983 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8984 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8985 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 8986 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8987 | { } /* end */ |
| 8988 | }; |
| 8989 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8990 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8991 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8992 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8993 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8994 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8995 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8996 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8997 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8998 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8999 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9000 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9001 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9002 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9003 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9004 | { } /* end */ |
| 9005 | }; |
| 9006 | |
| 9007 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 9008 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9009 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9010 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9011 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9012 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9013 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9014 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9015 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9016 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9017 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9018 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9019 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9020 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9021 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9022 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9024 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9025 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9026 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9027 | { } /* end */ |
| 9028 | }; |
| 9029 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9030 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 9031 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9032 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9033 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9034 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9035 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9036 | HDA_OUTPUT), |
| 9037 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9038 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9039 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9040 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9041 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9042 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9043 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9044 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9046 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9047 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9048 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9049 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9050 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9051 | { } /* end */ |
| 9052 | }; |
| 9053 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9054 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 9055 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9056 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9057 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9058 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9059 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9060 | HDA_OUTPUT), |
| 9061 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9062 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9063 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9064 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9065 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9066 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9067 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9068 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9070 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9072 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9073 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9074 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9075 | { } /* end */ |
| 9076 | }; |
| 9077 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 9078 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9079 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9080 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9081 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9082 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9083 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9084 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9085 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9086 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9087 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9088 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9089 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9090 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9091 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9093 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9095 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9096 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9097 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9098 | { } /* end */ |
| 9099 | }; |
| 9100 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9101 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9102 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9103 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9104 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9105 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9106 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9107 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9108 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9109 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9110 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9111 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9112 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9113 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9114 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9115 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9117 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9119 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9120 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9121 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9122 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9124 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9125 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9126 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9128 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9130 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9132 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9133 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9134 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9135 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9136 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9137 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9138 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 9139 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9140 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9141 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9142 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9143 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9144 | { } /* end */ |
| 9145 | }; |
| 9146 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9147 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 9148 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9149 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9150 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9151 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9153 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9154 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9156 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9157 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9158 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9159 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 9160 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9161 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9162 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9167 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9168 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9169 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9170 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9171 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9172 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 9173 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9174 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9175 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9176 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9177 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9178 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9179 | { } /* end */ |
| 9180 | }; |
| 9181 | |
| 9182 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 9183 | /* Unmute front mixer */ |
| 9184 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9185 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9186 | |
| 9187 | /* Set speaker pin to front mixer */ |
| 9188 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9189 | |
| 9190 | /* Init headphone pin */ |
| 9191 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9192 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9193 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9194 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9195 | |
| 9196 | { } /* end */ |
| 9197 | }; |
| 9198 | |
| 9199 | /* toggle speaker-output according to the hp-jack state */ |
| 9200 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9201 | { |
| 9202 | struct alc_spec *spec = codec->spec; |
| 9203 | |
| 9204 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9205 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9206 | spec->automute = 1; |
| 9207 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9208 | } |
| 9209 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9210 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9211 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9212 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9213 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9215 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9217 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9219 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9220 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9221 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9222 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 9223 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9224 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9225 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9226 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9228 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9229 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9230 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9232 | { } /* end */ |
| 9233 | }; |
| 9234 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9235 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 9236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9237 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9238 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9239 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9240 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9241 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9242 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9243 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9244 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9245 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9246 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9247 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9248 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9249 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9250 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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 | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9254 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9255 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9256 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9257 | { } /* end */ |
| 9258 | }; |
| 9259 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9260 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 9261 | /* Output mixers */ |
| 9262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9263 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9264 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9265 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9266 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9267 | HDA_OUTPUT), |
| 9268 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9269 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9270 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9271 | /* Output switches */ |
| 9272 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9273 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9274 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9275 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9276 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9277 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9278 | /* Input mixers */ |
| 9279 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9280 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9281 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9282 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9283 | { } /* end */ |
| 9284 | }; |
| 9285 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9286 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 9287 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9288 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9290 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9291 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9293 | { } /* end */ |
| 9294 | }; |
| 9295 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9296 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 9297 | .ops = &snd_hda_bind_vol, |
| 9298 | .values = { |
| 9299 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9300 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9301 | 0 |
| 9302 | }, |
| 9303 | }; |
| 9304 | |
| 9305 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 9306 | .ops = &snd_hda_bind_sw, |
| 9307 | .values = { |
| 9308 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9309 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9310 | 0 |
| 9311 | }, |
| 9312 | }; |
| 9313 | |
| 9314 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 9315 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9316 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9317 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9318 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9319 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9320 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9321 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9322 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9323 | { } /* end */ |
| 9324 | }; |
| 9325 | |
| 9326 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9327 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9328 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9329 | { |
| 9330 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9331 | /* .name = "Capture Source", */ |
| 9332 | .name = "Input Source", |
| 9333 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9334 | .info = alc_mux_enum_info, |
| 9335 | .get = alc_mux_enum_get, |
| 9336 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9337 | }, |
| 9338 | { } /* end */ |
| 9339 | }; |
| 9340 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9341 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 9342 | { |
| 9343 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9344 | .name = "Channel Mode", |
| 9345 | .info = alc_ch_mode_info, |
| 9346 | .get = alc_ch_mode_get, |
| 9347 | .put = alc_ch_mode_put, |
| 9348 | }, |
| 9349 | { } /* end */ |
| 9350 | }; |
| 9351 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9352 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9353 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9354 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9355 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9356 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9357 | spec->autocfg.hp_pins[0] = 0x15; |
| 9358 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9359 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9360 | spec->automute = 1; |
| 9361 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9362 | } |
| 9363 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9364 | static struct hda_verb alc883_mitac_verbs[] = { |
| 9365 | /* HP */ |
| 9366 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9367 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9368 | /* Subwoofer */ |
| 9369 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9370 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9371 | |
| 9372 | /* enable unsolicited event */ |
| 9373 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9374 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9375 | |
| 9376 | { } /* end */ |
| 9377 | }; |
| 9378 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9379 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9380 | /* HP */ |
| 9381 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9383 | /* Int speaker */ |
| 9384 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9385 | |
| 9386 | /* enable unsolicited event */ |
| 9387 | /* |
| 9388 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9389 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9390 | */ |
| 9391 | |
| 9392 | { } /* end */ |
| 9393 | }; |
| 9394 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9395 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9396 | /* HP */ |
| 9397 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9398 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9399 | /* Int speaker */ |
| 9400 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9401 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9402 | |
| 9403 | /* enable unsolicited event */ |
| 9404 | {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] | 9405 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9406 | |
| 9407 | { } /* end */ |
| 9408 | }; |
| 9409 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9410 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9411 | /* HP */ |
| 9412 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9413 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9414 | /* Subwoofer */ |
| 9415 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9416 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9417 | |
| 9418 | /* enable unsolicited event */ |
| 9419 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9420 | |
| 9421 | { } /* end */ |
| 9422 | }; |
| 9423 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9424 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9426 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9427 | |
| 9428 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9429 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9430 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9431 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9432 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9433 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9434 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9435 | /* Connect Mic jack to CLFE */ |
| 9436 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9437 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9438 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9439 | /* Connect Line-in jack to Surround */ |
| 9440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9441 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9442 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9443 | /* Connect HP out jack to Front */ |
| 9444 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9445 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9446 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9447 | |
| 9448 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9449 | |
| 9450 | { } /* end */ |
| 9451 | }; |
| 9452 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9453 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9454 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9455 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9456 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9457 | { } /* end */ |
| 9458 | }; |
| 9459 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9460 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9461 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9462 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9463 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9465 | { } /* end */ |
| 9466 | }; |
| 9467 | |
| 9468 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9470 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9471 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9472 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9473 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9474 | { } /* end */ |
| 9475 | }; |
| 9476 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9477 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9478 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9479 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9480 | |
| 9481 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9482 | |
| 9483 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9484 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9485 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9486 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9487 | { } /* end */ |
| 9488 | }; |
| 9489 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9490 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9492 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9493 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9494 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9495 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9496 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9497 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9498 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9499 | { } /* end */ |
| 9500 | }; |
| 9501 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9502 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9503 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9504 | { } |
| 9505 | }; |
| 9506 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9507 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9508 | /* HP */ |
| 9509 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9510 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9511 | |
| 9512 | /* enable unsolicited event */ |
| 9513 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9514 | |
| 9515 | { } /* end */ |
| 9516 | }; |
| 9517 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9518 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9519 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9520 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9521 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9522 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9523 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9524 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9525 | spec->autocfg.speaker_pins[2] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9526 | spec->automute = 1; |
| 9527 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9528 | } |
| 9529 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9530 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9531 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9532 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9533 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9534 | {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] | 9535 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9536 | }; |
| 9537 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9538 | /* |
| 9539 | * 2ch mode |
| 9540 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9541 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9542 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9543 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9544 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9545 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9546 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9547 | }; |
| 9548 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9549 | /* |
| 9550 | * 4ch mode |
| 9551 | */ |
| 9552 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9553 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9554 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9555 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9556 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9557 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9558 | { } /* end */ |
| 9559 | }; |
| 9560 | |
| 9561 | /* |
| 9562 | * 6ch mode |
| 9563 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9564 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9565 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9566 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9567 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9568 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9569 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9570 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9571 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9572 | }; |
| 9573 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9574 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9575 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9576 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9577 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9578 | }; |
| 9579 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9580 | static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9581 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9582 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9583 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9584 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9585 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9586 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9587 | spec->automute = 1; |
| 9588 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9589 | } |
| 9590 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9591 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9592 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9593 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9594 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9595 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9596 | spec->autocfg.hp_pins[0] = 0x14; |
| 9597 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9598 | spec->automute = 1; |
| 9599 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9600 | } |
| 9601 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9602 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9603 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9604 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9605 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9606 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9607 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9608 | struct alc_spec *spec = codec->spec; |
| 9609 | |
| 9610 | spec->autocfg.hp_pins[0] = 0x15; |
| 9611 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9612 | spec->automute = 1; |
| 9613 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9614 | } |
| 9615 | |
| 9616 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9617 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9618 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9619 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9620 | } |
| 9621 | |
| 9622 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9623 | unsigned int res) |
| 9624 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9625 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9626 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9627 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9628 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9629 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9630 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9631 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9632 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9633 | } |
| 9634 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9635 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9636 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9637 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9638 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9639 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9640 | spec->autocfg.hp_pins[0] = 0x14; |
| 9641 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9642 | spec->automute = 1; |
| 9643 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9644 | } |
| 9645 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9646 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9647 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9648 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9649 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9650 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9651 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9652 | spec->automute = 1; |
| 9653 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9654 | } |
| 9655 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9656 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9657 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9658 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9659 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9660 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9661 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9662 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9663 | spec->automute = 1; |
| 9664 | spec->detect_line = 1; |
| 9665 | spec->automute_lines = 1; |
| 9666 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9667 | } |
| 9668 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9669 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9670 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9671 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9672 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9673 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9674 | spec->autocfg.hp_pins[0] = 0x14; |
| 9675 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9676 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9677 | spec->automute = 1; |
| 9678 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9679 | } |
| 9680 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9681 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9682 | /* HP Pin: output 0 (0x0c) */ |
| 9683 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9684 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9685 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9686 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9688 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9689 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9690 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9691 | /* eanable EAPD on medion laptop */ |
| 9692 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9693 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9694 | /* enable unsolicited event */ |
| 9695 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9696 | { } |
| 9697 | }; |
| 9698 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9699 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9700 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9701 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9702 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9703 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9704 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9705 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9706 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9707 | spec->autocfg.speaker_pins[3] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9708 | spec->automute = 1; |
| 9709 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9710 | } |
| 9711 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9712 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9713 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9714 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9715 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9716 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9717 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9718 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9719 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9720 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9721 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9722 | spec->automute = 1; |
| 9723 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9724 | } |
| 9725 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9726 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9727 | { |
| 9728 | struct alc_spec *spec = codec->spec; |
| 9729 | |
| 9730 | spec->autocfg.hp_pins[0] = 0x15; |
| 9731 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9732 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9733 | spec->automute = 1; |
| 9734 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9735 | } |
| 9736 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9737 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9738 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9739 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9740 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9741 | /* enable unsolicited event */ |
| 9742 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9743 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9744 | { } /* end */ |
| 9745 | }; |
| 9746 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9747 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9748 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9749 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9750 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9751 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9752 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9753 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9754 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9755 | spec->ext_mic.pin = 0x18; |
| 9756 | spec->int_mic.pin = 0x19; |
| 9757 | spec->ext_mic.mux_idx = 0; |
| 9758 | spec->int_mic.mux_idx = 1; |
| 9759 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9760 | spec->automute = 1; |
| 9761 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9762 | } |
| 9763 | |
| 9764 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9766 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9767 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9768 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9769 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9770 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9771 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9772 | /* enable unsolicited event */ |
| 9773 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9774 | { } /* end */ |
| 9775 | }; |
| 9776 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9777 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9778 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9779 | struct alc_spec *spec = codec->spec; |
| 9780 | |
| 9781 | spec->autocfg.hp_pins[0] = 0x14; |
| 9782 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9783 | alc_hp_automute(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9784 | } |
| 9785 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9786 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9787 | /* Init rear pin (used as headphone output) */ |
| 9788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9789 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9790 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9791 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9792 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9793 | /* Init line 2 pin (used as headphone out by default) */ |
| 9794 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9795 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9796 | { } /* end */ |
| 9797 | }; |
| 9798 | |
| 9799 | /* Mute speakers according to the headphone jack state */ |
| 9800 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9801 | { |
| 9802 | unsigned int present; |
| 9803 | |
| 9804 | /* Mute only in 2ch or 4ch mode */ |
| 9805 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9806 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9807 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9808 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9809 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9810 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9811 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9812 | } |
| 9813 | } |
| 9814 | |
| 9815 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9816 | { |
| 9817 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9818 | alc889A_mb31_automute(codec); |
| 9819 | } |
| 9820 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9821 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9822 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9823 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9824 | #endif |
| 9825 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9826 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9827 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9828 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9829 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9830 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9831 | |
| 9832 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9833 | ALC1200_DIGOUT_NID, 0, |
| 9834 | }; |
| 9835 | |
| 9836 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9837 | ALC883_DIGOUT_NID, 0, |
| 9838 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9839 | |
| 9840 | /* |
| 9841 | * configuration and preset |
| 9842 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9843 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9844 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9845 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9846 | [ALC882_ARIMA] = "arima", |
| 9847 | [ALC882_W2JC] = "w2jc", |
| 9848 | [ALC882_TARGA] = "targa", |
| 9849 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9850 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9851 | [ALC885_MACPRO] = "macpro", |
| 9852 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9853 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9854 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9855 | [ALC885_MBP3] = "mbp3", |
| 9856 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9857 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9858 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9859 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9860 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9861 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9862 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9863 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9864 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9865 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9866 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9867 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9868 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9869 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9870 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9871 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9872 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9873 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9874 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9875 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9876 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9877 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9878 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9879 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9880 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9881 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9882 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9883 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9884 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9885 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9886 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9887 | [ALC889A_INTEL] = "intel-alc889a", |
| 9888 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9889 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9890 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9891 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9892 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9893 | }; |
| 9894 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9895 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9896 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9897 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9898 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9899 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9900 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9901 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9902 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9903 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9904 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9905 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9906 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9907 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9908 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9909 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9910 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9911 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9912 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9913 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9914 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9915 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9916 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9917 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9918 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9919 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9920 | /* default Acer -- disabled as it causes more problems. |
| 9921 | * model=auto should work fine now |
| 9922 | */ |
| 9923 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9924 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9925 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9926 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9927 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9928 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9929 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9930 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9931 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9932 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9933 | |
| 9934 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9935 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9936 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9937 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9938 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9939 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9940 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9941 | 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] | 9942 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9943 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9944 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9945 | |
| 9946 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9947 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9948 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9949 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9950 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9951 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9952 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9953 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9954 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9955 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9956 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9957 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9958 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9959 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9960 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9961 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9962 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9963 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9964 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9965 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9966 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9967 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9968 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9969 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9970 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9971 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9972 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9973 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9974 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9975 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9976 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9977 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9978 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9979 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9980 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9981 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9982 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9983 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9984 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9985 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9986 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9987 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9988 | 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] | 9989 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9990 | 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] | 9991 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9992 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9993 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9994 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9995 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9996 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9997 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9998 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9999 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10000 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10001 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10002 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 10003 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10004 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 10005 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 10006 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10007 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10008 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10009 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 10010 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10011 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10012 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 10013 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 10014 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 10015 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10016 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10017 | {} |
| 10018 | }; |
| 10019 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10020 | /* codec SSID table for Intel Mac */ |
| 10021 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 10022 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 10023 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 10024 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 10025 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 10026 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 10027 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 10028 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 10029 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 10030 | 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] | 10031 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 10032 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10033 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10034 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10035 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10036 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10037 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10038 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10039 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10040 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10041 | */ |
| 10042 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10043 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10044 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10045 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10046 | }; |
| 10047 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10048 | static struct alc_config_preset alc882_presets[] = { |
| 10049 | [ALC882_3ST_DIG] = { |
| 10050 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10051 | .init_verbs = { alc882_base_init_verbs, |
| 10052 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10053 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10054 | .dac_nids = alc882_dac_nids, |
| 10055 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10056 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10057 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10058 | .channel_mode = alc882_ch_modes, |
| 10059 | .need_dac_fix = 1, |
| 10060 | .input_mux = &alc882_capture_source, |
| 10061 | }, |
| 10062 | [ALC882_6ST_DIG] = { |
| 10063 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10064 | .init_verbs = { alc882_base_init_verbs, |
| 10065 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10066 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10067 | .dac_nids = alc882_dac_nids, |
| 10068 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10069 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10070 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10071 | .channel_mode = alc882_sixstack_modes, |
| 10072 | .input_mux = &alc882_capture_source, |
| 10073 | }, |
| 10074 | [ALC882_ARIMA] = { |
| 10075 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10076 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10077 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10078 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10079 | .dac_nids = alc882_dac_nids, |
| 10080 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10081 | .channel_mode = alc882_sixstack_modes, |
| 10082 | .input_mux = &alc882_capture_source, |
| 10083 | }, |
| 10084 | [ALC882_W2JC] = { |
| 10085 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10086 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10087 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10088 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10089 | .dac_nids = alc882_dac_nids, |
| 10090 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10091 | .channel_mode = alc880_threestack_modes, |
| 10092 | .need_dac_fix = 1, |
| 10093 | .input_mux = &alc882_capture_source, |
| 10094 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10095 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10096 | [ALC885_MBA21] = { |
| 10097 | .mixers = { alc885_mba21_mixer }, |
| 10098 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10099 | .num_dacs = 2, |
| 10100 | .dac_nids = alc882_dac_nids, |
| 10101 | .channel_mode = alc885_mba21_ch_modes, |
| 10102 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10103 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10104 | .unsol_event = alc_sku_unsol_event, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10105 | .setup = alc885_mba21_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10106 | .init_hook = alc_hp_automute, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10107 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10108 | [ALC885_MBP3] = { |
| 10109 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10110 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10111 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10112 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10113 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10114 | .hp_nid = 0x04, |
| 10115 | .channel_mode = alc885_mbp_4ch_modes, |
| 10116 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10117 | .input_mux = &alc882_capture_source, |
| 10118 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10119 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10120 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10121 | .setup = alc885_mbp3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10122 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10123 | }, |
| 10124 | [ALC885_MB5] = { |
| 10125 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10126 | .init_verbs = { alc885_mb5_init_verbs, |
| 10127 | alc880_gpio1_init_verbs }, |
| 10128 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10129 | .dac_nids = alc882_dac_nids, |
| 10130 | .channel_mode = alc885_mb5_6ch_modes, |
| 10131 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10132 | .input_mux = &mb5_capture_source, |
| 10133 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10134 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10135 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10136 | .setup = alc885_mb5_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10137 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10138 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10139 | [ALC885_MACMINI3] = { |
| 10140 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10141 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10142 | alc880_gpio1_init_verbs }, |
| 10143 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10144 | .dac_nids = alc882_dac_nids, |
| 10145 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10146 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10147 | .input_mux = &macmini3_capture_source, |
| 10148 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10149 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10150 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10151 | .setup = alc885_macmini3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10152 | .init_hook = alc_hp_automute, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10153 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10154 | [ALC885_MACPRO] = { |
| 10155 | .mixers = { alc882_macpro_mixer }, |
| 10156 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10157 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10158 | .dac_nids = alc882_dac_nids, |
| 10159 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10160 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10161 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10162 | .channel_mode = alc882_ch_modes, |
| 10163 | .input_mux = &alc882_capture_source, |
| 10164 | .init_hook = alc885_macpro_init_hook, |
| 10165 | }, |
| 10166 | [ALC885_IMAC24] = { |
| 10167 | .mixers = { alc885_imac24_mixer }, |
| 10168 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10169 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10170 | .dac_nids = alc882_dac_nids, |
| 10171 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10172 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10173 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10174 | .channel_mode = alc882_ch_modes, |
| 10175 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10176 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10177 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10178 | .init_hook = alc885_imac24_init_hook, |
| 10179 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10180 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10181 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10182 | .init_verbs = { alc885_imac91_init_verbs, |
| 10183 | alc880_gpio1_init_verbs }, |
| 10184 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10185 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10186 | .channel_mode = alc885_mba21_ch_modes, |
| 10187 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10188 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10189 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10190 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10191 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10192 | .setup = alc885_imac91_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10193 | .init_hook = alc_hp_automute, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10194 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10195 | [ALC882_TARGA] = { |
| 10196 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10197 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10198 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10199 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10200 | .dac_nids = alc882_dac_nids, |
| 10201 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10202 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10203 | .adc_nids = alc882_adc_nids, |
| 10204 | .capsrc_nids = alc882_capsrc_nids, |
| 10205 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10206 | .channel_mode = alc882_3ST_6ch_modes, |
| 10207 | .need_dac_fix = 1, |
| 10208 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10209 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10210 | .setup = alc882_targa_setup, |
| 10211 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10212 | }, |
| 10213 | [ALC882_ASUS_A7J] = { |
| 10214 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10215 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10216 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10217 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10218 | .dac_nids = alc882_dac_nids, |
| 10219 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10220 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10221 | .adc_nids = alc882_adc_nids, |
| 10222 | .capsrc_nids = alc882_capsrc_nids, |
| 10223 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10224 | .channel_mode = alc882_3ST_6ch_modes, |
| 10225 | .need_dac_fix = 1, |
| 10226 | .input_mux = &alc882_capture_source, |
| 10227 | }, |
| 10228 | [ALC882_ASUS_A7M] = { |
| 10229 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10230 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10231 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10232 | alc882_asus_a7m_verbs }, |
| 10233 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10234 | .dac_nids = alc882_dac_nids, |
| 10235 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10236 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10237 | .channel_mode = alc880_threestack_modes, |
| 10238 | .need_dac_fix = 1, |
| 10239 | .input_mux = &alc882_capture_source, |
| 10240 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10241 | [ALC883_3ST_2ch_DIG] = { |
| 10242 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10243 | .init_verbs = { alc883_init_verbs }, |
| 10244 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10245 | .dac_nids = alc883_dac_nids, |
| 10246 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10247 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10248 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10249 | .channel_mode = alc883_3ST_2ch_modes, |
| 10250 | .input_mux = &alc883_capture_source, |
| 10251 | }, |
| 10252 | [ALC883_3ST_6ch_DIG] = { |
| 10253 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10254 | .init_verbs = { alc883_init_verbs }, |
| 10255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10256 | .dac_nids = alc883_dac_nids, |
| 10257 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10258 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10259 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10260 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10261 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10262 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10263 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10264 | [ALC883_3ST_6ch] = { |
| 10265 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10266 | .init_verbs = { alc883_init_verbs }, |
| 10267 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10268 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10269 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10270 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10271 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10272 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10273 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10274 | [ALC883_3ST_6ch_INTEL] = { |
| 10275 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10276 | .init_verbs = { alc883_init_verbs }, |
| 10277 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10278 | .dac_nids = alc883_dac_nids, |
| 10279 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10280 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10281 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10282 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10283 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10284 | .need_dac_fix = 1, |
| 10285 | .input_mux = &alc883_3stack_6ch_intel, |
| 10286 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10287 | [ALC889A_INTEL] = { |
| 10288 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10289 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10290 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10291 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10292 | .dac_nids = alc883_dac_nids, |
| 10293 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10294 | .adc_nids = alc889_adc_nids, |
| 10295 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10296 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10297 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10298 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10299 | .channel_mode = alc889_8ch_intel_modes, |
| 10300 | .capsrc_nids = alc889_capsrc_nids, |
| 10301 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10302 | .setup = alc889_automute_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10303 | .init_hook = alc_hp_automute, |
| 10304 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10305 | .need_dac_fix = 1, |
| 10306 | }, |
| 10307 | [ALC889_INTEL] = { |
| 10308 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10309 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10310 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10311 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10312 | .dac_nids = alc883_dac_nids, |
| 10313 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10314 | .adc_nids = alc889_adc_nids, |
| 10315 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10316 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10317 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10318 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10319 | .channel_mode = alc889_8ch_intel_modes, |
| 10320 | .capsrc_nids = alc889_capsrc_nids, |
| 10321 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10322 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10323 | .init_hook = alc889_intel_init_hook, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10324 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10325 | .need_dac_fix = 1, |
| 10326 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10327 | [ALC883_6ST_DIG] = { |
| 10328 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10329 | .init_verbs = { alc883_init_verbs }, |
| 10330 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10331 | .dac_nids = alc883_dac_nids, |
| 10332 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10333 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10334 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10335 | .channel_mode = alc883_sixstack_modes, |
| 10336 | .input_mux = &alc883_capture_source, |
| 10337 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10338 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10339 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10340 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10341 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10342 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10343 | .dac_nids = alc883_dac_nids, |
| 10344 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10345 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10346 | .channel_mode = alc883_3ST_6ch_modes, |
| 10347 | .need_dac_fix = 1, |
| 10348 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10349 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10350 | .setup = alc882_targa_setup, |
| 10351 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10352 | }, |
| 10353 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10354 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10355 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10356 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10357 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10358 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10359 | .adc_nids = alc883_adc_nids_alt, |
| 10360 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10361 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10362 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10363 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10364 | .channel_mode = alc883_3ST_2ch_modes, |
| 10365 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10366 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10367 | .setup = alc882_targa_setup, |
| 10368 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10369 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10370 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10371 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10372 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10373 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10374 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10375 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10376 | .dac_nids = alc883_dac_nids, |
| 10377 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10378 | .adc_nids = alc883_adc_nids_rev, |
| 10379 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10380 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10381 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10382 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10383 | .channel_mode = alc883_4ST_8ch_modes, |
| 10384 | .need_dac_fix = 1, |
| 10385 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10386 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10387 | .setup = alc882_targa_setup, |
| 10388 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10389 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10390 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10391 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10392 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10393 | * and the headphone jack. Turn this on and rely on the |
| 10394 | * standard mute methods whenever the user wants to turn |
| 10395 | * these outputs off. |
| 10396 | */ |
| 10397 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10398 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10399 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10400 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10401 | .channel_mode = alc883_3ST_2ch_modes, |
| 10402 | .input_mux = &alc883_capture_source, |
| 10403 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10404 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10405 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10406 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10407 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10408 | .dac_nids = alc883_dac_nids, |
| 10409 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10410 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10411 | .channel_mode = alc883_3ST_2ch_modes, |
| 10412 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10413 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10414 | .setup = alc883_acer_aspire_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10415 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10416 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10417 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10418 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10419 | alc883_chmode_mixer }, |
| 10420 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10421 | alc888_acer_aspire_4930g_verbs }, |
| 10422 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10423 | .dac_nids = alc883_dac_nids, |
| 10424 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10425 | .adc_nids = alc883_adc_nids_rev, |
| 10426 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10427 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10428 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10429 | .channel_mode = alc883_3ST_6ch_modes, |
| 10430 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10431 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10432 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10433 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10434 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10435 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10436 | .setup = alc888_acer_aspire_4930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10437 | .init_hook = alc_hp_automute, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10438 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10439 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10440 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10441 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10442 | alc888_acer_aspire_6530g_verbs }, |
| 10443 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10444 | .dac_nids = alc883_dac_nids, |
| 10445 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10446 | .adc_nids = alc883_adc_nids_rev, |
| 10447 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10448 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10449 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10450 | .channel_mode = alc883_3ST_2ch_modes, |
| 10451 | .num_mux_defs = |
| 10452 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10453 | .input_mux = alc888_acer_aspire_6530_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10454 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10455 | .setup = alc888_acer_aspire_6530g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10456 | .init_hook = alc_hp_automute, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10457 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10458 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10459 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10460 | alc883_chmode_mixer }, |
| 10461 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10462 | alc889_acer_aspire_8930g_verbs, |
| 10463 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10464 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10465 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10466 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10467 | .adc_nids = alc889_adc_nids, |
| 10468 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10469 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10470 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10471 | .channel_mode = alc883_3ST_6ch_modes, |
| 10472 | .need_dac_fix = 1, |
| 10473 | .const_channel_count = 6, |
| 10474 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10475 | ARRAY_SIZE(alc889_capture_sources), |
| 10476 | .input_mux = alc889_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10477 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10478 | .setup = alc889_acer_aspire_8930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10479 | .init_hook = alc_hp_automute, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10480 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10481 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10482 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10483 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10484 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10485 | .mixers = { alc883_3ST_6ch_mixer, |
| 10486 | alc883_chmode_mixer }, |
| 10487 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10488 | alc888_acer_aspire_7730G_verbs }, |
| 10489 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10490 | .dac_nids = alc883_dac_nids, |
| 10491 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10492 | .adc_nids = alc883_adc_nids_rev, |
| 10493 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10494 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10495 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10496 | .channel_mode = alc883_3ST_6ch_modes, |
| 10497 | .need_dac_fix = 1, |
| 10498 | .const_channel_count = 6, |
| 10499 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10500 | .unsol_event = alc_sku_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10501 | .setup = alc888_acer_aspire_7730g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10502 | .init_hook = alc_hp_automute, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10503 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10504 | [ALC883_MEDION] = { |
| 10505 | .mixers = { alc883_fivestack_mixer, |
| 10506 | alc883_chmode_mixer }, |
| 10507 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10508 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10509 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10510 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10511 | .adc_nids = alc883_adc_nids_alt, |
| 10512 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10513 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10514 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10515 | .channel_mode = alc883_sixstack_modes, |
| 10516 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10517 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10518 | [ALC883_MEDION_WIM2160] = { |
| 10519 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10520 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10521 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10522 | .dac_nids = alc883_dac_nids, |
| 10523 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10524 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10525 | .adc_nids = alc883_adc_nids, |
| 10526 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10527 | .channel_mode = alc883_3ST_2ch_modes, |
| 10528 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10529 | .unsol_event = alc_sku_unsol_event, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10530 | .setup = alc883_medion_wim2160_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10531 | .init_hook = alc_hp_automute, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10532 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10533 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10534 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10535 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10536 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10537 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10538 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10539 | .channel_mode = alc883_3ST_2ch_modes, |
| 10540 | .input_mux = &alc883_capture_source, |
| 10541 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10542 | [ALC883_CLEVO_M540R] = { |
| 10543 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10544 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10546 | .dac_nids = alc883_dac_nids, |
| 10547 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10548 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10549 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10550 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10551 | .need_dac_fix = 1, |
| 10552 | .input_mux = &alc883_capture_source, |
| 10553 | /* This machine has the hardware HP auto-muting, thus |
| 10554 | * we need no software mute via unsol event |
| 10555 | */ |
| 10556 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10557 | [ALC883_CLEVO_M720] = { |
| 10558 | .mixers = { alc883_clevo_m720_mixer }, |
| 10559 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10560 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10561 | .dac_nids = alc883_dac_nids, |
| 10562 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10563 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10564 | .channel_mode = alc883_3ST_2ch_modes, |
| 10565 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10566 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10567 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10568 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10569 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10570 | [ALC883_LENOVO_101E_2ch] = { |
| 10571 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10572 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10573 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10574 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10575 | .adc_nids = alc883_adc_nids_alt, |
| 10576 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10577 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10578 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10579 | .channel_mode = alc883_3ST_2ch_modes, |
| 10580 | .input_mux = &alc883_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10581 | .setup = alc883_lenovo_101e_setup, |
| 10582 | .unsol_event = alc_sku_unsol_event, |
| 10583 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10584 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10585 | [ALC883_LENOVO_NB0763] = { |
| 10586 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10587 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10588 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10589 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10590 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10591 | .channel_mode = alc883_3ST_2ch_modes, |
| 10592 | .need_dac_fix = 1, |
| 10593 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10594 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10595 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10596 | .init_hook = alc_hp_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10597 | }, |
| 10598 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10599 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10600 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10601 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10602 | .dac_nids = alc883_dac_nids, |
| 10603 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10604 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10605 | .channel_mode = alc883_3ST_6ch_modes, |
| 10606 | .need_dac_fix = 1, |
| 10607 | .input_mux = &alc883_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10608 | .unsol_event = alc_sku_unsol_event, |
| 10609 | .setup = alc888_lenovo_ms7195_setup, |
| 10610 | .init_hook = alc_inithook, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10611 | }, |
| 10612 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10613 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10614 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10615 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10616 | .dac_nids = alc883_dac_nids, |
| 10617 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10618 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10619 | .channel_mode = alc883_3ST_2ch_modes, |
| 10620 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10621 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10622 | .setup = alc883_haier_w66_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10623 | .init_hook = alc_hp_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10624 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10625 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10626 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10627 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10628 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10629 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10630 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10631 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10632 | .need_dac_fix = 1, |
| 10633 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10634 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10635 | .setup = alc888_3st_hp_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10636 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10637 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10638 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10639 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10640 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10641 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10642 | .dac_nids = alc883_dac_nids, |
| 10643 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10644 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10645 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10646 | .channel_mode = alc883_sixstack_modes, |
| 10647 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10648 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10649 | .setup = alc888_6st_dell_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10650 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10651 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10652 | [ALC883_MITAC] = { |
| 10653 | .mixers = { alc883_mitac_mixer }, |
| 10654 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10655 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10656 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10657 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10658 | .channel_mode = alc883_3ST_2ch_modes, |
| 10659 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10660 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10661 | .setup = alc883_mitac_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10662 | .init_hook = alc_hp_automute, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10663 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10664 | [ALC883_FUJITSU_PI2515] = { |
| 10665 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10666 | .init_verbs = { alc883_init_verbs, |
| 10667 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10668 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10669 | .dac_nids = alc883_dac_nids, |
| 10670 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10671 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10672 | .channel_mode = alc883_3ST_2ch_modes, |
| 10673 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10674 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10675 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10676 | .init_hook = alc_hp_automute, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10677 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10678 | [ALC888_FUJITSU_XA3530] = { |
| 10679 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10680 | .init_verbs = { alc883_init_verbs, |
| 10681 | alc888_fujitsu_xa3530_verbs }, |
| 10682 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10683 | .dac_nids = alc883_dac_nids, |
| 10684 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10685 | .adc_nids = alc883_adc_nids_rev, |
| 10686 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10687 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10688 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10689 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10690 | .num_mux_defs = |
| 10691 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10692 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10693 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10694 | .setup = alc888_fujitsu_xa3530_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10695 | .init_hook = alc_hp_automute, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10696 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10697 | [ALC888_LENOVO_SKY] = { |
| 10698 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10699 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10700 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10701 | .dac_nids = alc883_dac_nids, |
| 10702 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10703 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10704 | .channel_mode = alc883_sixstack_modes, |
| 10705 | .need_dac_fix = 1, |
| 10706 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10707 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10708 | .setup = alc888_lenovo_sky_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10709 | .init_hook = alc_hp_automute, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10710 | }, |
| 10711 | [ALC888_ASUS_M90V] = { |
| 10712 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10713 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10714 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10715 | .dac_nids = alc883_dac_nids, |
| 10716 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10717 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10718 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10719 | .channel_mode = alc883_3ST_6ch_modes, |
| 10720 | .need_dac_fix = 1, |
| 10721 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10722 | .unsol_event = alc_sku_unsol_event, |
| 10723 | .setup = alc883_mode2_setup, |
| 10724 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10725 | }, |
| 10726 | [ALC888_ASUS_EEE1601] = { |
| 10727 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10728 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10729 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10730 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10731 | .dac_nids = alc883_dac_nids, |
| 10732 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10733 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10734 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10735 | .channel_mode = alc883_3ST_2ch_modes, |
| 10736 | .need_dac_fix = 1, |
| 10737 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10738 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10739 | .init_hook = alc883_eee1601_inithook, |
| 10740 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10741 | [ALC1200_ASUS_P5Q] = { |
| 10742 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10743 | .init_verbs = { alc883_init_verbs }, |
| 10744 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10745 | .dac_nids = alc883_dac_nids, |
| 10746 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10747 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10748 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10749 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10750 | .channel_mode = alc883_sixstack_modes, |
| 10751 | .input_mux = &alc883_capture_source, |
| 10752 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10753 | [ALC889A_MB31] = { |
| 10754 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10755 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10756 | alc880_gpio1_init_verbs }, |
| 10757 | .adc_nids = alc883_adc_nids, |
| 10758 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10759 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10760 | .dac_nids = alc883_dac_nids, |
| 10761 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10762 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10763 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10764 | .input_mux = &alc889A_mb31_capture_source, |
| 10765 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10766 | .unsol_event = alc889A_mb31_unsol_event, |
| 10767 | .init_hook = alc889A_mb31_automute, |
| 10768 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10769 | [ALC883_SONY_VAIO_TT] = { |
| 10770 | .mixers = { alc883_vaiott_mixer }, |
| 10771 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10772 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10773 | .dac_nids = alc883_dac_nids, |
| 10774 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10775 | .channel_mode = alc883_3ST_2ch_modes, |
| 10776 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10777 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10778 | .setup = alc883_vaiott_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10779 | .init_hook = alc_hp_automute, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10780 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10781 | }; |
| 10782 | |
| 10783 | |
| 10784 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10785 | * Pin config fixes |
| 10786 | */ |
| 10787 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10788 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10789 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10790 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10791 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10792 | PINFIX_GIGABYTE_880GM, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10793 | }; |
| 10794 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10795 | static const struct alc_fixup alc882_fixups[] = { |
| 10796 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10797 | .type = ALC_FIXUP_PINS, |
| 10798 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10799 | { 0x15, 0x01080104 }, /* side */ |
| 10800 | { 0x16, 0x01011012 }, /* rear */ |
| 10801 | { 0x17, 0x01016011 }, /* clfe */ |
| 10802 | { } |
| 10803 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10804 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10805 | [PINFIX_LENOVO_Y530] = { |
| 10806 | .type = ALC_FIXUP_PINS, |
| 10807 | .v.pins = (const struct alc_pincfg[]) { |
| 10808 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10809 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10810 | { } |
| 10811 | } |
| 10812 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10813 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10814 | .type = ALC_FIXUP_VERBS, |
| 10815 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10816 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10817 | {} |
| 10818 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10819 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10820 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10821 | .type = ALC_FIXUP_SKU, |
| 10822 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10823 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10824 | [PINFIX_GIGABYTE_880GM] = { |
| 10825 | .type = ALC_FIXUP_PINS, |
| 10826 | .v.pins = (const struct alc_pincfg[]) { |
| 10827 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 10828 | { } |
| 10829 | } |
| 10830 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10831 | }; |
| 10832 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10833 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10834 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10835 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10836 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10837 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 10838 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10839 | {} |
| 10840 | }; |
| 10841 | |
| 10842 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10843 | * BIOS auto configuration |
| 10844 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10845 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10846 | const struct auto_pin_cfg *cfg) |
| 10847 | { |
| 10848 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10849 | } |
| 10850 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10851 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10852 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10853 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10854 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10855 | int idx; |
| 10856 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10857 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10858 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10859 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10860 | if (dac == 0x25) |
| 10861 | idx = 4; |
| 10862 | else if (dac >= 0x02 && dac <= 0x05) |
| 10863 | idx = dac - 2; |
| 10864 | else |
| 10865 | return; |
| 10866 | 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] | 10867 | } |
| 10868 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10869 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10870 | { |
| 10871 | struct alc_spec *spec = codec->spec; |
| 10872 | int i; |
| 10873 | |
| 10874 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10875 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10876 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10877 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10878 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10879 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10880 | } |
| 10881 | } |
| 10882 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10883 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10884 | { |
| 10885 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10886 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 10887 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10888 | |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10889 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
| 10890 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 10891 | pin = spec->autocfg.hp_pins[i]; |
| 10892 | if (!pin) |
| 10893 | break; |
| 10894 | dac = spec->multiout.hp_nid; |
| 10895 | if (!dac) |
| 10896 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10897 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10898 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10899 | } |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 10900 | |
| 10901 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 10902 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 10903 | pin = spec->autocfg.speaker_pins[i]; |
| 10904 | if (!pin) |
| 10905 | break; |
| 10906 | dac = spec->multiout.extra_out_nid[0]; |
| 10907 | if (!dac) |
| 10908 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10909 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10910 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10911 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10912 | } |
| 10913 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10914 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10915 | { |
| 10916 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10917 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10918 | int i; |
| 10919 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10920 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10921 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 10922 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10923 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10924 | snd_hda_codec_write(codec, nid, 0, |
| 10925 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10926 | AMP_OUT_MUTE); |
| 10927 | } |
| 10928 | } |
| 10929 | |
| 10930 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10931 | { |
| 10932 | struct alc_spec *spec = codec->spec; |
| 10933 | int c; |
| 10934 | |
| 10935 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10936 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10937 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10938 | unsigned int mux_idx; |
| 10939 | const struct hda_input_mux *imux; |
| 10940 | int conns, mute, idx, item; |
| 10941 | |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 10942 | /* mute ADC */ |
| 10943 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 10944 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10945 | AMP_IN_MUTE(0)); |
| 10946 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10947 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10948 | ARRAY_SIZE(conn_list)); |
| 10949 | if (conns < 0) |
| 10950 | continue; |
| 10951 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10952 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10953 | if (!imux->num_items && mux_idx > 0) |
| 10954 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10955 | for (idx = 0; idx < conns; idx++) { |
| 10956 | /* if the current connection is the selected one, |
| 10957 | * unmute it as default - otherwise mute it |
| 10958 | */ |
| 10959 | mute = AMP_IN_MUTE(idx); |
| 10960 | for (item = 0; item < imux->num_items; item++) { |
| 10961 | if (imux->items[item].index == idx) { |
| 10962 | if (spec->cur_mux[c] == item) |
| 10963 | mute = AMP_IN_UNMUTE(idx); |
| 10964 | break; |
| 10965 | } |
| 10966 | } |
| 10967 | /* check if we have a selector or mixer |
| 10968 | * we could check for the widget type instead, but |
| 10969 | * just check for Amp-In presence (in case of mixer |
| 10970 | * without amp-in there is something wrong, this |
| 10971 | * function shouldn't be used or capsrc nid is wrong) |
| 10972 | */ |
| 10973 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10974 | snd_hda_codec_write(codec, nid, 0, |
| 10975 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10976 | mute); |
| 10977 | else if (mute != AMP_IN_MUTE(idx)) |
| 10978 | snd_hda_codec_write(codec, nid, 0, |
| 10979 | AC_VERB_SET_CONNECT_SEL, |
| 10980 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10981 | } |
| 10982 | } |
| 10983 | } |
| 10984 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10985 | /* add mic boosts if needed */ |
| 10986 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10987 | { |
| 10988 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10989 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10990 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 10991 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10992 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 10993 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10994 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10995 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 10996 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10997 | break; |
| 10998 | nid = cfg->inputs[i].pin; |
| 10999 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11000 | const char *label; |
| 11001 | char boost_label[32]; |
| 11002 | |
| 11003 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 11004 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11005 | type_idx++; |
| 11006 | else |
| 11007 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11008 | prev_label = label; |
| 11009 | |
| 11010 | snprintf(boost_label, sizeof(boost_label), |
| 11011 | "%s Boost Volume", label); |
| 11012 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11013 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11014 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11015 | if (err < 0) |
| 11016 | return err; |
| 11017 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11018 | } |
| 11019 | return 0; |
| 11020 | } |
| 11021 | |
| 11022 | /* almost identical with ALC880 parser... */ |
| 11023 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 11024 | { |
| 11025 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11026 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11027 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11028 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11029 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11030 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11031 | if (err < 0) |
| 11032 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11033 | if (!spec->autocfg.line_outs) |
| 11034 | return 0; /* can't find valid BIOS pin config */ |
| 11035 | |
| 11036 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11037 | if (err < 0) |
| 11038 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 11039 | err = alc_auto_add_multi_channel_mode(codec); |
| 11040 | if (err < 0) |
| 11041 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 11042 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11043 | if (err < 0) |
| 11044 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11045 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11046 | "Headphone"); |
| 11047 | if (err < 0) |
| 11048 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11049 | err = alc880_auto_create_extra_out(spec, |
| 11050 | spec->autocfg.speaker_pins[0], |
| 11051 | "Speaker"); |
| 11052 | if (err < 0) |
| 11053 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11054 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 11055 | if (err < 0) |
| 11056 | return err; |
| 11057 | |
| 11058 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11059 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11060 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11061 | |
| 11062 | if (spec->kctls.list) |
| 11063 | add_mixer(spec, spec->kctls.list); |
| 11064 | |
| 11065 | add_verb(spec, alc883_auto_init_verbs); |
| 11066 | /* if ADC 0x07 is available, initialize it, too */ |
| 11067 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 11068 | add_verb(spec, alc882_adc1_init_verbs); |
| 11069 | |
| 11070 | spec->num_mux_defs = 1; |
| 11071 | spec->input_mux = &spec->private_imux[0]; |
| 11072 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11073 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11074 | |
| 11075 | err = alc_auto_add_mic_boost(codec); |
| 11076 | if (err < 0) |
| 11077 | return err; |
| 11078 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11079 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11080 | } |
| 11081 | |
| 11082 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11083 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11084 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11085 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11086 | alc882_auto_init_multi_out(codec); |
| 11087 | alc882_auto_init_hp_out(codec); |
| 11088 | alc882_auto_init_analog_input(codec); |
| 11089 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11090 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11091 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11092 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11093 | } |
| 11094 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11095 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11096 | { |
| 11097 | struct alc_spec *spec; |
| 11098 | int err, board_config; |
| 11099 | |
| 11100 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11101 | if (spec == NULL) |
| 11102 | return -ENOMEM; |
| 11103 | |
| 11104 | codec->spec = spec; |
| 11105 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11106 | switch (codec->vendor_id) { |
| 11107 | case 0x10ec0882: |
| 11108 | case 0x10ec0885: |
| 11109 | break; |
| 11110 | default: |
| 11111 | /* ALC883 and variants */ |
| 11112 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11113 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11114 | } |
| 11115 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11116 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11117 | alc882_models, |
| 11118 | alc882_cfg_tbl); |
| 11119 | |
| 11120 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11121 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11122 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11123 | |
| 11124 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11125 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11126 | codec->chip_name); |
| 11127 | board_config = ALC882_AUTO; |
| 11128 | } |
| 11129 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11130 | if (board_config == ALC882_AUTO) { |
| 11131 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11132 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11133 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11134 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11135 | alc_auto_parse_customize_define(codec); |
| 11136 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11137 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11138 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11139 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11140 | if (err < 0) { |
| 11141 | alc_free(codec); |
| 11142 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11143 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11144 | printk(KERN_INFO |
| 11145 | "hda_codec: Cannot set up configuration " |
| 11146 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11147 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11148 | } |
| 11149 | } |
| 11150 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11151 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11152 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11153 | if (err < 0) { |
| 11154 | alc_free(codec); |
| 11155 | return err; |
| 11156 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11157 | } |
| 11158 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11159 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11160 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11161 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11162 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11163 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11164 | /* FIXME: setup DAC5 */ |
| 11165 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11166 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11167 | |
| 11168 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11169 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11170 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11171 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11172 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11173 | spec->num_adc_nids = 0; |
| 11174 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11175 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11176 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11177 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11178 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11179 | unsigned int wcap = get_wcaps(codec, nid); |
| 11180 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11181 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11182 | if (wcap != AC_WID_AUD_IN) |
| 11183 | continue; |
| 11184 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11185 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11186 | if (err < 0) |
| 11187 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11188 | err = snd_hda_get_connections(codec, cap, items, |
| 11189 | ARRAY_SIZE(items)); |
| 11190 | if (err < 0) |
| 11191 | continue; |
| 11192 | for (j = 0; j < imux->num_items; j++) |
| 11193 | if (imux->items[j].index >= err) |
| 11194 | break; |
| 11195 | if (j < imux->num_items) |
| 11196 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11197 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11198 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11199 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11200 | spec->adc_nids = spec->private_adc_nids; |
| 11201 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11202 | } |
| 11203 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11204 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11205 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11206 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11207 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11208 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11209 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11210 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11211 | spec->vmaster_nid = 0x0c; |
| 11212 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11213 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11214 | if (board_config == ALC882_AUTO) |
| 11215 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11216 | |
| 11217 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11218 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11219 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11220 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11221 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11222 | |
| 11223 | return 0; |
| 11224 | } |
| 11225 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11226 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11227 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11228 | * ALC262 support |
| 11229 | */ |
| 11230 | |
| 11231 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11232 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11233 | |
| 11234 | #define alc262_dac_nids alc260_dac_nids |
| 11235 | #define alc262_adc_nids alc882_adc_nids |
| 11236 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11237 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11238 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11239 | |
| 11240 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11241 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11242 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11243 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 11244 | /* ADC0 */ |
| 11245 | 0x09 |
| 11246 | }; |
| 11247 | |
| 11248 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 11249 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11250 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 11251 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11252 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11253 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11254 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11255 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11256 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11259 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11260 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11261 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11262 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11263 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11264 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11265 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11266 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11267 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11268 | }; |
| 11269 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11270 | /* update HP, line and mono-out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11271 | #define alc262_hp_master_update alc260_hp_master_update |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11272 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11273 | static void alc262_hp_bpc_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11274 | { |
| 11275 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11276 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11277 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11278 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11279 | spec->automute = 1; |
| 11280 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11281 | } |
| 11282 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11283 | static void alc262_hp_wildwest_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11284 | { |
| 11285 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11286 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11287 | spec->autocfg.hp_pins[0] = 0x15; |
| 11288 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11289 | spec->automute = 1; |
| 11290 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11291 | } |
| 11292 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11293 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11294 | #define alc262_hp_master_sw_put alc260_hp_master_sw_put |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11295 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11296 | #define ALC262_HP_MASTER_SWITCH \ |
| 11297 | { \ |
| 11298 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11299 | .name = "Master Playback Switch", \ |
| 11300 | .info = snd_ctl_boolean_mono_info, \ |
| 11301 | .get = alc262_hp_master_sw_get, \ |
| 11302 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11303 | }, \ |
| 11304 | { \ |
| 11305 | .iface = NID_MAPPING, \ |
| 11306 | .name = "Master Playback Switch", \ |
| 11307 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11308 | } |
| 11309 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11310 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11311 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11312 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11313 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11314 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11315 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11316 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11317 | HDA_OUTPUT), |
| 11318 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11319 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11320 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11321 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11322 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11323 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11324 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11325 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11326 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11327 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11328 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11329 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11330 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11331 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11332 | { } /* end */ |
| 11333 | }; |
| 11334 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11335 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11336 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11337 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11338 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11339 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11340 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11341 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11342 | HDA_OUTPUT), |
| 11343 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11344 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11345 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11346 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11347 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11348 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11349 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11350 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11351 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11352 | { } /* end */ |
| 11353 | }; |
| 11354 | |
| 11355 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11356 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11357 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11358 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11359 | { } /* end */ |
| 11360 | }; |
| 11361 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11362 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11363 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11364 | { |
| 11365 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11366 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11367 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11368 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11369 | spec->automute = 1; |
| 11370 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11371 | } |
| 11372 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11373 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11374 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11375 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11376 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11377 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11380 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11381 | { } /* end */ |
| 11382 | }; |
| 11383 | |
| 11384 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11385 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11386 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11387 | |
| 11388 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11389 | { } |
| 11390 | }; |
| 11391 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11392 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11393 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11395 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11396 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11397 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11398 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11399 | { } /* end */ |
| 11400 | }; |
| 11401 | |
| 11402 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11403 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11404 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11405 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11406 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11407 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11408 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11409 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11410 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11411 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11412 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11413 | {} |
| 11414 | }; |
| 11415 | |
| 11416 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11417 | .num_items = 1, |
| 11418 | .items = { |
| 11419 | { "Line", 0x1 }, |
| 11420 | }, |
| 11421 | }; |
| 11422 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11423 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11424 | #define alc262_hippo_master_update alc262_hp_master_update |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11425 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11426 | #define alc262_hippo_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11427 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11428 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11429 | { \ |
| 11430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11431 | .name = "Master Playback Switch", \ |
| 11432 | .info = snd_ctl_boolean_mono_info, \ |
| 11433 | .get = alc262_hippo_master_sw_get, \ |
| 11434 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11435 | }, \ |
| 11436 | { \ |
| 11437 | .iface = NID_MAPPING, \ |
| 11438 | .name = "Master Playback Switch", \ |
| 11439 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11440 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11441 | } |
| 11442 | |
| 11443 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11444 | ALC262_HIPPO_MASTER_SWITCH, |
| 11445 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11446 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11447 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11451 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11452 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11453 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11455 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11456 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11457 | { } /* end */ |
| 11458 | }; |
| 11459 | |
| 11460 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11461 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11462 | ALC262_HIPPO_MASTER_SWITCH, |
| 11463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11466 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11469 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11470 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11471 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11472 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11473 | { } /* end */ |
| 11474 | }; |
| 11475 | |
| 11476 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11477 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11478 | { |
| 11479 | struct alc_spec *spec = codec->spec; |
| 11480 | |
| 11481 | spec->autocfg.hp_pins[0] = 0x15; |
| 11482 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11483 | spec->automute = 1; |
| 11484 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11485 | } |
| 11486 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11487 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11488 | { |
| 11489 | struct alc_spec *spec = codec->spec; |
| 11490 | |
| 11491 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11492 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 11493 | spec->automute = 1; |
| 11494 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11495 | } |
| 11496 | |
| 11497 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11498 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11499 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11500 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11503 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11504 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11505 | { } /* end */ |
| 11506 | }; |
| 11507 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11508 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11509 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11510 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11511 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11512 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11513 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11514 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11515 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11516 | { } /* end */ |
| 11517 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11518 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11519 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11520 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11521 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11522 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11523 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11524 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11525 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11526 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11528 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11529 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11530 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11531 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11532 | { } /* end */ |
| 11533 | }; |
| 11534 | |
| 11535 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11536 | /* Headphone automute */ |
| 11537 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11538 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11540 | |
| 11541 | /* P11 AUX_IN, white 4-pin connector */ |
| 11542 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11543 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11544 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11545 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11546 | |
| 11547 | {} |
| 11548 | }; |
| 11549 | |
| 11550 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11551 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11552 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11553 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11554 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11555 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11556 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11557 | spec->automute = 1; |
| 11558 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11559 | } |
| 11560 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11561 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11562 | #define alc262_capture_mixer alc882_capture_mixer |
| 11563 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11564 | |
| 11565 | /* |
| 11566 | * generic initialization of ADC, input mixers and output mixers |
| 11567 | */ |
| 11568 | static struct hda_verb alc262_init_verbs[] = { |
| 11569 | /* |
| 11570 | * Unmute ADC0-2 and set the default input to mic-in |
| 11571 | */ |
| 11572 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11574 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11575 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11576 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11577 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11578 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11579 | /* 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] | 11580 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11581 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11582 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11583 | */ |
| 11584 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11590 | |
| 11591 | /* |
| 11592 | * Set up output mixers (0x0c - 0x0e) |
| 11593 | */ |
| 11594 | /* set vol=0 to output mixers */ |
| 11595 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11596 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11597 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11598 | /* set up input amps for analog loopback */ |
| 11599 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11602 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11603 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11604 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11605 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11606 | |
| 11607 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11608 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11609 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11610 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11611 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11612 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11613 | |
| 11614 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11615 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11616 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11617 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11618 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11619 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11620 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11621 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11622 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11623 | /* FIXME: use matrix-type input source selection */ |
| 11624 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11625 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11626 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11627 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11629 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11630 | /* Input mixer2 */ |
| 11631 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11632 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11635 | /* Input mixer3 */ |
| 11636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11637 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11640 | |
| 11641 | { } |
| 11642 | }; |
| 11643 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11644 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11645 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11646 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11647 | { } |
| 11648 | }; |
| 11649 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11650 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11651 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11652 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11653 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11654 | |
| 11655 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11656 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11657 | {} |
| 11658 | }; |
| 11659 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11660 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11661 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11662 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11663 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11664 | |
| 11665 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11666 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11667 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11668 | }; |
| 11669 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11670 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11671 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11672 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11673 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11674 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11676 | { } /* end */ |
| 11677 | }; |
| 11678 | |
| 11679 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11680 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11681 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11683 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11684 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11685 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11686 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11687 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11688 | {} |
| 11689 | }; |
| 11690 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11691 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11692 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11693 | struct alc_spec *spec = codec->spec; |
| 11694 | |
| 11695 | spec->autocfg.hp_pins[0] = 0x15; |
| 11696 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11697 | spec->ext_mic.pin = 0x18; |
| 11698 | spec->ext_mic.mux_idx = 0; |
| 11699 | spec->int_mic.pin = 0x12; |
| 11700 | spec->int_mic.mux_idx = 9; |
| 11701 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11702 | spec->automute = 1; |
| 11703 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11704 | } |
| 11705 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11706 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11707 | * nec model |
| 11708 | * 0x15 = headphone |
| 11709 | * 0x16 = internal speaker |
| 11710 | * 0x18 = external mic |
| 11711 | */ |
| 11712 | |
| 11713 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11714 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11715 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11716 | |
| 11717 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11719 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11720 | |
| 11721 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11723 | { } /* end */ |
| 11724 | }; |
| 11725 | |
| 11726 | static struct hda_verb alc262_nec_verbs[] = { |
| 11727 | /* Unmute Speaker */ |
| 11728 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11729 | |
| 11730 | /* Headphone */ |
| 11731 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11732 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11733 | |
| 11734 | /* External mic to headphone */ |
| 11735 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11736 | /* External mic to speaker */ |
| 11737 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11738 | {} |
| 11739 | }; |
| 11740 | |
| 11741 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11742 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11743 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11744 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11745 | */ |
| 11746 | |
| 11747 | #define ALC_HP_EVENT 0x37 |
| 11748 | |
| 11749 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11750 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11751 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11752 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11753 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11754 | {} |
| 11755 | }; |
| 11756 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11757 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11758 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11759 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11760 | {} |
| 11761 | }; |
| 11762 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11763 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11764 | /* Front Mic pin: input vref at 50% */ |
| 11765 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11766 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11767 | {} |
| 11768 | }; |
| 11769 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11770 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11771 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11772 | .items = { |
| 11773 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11774 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11775 | { "CD", 0x4 }, |
| 11776 | }, |
| 11777 | }; |
| 11778 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11779 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11780 | .num_items = 5, |
| 11781 | .items = { |
| 11782 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11783 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11784 | { "Line", 0x2 }, |
| 11785 | { "CD", 0x4 }, |
| 11786 | { "AUX IN", 0x6 }, |
| 11787 | }, |
| 11788 | }; |
| 11789 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11790 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11791 | .num_items = 4, |
| 11792 | .items = { |
| 11793 | { "Mic", 0x0 }, |
| 11794 | { "Front Mic", 0x2 }, |
| 11795 | { "Line", 0x1 }, |
| 11796 | { "CD", 0x4 }, |
| 11797 | }, |
| 11798 | }; |
| 11799 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11800 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11801 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11802 | { |
| 11803 | struct alc_spec *spec = codec->spec; |
| 11804 | unsigned int mute; |
| 11805 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11806 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11807 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11808 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11809 | spec->sense_updated = 1; |
| 11810 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11811 | /* unmute internal speaker only if both HPs are unplugged and |
| 11812 | * master switch is on |
| 11813 | */ |
| 11814 | if (spec->jack_present) |
| 11815 | mute = HDA_AMP_MUTE; |
| 11816 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11817 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11818 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11819 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11820 | } |
| 11821 | |
| 11822 | /* unsolicited event for HP jack sensing */ |
| 11823 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11824 | unsigned int res) |
| 11825 | { |
| 11826 | if ((res >> 26) != ALC_HP_EVENT) |
| 11827 | return; |
| 11828 | alc262_fujitsu_automute(codec, 1); |
| 11829 | } |
| 11830 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11831 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11832 | { |
| 11833 | alc262_fujitsu_automute(codec, 1); |
| 11834 | } |
| 11835 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11836 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11837 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11838 | .ops = &snd_hda_bind_vol, |
| 11839 | .values = { |
| 11840 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11841 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11842 | 0 |
| 11843 | }, |
| 11844 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11845 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11846 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11847 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11848 | { |
| 11849 | struct alc_spec *spec = codec->spec; |
| 11850 | unsigned int mute; |
| 11851 | |
| 11852 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11853 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11854 | spec->sense_updated = 1; |
| 11855 | } |
| 11856 | if (spec->jack_present) { |
| 11857 | /* mute internal speaker */ |
| 11858 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11859 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11860 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11861 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11862 | } else { |
| 11863 | /* unmute internal speaker if necessary */ |
| 11864 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11865 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11866 | HDA_AMP_MUTE, mute); |
| 11867 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11868 | HDA_AMP_MUTE, mute); |
| 11869 | } |
| 11870 | } |
| 11871 | |
| 11872 | /* unsolicited event for HP jack sensing */ |
| 11873 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11874 | unsigned int res) |
| 11875 | { |
| 11876 | if ((res >> 26) != ALC_HP_EVENT) |
| 11877 | return; |
| 11878 | alc262_lenovo_3000_automute(codec, 1); |
| 11879 | } |
| 11880 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11881 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11882 | int dir, int idx, long *valp) |
| 11883 | { |
| 11884 | int i, change = 0; |
| 11885 | |
| 11886 | for (i = 0; i < 2; i++, valp++) |
| 11887 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11888 | HDA_AMP_MUTE, |
| 11889 | *valp ? 0 : HDA_AMP_MUTE); |
| 11890 | return change; |
| 11891 | } |
| 11892 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11893 | /* bind hp and internal speaker mute (with plug check) */ |
| 11894 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11895 | struct snd_ctl_elem_value *ucontrol) |
| 11896 | { |
| 11897 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11898 | long *valp = ucontrol->value.integer.value; |
| 11899 | int change; |
| 11900 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11901 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11902 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11903 | if (change) |
| 11904 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11905 | return change; |
| 11906 | } |
| 11907 | |
| 11908 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11909 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11910 | { |
| 11911 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11912 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11913 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11914 | .info = snd_hda_mixer_amp_switch_info, |
| 11915 | .get = snd_hda_mixer_amp_switch_get, |
| 11916 | .put = alc262_fujitsu_master_sw_put, |
| 11917 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11918 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11919 | { |
| 11920 | .iface = NID_MAPPING, |
| 11921 | .name = "Master Playback Switch", |
| 11922 | .private_value = 0x1b, |
| 11923 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11924 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11925 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11926 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11927 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11929 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11930 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11931 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11932 | { } /* end */ |
| 11933 | }; |
| 11934 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11935 | /* bind hp and internal speaker mute (with plug check) */ |
| 11936 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11937 | struct snd_ctl_elem_value *ucontrol) |
| 11938 | { |
| 11939 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11940 | long *valp = ucontrol->value.integer.value; |
| 11941 | int change; |
| 11942 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11943 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11944 | if (change) |
| 11945 | alc262_lenovo_3000_automute(codec, 0); |
| 11946 | return change; |
| 11947 | } |
| 11948 | |
| 11949 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11950 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11951 | { |
| 11952 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11953 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11954 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11955 | .info = snd_hda_mixer_amp_switch_info, |
| 11956 | .get = snd_hda_mixer_amp_switch_get, |
| 11957 | .put = alc262_lenovo_3000_master_sw_put, |
| 11958 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11959 | }, |
| 11960 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11961 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11962 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11964 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11965 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11966 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11967 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11968 | { } /* end */ |
| 11969 | }; |
| 11970 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11971 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11972 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11973 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11974 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11976 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11977 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11978 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11979 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11980 | { } /* end */ |
| 11981 | }; |
| 11982 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11983 | /* additional init verbs for Benq laptops */ |
| 11984 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11985 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11986 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11987 | {} |
| 11988 | }; |
| 11989 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11990 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11991 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11992 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11993 | |
| 11994 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11995 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11996 | {} |
| 11997 | }; |
| 11998 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11999 | /* Samsung Q1 Ultra Vista model setup */ |
| 12000 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12001 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 12002 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12005 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12006 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12007 | { } /* end */ |
| 12008 | }; |
| 12009 | |
| 12010 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12011 | /* output mixer */ |
| 12012 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12013 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12014 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12015 | /* speaker */ |
| 12016 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12017 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12018 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12019 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12020 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12021 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12022 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12023 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12024 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12025 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12026 | /* internal mic */ |
| 12027 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12028 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12029 | /* ADC, choose mic */ |
| 12030 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12031 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12033 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12034 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12035 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12036 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12037 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12038 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12039 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12040 | {} |
| 12041 | }; |
| 12042 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12043 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12044 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12045 | { |
| 12046 | struct alc_spec *spec = codec->spec; |
| 12047 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12048 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12049 | mute = 0; |
| 12050 | /* auto-mute only when HP is used as HP */ |
| 12051 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12052 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12053 | if (spec->jack_present) |
| 12054 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12055 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12056 | /* mute/unmute internal speaker */ |
| 12057 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12058 | HDA_AMP_MUTE, mute); |
| 12059 | /* mute/unmute HP */ |
| 12060 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12061 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12062 | } |
| 12063 | |
| 12064 | /* unsolicited event for HP jack sensing */ |
| 12065 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12066 | unsigned int res) |
| 12067 | { |
| 12068 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12069 | return; |
| 12070 | alc262_ultra_automute(codec); |
| 12071 | } |
| 12072 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12073 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 12074 | .num_items = 2, |
| 12075 | .items = { |
| 12076 | { "Mic", 0x1 }, |
| 12077 | { "Headphone", 0x7 }, |
| 12078 | }, |
| 12079 | }; |
| 12080 | |
| 12081 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12082 | struct snd_ctl_elem_value *ucontrol) |
| 12083 | { |
| 12084 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12085 | struct alc_spec *spec = codec->spec; |
| 12086 | int ret; |
| 12087 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12088 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12089 | if (!ret) |
| 12090 | return 0; |
| 12091 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12092 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12093 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12094 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12095 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12096 | return ret; |
| 12097 | } |
| 12098 | |
| 12099 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 12100 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12101 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12102 | { |
| 12103 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12104 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12105 | .info = alc_mux_enum_info, |
| 12106 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12107 | .put = alc262_ultra_mux_enum_put, |
| 12108 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12109 | { |
| 12110 | .iface = NID_MAPPING, |
| 12111 | .name = "Capture Source", |
| 12112 | .private_value = 0x15, |
| 12113 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12114 | { } /* end */ |
| 12115 | }; |
| 12116 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12117 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12118 | * and thus it's bound with a different mixer. |
| 12119 | * This function returns which mixer amp should be used. |
| 12120 | */ |
| 12121 | static int alc262_check_volbit(hda_nid_t nid) |
| 12122 | { |
| 12123 | if (!nid) |
| 12124 | return 0; |
| 12125 | else if (nid == 0x16) |
| 12126 | return 2; |
| 12127 | else |
| 12128 | return 1; |
| 12129 | } |
| 12130 | |
| 12131 | 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] | 12132 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12133 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12134 | unsigned long val; |
| 12135 | int vbit; |
| 12136 | |
| 12137 | vbit = alc262_check_volbit(nid); |
| 12138 | if (!vbit) |
| 12139 | return 0; |
| 12140 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12141 | return 0; |
| 12142 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12143 | if (vbit == 2) |
| 12144 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12145 | else |
| 12146 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12147 | 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] | 12148 | } |
| 12149 | |
| 12150 | 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] | 12151 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12152 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12153 | unsigned long val; |
| 12154 | |
| 12155 | if (!nid) |
| 12156 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12157 | if (nid == 0x16) |
| 12158 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12159 | else |
| 12160 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12161 | 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] | 12162 | } |
| 12163 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12164 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12165 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12166 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12167 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12168 | const char *pfx; |
| 12169 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12170 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12171 | |
| 12172 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12173 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12174 | spec->multiout.dac_nids[0] = 2; |
| 12175 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 12176 | pfx = alc_get_line_out_pfx(spec, true); |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12177 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12178 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12179 | for (i = 0; i < 2; i++) { |
| 12180 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12181 | if (err < 0) |
| 12182 | return err; |
| 12183 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12184 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12185 | "Speaker", i); |
| 12186 | if (err < 0) |
| 12187 | return err; |
| 12188 | } |
| 12189 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12190 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12191 | "Headphone", i); |
| 12192 | if (err < 0) |
| 12193 | return err; |
| 12194 | } |
| 12195 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12196 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12197 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12198 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12199 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12200 | if (vbits == 1 || vbits == 2) |
| 12201 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12202 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12203 | for (i = 0; i < 2; i++) { |
| 12204 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12205 | &vbits, i); |
| 12206 | if (err < 0) |
| 12207 | return err; |
| 12208 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12209 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12210 | "Speaker", &vbits, i); |
| 12211 | if (err < 0) |
| 12212 | return err; |
| 12213 | } |
| 12214 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12215 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12216 | "Headphone", &vbits, i); |
| 12217 | if (err < 0) |
| 12218 | return err; |
| 12219 | } |
| 12220 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12221 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12222 | } |
| 12223 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12224 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12225 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12226 | |
| 12227 | /* |
| 12228 | * generic initialization of ADC, input mixers and output mixers |
| 12229 | */ |
| 12230 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 12231 | /* |
| 12232 | * Unmute ADC0-2 and set the default input to mic-in |
| 12233 | */ |
| 12234 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12235 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12236 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12237 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12238 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12239 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12240 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12241 | /* 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] | 12242 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12243 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12244 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12245 | */ |
| 12246 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12247 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12248 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12249 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12250 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12251 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12252 | |
| 12253 | /* |
| 12254 | * Set up output mixers (0x0c - 0x0f) |
| 12255 | */ |
| 12256 | /* set vol=0 to output mixers */ |
| 12257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12259 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12260 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12261 | /* set up input amps for analog loopback */ |
| 12262 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12265 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12266 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12267 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12268 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12269 | |
| 12270 | /* FIXME: use matrix-type input source selection */ |
| 12271 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12272 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12273 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12274 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12275 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12276 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12277 | /* Input mixer2 */ |
| 12278 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12279 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12280 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12281 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12282 | /* Input mixer3 */ |
| 12283 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12284 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12285 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12286 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12287 | |
| 12288 | { } |
| 12289 | }; |
| 12290 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12291 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 12292 | /* |
| 12293 | * Unmute ADC0-2 and set the default input to mic-in |
| 12294 | */ |
| 12295 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12296 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12297 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12298 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12299 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12300 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12301 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12302 | /* 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] | 12303 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12304 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12305 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12306 | */ |
| 12307 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12311 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12312 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12313 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12314 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12315 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12316 | /* |
| 12317 | * Set up output mixers (0x0c - 0x0e) |
| 12318 | */ |
| 12319 | /* set vol=0 to output mixers */ |
| 12320 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12321 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12322 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12323 | |
| 12324 | /* set up input amps for analog loopback */ |
| 12325 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12326 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12327 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12328 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12329 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12330 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12331 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12332 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12333 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12334 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12335 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12336 | |
| 12337 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12338 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12339 | |
| 12340 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12341 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12342 | |
| 12343 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12344 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12345 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12346 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12347 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12348 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12349 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12350 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12351 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12352 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12353 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12354 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12355 | |
| 12356 | |
| 12357 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12358 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12359 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12360 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12364 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12365 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12366 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12367 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12368 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12369 | /* Input mixer2 */ |
| 12370 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12371 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12372 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12373 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12374 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12375 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12376 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12377 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12378 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12379 | /* Input mixer3 */ |
| 12380 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12381 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12382 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12383 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12384 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12385 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12389 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12390 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12392 | { } |
| 12393 | }; |
| 12394 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12395 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12396 | /* |
| 12397 | * Unmute ADC0-2 and set the default input to mic-in |
| 12398 | */ |
| 12399 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12401 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12402 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12403 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12404 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12405 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12406 | /* 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] | 12407 | * mixer widget |
| 12408 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12409 | * panel mic (mic 2) |
| 12410 | */ |
| 12411 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12412 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12413 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12415 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12416 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12417 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12418 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12419 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12420 | /* |
| 12421 | * Set up output mixers (0x0c - 0x0e) |
| 12422 | */ |
| 12423 | /* set vol=0 to output mixers */ |
| 12424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12425 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12426 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12427 | |
| 12428 | /* set up input amps for analog loopback */ |
| 12429 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12432 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12433 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12435 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12436 | |
| 12437 | |
| 12438 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12439 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12440 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12441 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12442 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12444 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12445 | |
| 12446 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12447 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12448 | |
| 12449 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12450 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12451 | |
| 12452 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12453 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12454 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12455 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12456 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12457 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12458 | |
| 12459 | /* FIXME: use matrix-type input source selection */ |
| 12460 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12461 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12462 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12463 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12464 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12465 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12466 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12467 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12468 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12469 | /* Input mixer2 */ |
| 12470 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12471 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12472 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12473 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12474 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12475 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12476 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12477 | /* Input mixer3 */ |
| 12478 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12479 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12480 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12483 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12484 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12485 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12486 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12487 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12488 | { } |
| 12489 | }; |
| 12490 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12491 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12492 | |
| 12493 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12494 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12495 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12496 | |
| 12497 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12498 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12499 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12500 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12501 | |
| 12502 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12504 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12505 | {} |
| 12506 | }; |
| 12507 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12508 | /* |
| 12509 | * Pin config fixes |
| 12510 | */ |
| 12511 | enum { |
| 12512 | PINFIX_FSC_H270, |
| 12513 | }; |
| 12514 | |
| 12515 | static const struct alc_fixup alc262_fixups[] = { |
| 12516 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12517 | .type = ALC_FIXUP_PINS, |
| 12518 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12519 | { 0x14, 0x99130110 }, /* speaker */ |
| 12520 | { 0x15, 0x0221142f }, /* front HP */ |
| 12521 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12522 | { } |
| 12523 | } |
| 12524 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12525 | }; |
| 12526 | |
| 12527 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12528 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12529 | {} |
| 12530 | }; |
| 12531 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12532 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12533 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12534 | #define alc262_loopbacks alc880_loopbacks |
| 12535 | #endif |
| 12536 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12537 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12538 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12539 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12540 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12541 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12542 | |
| 12543 | /* |
| 12544 | * BIOS auto configuration |
| 12545 | */ |
| 12546 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12547 | { |
| 12548 | struct alc_spec *spec = codec->spec; |
| 12549 | int err; |
| 12550 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12551 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12552 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12553 | alc262_ignore); |
| 12554 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12555 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12556 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12557 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12558 | spec->multiout.max_channels = 2; |
| 12559 | spec->no_analog = 1; |
| 12560 | goto dig_only; |
| 12561 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12562 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12563 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12564 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12565 | if (err < 0) |
| 12566 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12567 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12568 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12569 | return err; |
| 12570 | |
| 12571 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12572 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12573 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12574 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12575 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12576 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12577 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12578 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12579 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12580 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12581 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12582 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12583 | err = alc_auto_add_mic_boost(codec); |
| 12584 | if (err < 0) |
| 12585 | return err; |
| 12586 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12587 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12588 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12589 | return 1; |
| 12590 | } |
| 12591 | |
| 12592 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12593 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12594 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12595 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12596 | |
| 12597 | |
| 12598 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12599 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12600 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12601 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12602 | alc262_auto_init_multi_out(codec); |
| 12603 | alc262_auto_init_hp_out(codec); |
| 12604 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12605 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12606 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12607 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12608 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12609 | } |
| 12610 | |
| 12611 | /* |
| 12612 | * configuration and preset |
| 12613 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12614 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12615 | [ALC262_BASIC] = "basic", |
| 12616 | [ALC262_HIPPO] = "hippo", |
| 12617 | [ALC262_HIPPO_1] = "hippo_1", |
| 12618 | [ALC262_FUJITSU] = "fujitsu", |
| 12619 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12620 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12621 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12622 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12623 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12624 | [ALC262_BENQ_T31] = "benq-t31", |
| 12625 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12626 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12627 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12628 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12629 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12630 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12631 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12632 | [ALC262_AUTO] = "auto", |
| 12633 | }; |
| 12634 | |
| 12635 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12636 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12637 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12638 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12639 | ALC262_HP_BPC), |
| 12640 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12641 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12642 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12643 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12644 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12645 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12646 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12647 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12648 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12649 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12650 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12651 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12652 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12653 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12654 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12655 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12656 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12657 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12658 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12659 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12660 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12661 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12662 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12663 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12664 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12665 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12666 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12667 | #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] | 12668 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12669 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12670 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12671 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12672 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12673 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12674 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12675 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12676 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12677 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12678 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12679 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12680 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12681 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12682 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12683 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12684 | {} |
| 12685 | }; |
| 12686 | |
| 12687 | static struct alc_config_preset alc262_presets[] = { |
| 12688 | [ALC262_BASIC] = { |
| 12689 | .mixers = { alc262_base_mixer }, |
| 12690 | .init_verbs = { alc262_init_verbs }, |
| 12691 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12692 | .dac_nids = alc262_dac_nids, |
| 12693 | .hp_nid = 0x03, |
| 12694 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12695 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12696 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12697 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12698 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12699 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12700 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12701 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12702 | .dac_nids = alc262_dac_nids, |
| 12703 | .hp_nid = 0x03, |
| 12704 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12705 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12706 | .channel_mode = alc262_modes, |
| 12707 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12708 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12709 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12710 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12711 | }, |
| 12712 | [ALC262_HIPPO_1] = { |
| 12713 | .mixers = { alc262_hippo1_mixer }, |
| 12714 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12715 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12716 | .dac_nids = alc262_dac_nids, |
| 12717 | .hp_nid = 0x02, |
| 12718 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12719 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12720 | .channel_mode = alc262_modes, |
| 12721 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12722 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12723 | .setup = alc262_hippo1_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12724 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12725 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12726 | [ALC262_FUJITSU] = { |
| 12727 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12728 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12729 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12730 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12731 | .dac_nids = alc262_dac_nids, |
| 12732 | .hp_nid = 0x03, |
| 12733 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12734 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12735 | .channel_mode = alc262_modes, |
| 12736 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12737 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12738 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12739 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12740 | [ALC262_HP_BPC] = { |
| 12741 | .mixers = { alc262_HP_BPC_mixer }, |
| 12742 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12743 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12744 | .dac_nids = alc262_dac_nids, |
| 12745 | .hp_nid = 0x03, |
| 12746 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12747 | .channel_mode = alc262_modes, |
| 12748 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12749 | .unsol_event = alc_sku_unsol_event, |
| 12750 | .setup = alc262_hp_bpc_setup, |
| 12751 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12752 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12753 | [ALC262_HP_BPC_D7000_WF] = { |
| 12754 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12755 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12756 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12757 | .dac_nids = alc262_dac_nids, |
| 12758 | .hp_nid = 0x03, |
| 12759 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12760 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12761 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12762 | .unsol_event = alc_sku_unsol_event, |
| 12763 | .setup = alc262_hp_wildwest_setup, |
| 12764 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12765 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12766 | [ALC262_HP_BPC_D7000_WL] = { |
| 12767 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12768 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12769 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12770 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12771 | .dac_nids = alc262_dac_nids, |
| 12772 | .hp_nid = 0x03, |
| 12773 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12774 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12775 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12776 | .unsol_event = alc_sku_unsol_event, |
| 12777 | .setup = alc262_hp_wildwest_setup, |
| 12778 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12779 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12780 | [ALC262_HP_TC_T5735] = { |
| 12781 | .mixers = { alc262_hp_t5735_mixer }, |
| 12782 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12783 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12784 | .dac_nids = alc262_dac_nids, |
| 12785 | .hp_nid = 0x03, |
| 12786 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12787 | .channel_mode = alc262_modes, |
| 12788 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12789 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12790 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12791 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12792 | }, |
| 12793 | [ALC262_HP_RP5700] = { |
| 12794 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12795 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12796 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12797 | .dac_nids = alc262_dac_nids, |
| 12798 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12799 | .channel_mode = alc262_modes, |
| 12800 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12801 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12802 | [ALC262_BENQ_ED8] = { |
| 12803 | .mixers = { alc262_base_mixer }, |
| 12804 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12805 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12806 | .dac_nids = alc262_dac_nids, |
| 12807 | .hp_nid = 0x03, |
| 12808 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12809 | .channel_mode = alc262_modes, |
| 12810 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12811 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12812 | [ALC262_SONY_ASSAMD] = { |
| 12813 | .mixers = { alc262_sony_mixer }, |
| 12814 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12815 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12816 | .dac_nids = alc262_dac_nids, |
| 12817 | .hp_nid = 0x02, |
| 12818 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12819 | .channel_mode = alc262_modes, |
| 12820 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12821 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12822 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12823 | .init_hook = alc_inithook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12824 | }, |
| 12825 | [ALC262_BENQ_T31] = { |
| 12826 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12827 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12828 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12829 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12830 | .dac_nids = alc262_dac_nids, |
| 12831 | .hp_nid = 0x03, |
| 12832 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12833 | .channel_mode = alc262_modes, |
| 12834 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12835 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12836 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12837 | .init_hook = alc_inithook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12838 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12839 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12840 | .mixers = { alc262_ultra_mixer }, |
| 12841 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12842 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12843 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12844 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12845 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12846 | .channel_mode = alc262_modes, |
| 12847 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12848 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12849 | .capsrc_nids = alc262_capsrc_nids, |
| 12850 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12851 | .unsol_event = alc262_ultra_unsol_event, |
| 12852 | .init_hook = alc262_ultra_automute, |
| 12853 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12854 | [ALC262_LENOVO_3000] = { |
| 12855 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12856 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12857 | alc262_lenovo_3000_unsol_verbs, |
| 12858 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12859 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12860 | .dac_nids = alc262_dac_nids, |
| 12861 | .hp_nid = 0x03, |
| 12862 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12863 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12864 | .channel_mode = alc262_modes, |
| 12865 | .input_mux = &alc262_fujitsu_capture_source, |
| 12866 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12867 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12868 | [ALC262_NEC] = { |
| 12869 | .mixers = { alc262_nec_mixer }, |
| 12870 | .init_verbs = { alc262_nec_verbs }, |
| 12871 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12872 | .dac_nids = alc262_dac_nids, |
| 12873 | .hp_nid = 0x03, |
| 12874 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12875 | .channel_mode = alc262_modes, |
| 12876 | .input_mux = &alc262_capture_source, |
| 12877 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12878 | [ALC262_TOSHIBA_S06] = { |
| 12879 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12880 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12881 | alc262_eapd_verbs }, |
| 12882 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12883 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12884 | .dac_nids = alc262_dac_nids, |
| 12885 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12886 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12887 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12888 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12889 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12890 | .unsol_event = alc_sku_unsol_event, |
| 12891 | .setup = alc262_toshiba_s06_setup, |
| 12892 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12893 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12894 | [ALC262_TOSHIBA_RX1] = { |
| 12895 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12896 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12897 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12898 | .dac_nids = alc262_dac_nids, |
| 12899 | .hp_nid = 0x03, |
| 12900 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12901 | .channel_mode = alc262_modes, |
| 12902 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12903 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12904 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 12905 | .init_hook = alc_inithook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12906 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12907 | [ALC262_TYAN] = { |
| 12908 | .mixers = { alc262_tyan_mixer }, |
| 12909 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12910 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12911 | .dac_nids = alc262_dac_nids, |
| 12912 | .hp_nid = 0x02, |
| 12913 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12914 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12915 | .channel_mode = alc262_modes, |
| 12916 | .input_mux = &alc262_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12917 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12918 | .setup = alc262_tyan_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12919 | .init_hook = alc_hp_automute, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12920 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12921 | }; |
| 12922 | |
| 12923 | static int patch_alc262(struct hda_codec *codec) |
| 12924 | { |
| 12925 | struct alc_spec *spec; |
| 12926 | int board_config; |
| 12927 | int err; |
| 12928 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12929 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12930 | if (spec == NULL) |
| 12931 | return -ENOMEM; |
| 12932 | |
| 12933 | codec->spec = spec; |
| 12934 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12935 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12936 | * under-run |
| 12937 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12938 | { |
| 12939 | int tmp; |
| 12940 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12941 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12942 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12943 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12944 | } |
| 12945 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12946 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12947 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12948 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12949 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12950 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12951 | alc262_models, |
| 12952 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12953 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12954 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12955 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12956 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12957 | board_config = ALC262_AUTO; |
| 12958 | } |
| 12959 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12960 | if (board_config == ALC262_AUTO) { |
| 12961 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12962 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12963 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12964 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12965 | if (board_config == ALC262_AUTO) { |
| 12966 | /* automatic parse from the BIOS config */ |
| 12967 | err = alc262_parse_auto_config(codec); |
| 12968 | if (err < 0) { |
| 12969 | alc_free(codec); |
| 12970 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12971 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12972 | printk(KERN_INFO |
| 12973 | "hda_codec: Cannot set up configuration " |
| 12974 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12975 | board_config = ALC262_BASIC; |
| 12976 | } |
| 12977 | } |
| 12978 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12979 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12980 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12981 | if (err < 0) { |
| 12982 | alc_free(codec); |
| 12983 | return err; |
| 12984 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12985 | } |
| 12986 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12987 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12988 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12989 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12990 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12991 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12992 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12993 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12994 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12995 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12996 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12997 | int i; |
| 12998 | /* check whether the digital-mic has to be supported */ |
| 12999 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 13000 | if (spec->input_mux->items[i].index >= 9) |
| 13001 | break; |
| 13002 | } |
| 13003 | if (i < spec->input_mux->num_items) { |
| 13004 | /* use only ADC0 */ |
| 13005 | spec->adc_nids = alc262_dmic_adc_nids; |
| 13006 | spec->num_adc_nids = 1; |
| 13007 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13008 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13009 | /* all analog inputs */ |
| 13010 | /* check whether NID 0x07 is valid */ |
| 13011 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 13012 | |
| 13013 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13014 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13015 | if (wcap != AC_WID_AUD_IN) { |
| 13016 | spec->adc_nids = alc262_adc_nids_alt; |
| 13017 | spec->num_adc_nids = |
| 13018 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13019 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13020 | } else { |
| 13021 | spec->adc_nids = alc262_adc_nids; |
| 13022 | spec->num_adc_nids = |
| 13023 | ARRAY_SIZE(alc262_adc_nids); |
| 13024 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13025 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13026 | } |
| 13027 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13028 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13029 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13030 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13031 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13032 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13033 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13034 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13035 | spec->vmaster_nid = 0x0c; |
| 13036 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13037 | codec->patch_ops = alc_patch_ops; |
| 13038 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13039 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 13040 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13041 | |
| 13042 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13043 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13044 | if (!spec->loopback.amplist) |
| 13045 | spec->loopback.amplist = alc262_loopbacks; |
| 13046 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13047 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13048 | return 0; |
| 13049 | } |
| 13050 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13051 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13052 | * ALC268 channel source setting (2 channel) |
| 13053 | */ |
| 13054 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13055 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13056 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13057 | static hda_nid_t alc268_dac_nids[2] = { |
| 13058 | /* front, hp */ |
| 13059 | 0x02, 0x03 |
| 13060 | }; |
| 13061 | |
| 13062 | static hda_nid_t alc268_adc_nids[2] = { |
| 13063 | /* ADC0-1 */ |
| 13064 | 0x08, 0x07 |
| 13065 | }; |
| 13066 | |
| 13067 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 13068 | /* ADC0 */ |
| 13069 | 0x08 |
| 13070 | }; |
| 13071 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13072 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 13073 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13074 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 13075 | /* output mixer control */ |
| 13076 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13077 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13078 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13080 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13081 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13082 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13083 | { } |
| 13084 | }; |
| 13085 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13086 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 13087 | /* output mixer control */ |
| 13088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13089 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13090 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13091 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13092 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13093 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13094 | { } |
| 13095 | }; |
| 13096 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13097 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 13098 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 13099 | .ops = &snd_hda_bind_sw, |
| 13100 | .values = { |
| 13101 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13102 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13103 | 0 |
| 13104 | }, |
| 13105 | }; |
| 13106 | |
| 13107 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 13108 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13109 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13110 | { } |
| 13111 | }; |
| 13112 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13113 | static struct hda_verb alc268_eapd_verbs[] = { |
| 13114 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13115 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13116 | { } |
| 13117 | }; |
| 13118 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13119 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13120 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 13121 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13122 | { } /* end */ |
| 13123 | }; |
| 13124 | |
| 13125 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13126 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13127 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 13128 | .ops = &snd_hda_bind_vol, |
| 13129 | .values = { |
| 13130 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13131 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13132 | 0 |
| 13133 | }, |
| 13134 | }; |
| 13135 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13136 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 13137 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 13138 | { |
| 13139 | struct alc_spec *spec = codec->spec; |
| 13140 | unsigned int mute; |
| 13141 | |
| 13142 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13143 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13144 | spec->sense_updated = 1; |
| 13145 | } |
| 13146 | if (spec->jack_present) |
| 13147 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 13148 | else /* unmute internal speaker if necessary */ |
| 13149 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13150 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13151 | HDA_AMP_MUTE, mute); |
| 13152 | } |
| 13153 | |
| 13154 | |
| 13155 | /* bind hp and internal speaker mute (with plug check) */ |
| 13156 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 13157 | struct snd_ctl_elem_value *ucontrol) |
| 13158 | { |
| 13159 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 13160 | long *valp = ucontrol->value.integer.value; |
| 13161 | int change; |
| 13162 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 13163 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13164 | if (change) |
| 13165 | alc268_acer_automute(codec, 0); |
| 13166 | return change; |
| 13167 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13168 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13169 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 13170 | /* output mixer control */ |
| 13171 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13172 | { |
| 13173 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13174 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13175 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13176 | .info = snd_hda_mixer_amp_switch_info, |
| 13177 | .get = snd_hda_mixer_amp_switch_get, |
| 13178 | .put = alc268_acer_master_sw_put, |
| 13179 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13180 | }, |
| 13181 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13182 | { } |
| 13183 | }; |
| 13184 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13185 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 13186 | /* output mixer control */ |
| 13187 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13188 | { |
| 13189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13190 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13191 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13192 | .info = snd_hda_mixer_amp_switch_info, |
| 13193 | .get = snd_hda_mixer_amp_switch_get, |
| 13194 | .put = alc268_acer_master_sw_put, |
| 13195 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13196 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13197 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13198 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13199 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13200 | { } |
| 13201 | }; |
| 13202 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13203 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 13204 | /* output mixer control */ |
| 13205 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13206 | { |
| 13207 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13208 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13209 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13210 | .info = snd_hda_mixer_amp_switch_info, |
| 13211 | .get = snd_hda_mixer_amp_switch_get, |
| 13212 | .put = alc268_acer_master_sw_put, |
| 13213 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13214 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13215 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13216 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13217 | { } |
| 13218 | }; |
| 13219 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13220 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 13221 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13222 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13223 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13224 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13225 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13226 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13227 | { } |
| 13228 | }; |
| 13229 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13230 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13231 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13232 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13234 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13235 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13236 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13237 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13238 | { } |
| 13239 | }; |
| 13240 | |
| 13241 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13242 | #define alc268_toshiba_setup alc262_hippo_setup |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13243 | |
| 13244 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 13245 | unsigned int res) |
| 13246 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13247 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13248 | return; |
| 13249 | alc268_acer_automute(codec, 1); |
| 13250 | } |
| 13251 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13252 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 13253 | { |
| 13254 | alc268_acer_automute(codec, 1); |
| 13255 | } |
| 13256 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13257 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13258 | { |
| 13259 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13260 | spec->autocfg.hp_pins[0] = 0x15; |
| 13261 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13262 | spec->automute_mixer_nid[0] = 0x0f; |
| 13263 | spec->automute = 1; |
| 13264 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13265 | spec->ext_mic.pin = 0x18; |
| 13266 | spec->ext_mic.mux_idx = 0; |
| 13267 | spec->int_mic.pin = 0x12; |
| 13268 | spec->int_mic.mux_idx = 6; |
| 13269 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13270 | } |
| 13271 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13272 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 13273 | /* output mixer control */ |
| 13274 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13275 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13276 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13277 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13278 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13279 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13280 | { } |
| 13281 | }; |
| 13282 | |
| 13283 | static struct hda_verb alc268_dell_verbs[] = { |
| 13284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13285 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13286 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13287 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13288 | { } |
| 13289 | }; |
| 13290 | |
| 13291 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13292 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13293 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13294 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13295 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13296 | spec->autocfg.hp_pins[0] = 0x15; |
| 13297 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13298 | spec->ext_mic.pin = 0x18; |
| 13299 | spec->ext_mic.mux_idx = 0; |
| 13300 | spec->int_mic.pin = 0x19; |
| 13301 | spec->int_mic.mux_idx = 1; |
| 13302 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13303 | spec->automute = 1; |
| 13304 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13305 | } |
| 13306 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13307 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13308 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13309 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13310 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13311 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13312 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13313 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13314 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13315 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13316 | { } |
| 13317 | }; |
| 13318 | |
| 13319 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13320 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13321 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13322 | { } |
| 13323 | }; |
| 13324 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13325 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13326 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13327 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13328 | spec->autocfg.hp_pins[0] = 0x15; |
| 13329 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13330 | spec->ext_mic.pin = 0x18; |
| 13331 | spec->ext_mic.mux_idx = 0; |
| 13332 | spec->int_mic.pin = 0x19; |
| 13333 | spec->int_mic.mux_idx = 1; |
| 13334 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13335 | spec->automute = 1; |
| 13336 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13337 | } |
| 13338 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13339 | /* |
| 13340 | * generic initialization of ADC, input mixers and output mixers |
| 13341 | */ |
| 13342 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13343 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13344 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13345 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13346 | |
| 13347 | /* |
| 13348 | * Set up output mixers (0x0c - 0x0e) |
| 13349 | */ |
| 13350 | /* set vol=0 to output mixers */ |
| 13351 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13352 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13353 | |
| 13354 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13355 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13356 | |
| 13357 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13359 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13360 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13361 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13362 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13363 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13364 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13365 | |
| 13366 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13367 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13368 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13369 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13370 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13371 | |
| 13372 | /* set PCBEEP vol = 0, mute connections */ |
| 13373 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13374 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13375 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13376 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13377 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13378 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13379 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13381 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13383 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13384 | { } |
| 13385 | }; |
| 13386 | |
| 13387 | /* |
| 13388 | * generic initialization of ADC, input mixers and output mixers |
| 13389 | */ |
| 13390 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13391 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13392 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13393 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13394 | |
| 13395 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13396 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13397 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13398 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13399 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13400 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13402 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13403 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13404 | |
| 13405 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13406 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13407 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13408 | /* set PCBEEP vol = 0, mute connections */ |
| 13409 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13410 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13411 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13412 | |
| 13413 | { } |
| 13414 | }; |
| 13415 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13416 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13417 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13418 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13419 | { } /* end */ |
| 13420 | }; |
| 13421 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13422 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13423 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13424 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13425 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13426 | { } /* end */ |
| 13427 | }; |
| 13428 | |
| 13429 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13430 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13431 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13432 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13433 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13434 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13435 | { } /* end */ |
| 13436 | }; |
| 13437 | |
| 13438 | static struct hda_input_mux alc268_capture_source = { |
| 13439 | .num_items = 4, |
| 13440 | .items = { |
| 13441 | { "Mic", 0x0 }, |
| 13442 | { "Front Mic", 0x1 }, |
| 13443 | { "Line", 0x2 }, |
| 13444 | { "CD", 0x3 }, |
| 13445 | }, |
| 13446 | }; |
| 13447 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13448 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13449 | .num_items = 3, |
| 13450 | .items = { |
| 13451 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13452 | { "Internal Mic", 0x1 }, |
| 13453 | { "Line", 0x2 }, |
| 13454 | }, |
| 13455 | }; |
| 13456 | |
| 13457 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13458 | .num_items = 3, |
| 13459 | .items = { |
| 13460 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13461 | { "Internal Mic", 0x6 }, |
| 13462 | { "Line", 0x2 }, |
| 13463 | }, |
| 13464 | }; |
| 13465 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13466 | #ifdef CONFIG_SND_DEBUG |
| 13467 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13468 | /* Volume widgets */ |
| 13469 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13470 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13471 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13472 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13473 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13474 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13475 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13476 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13477 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13478 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13479 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13480 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13481 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13482 | /* The below appears problematic on some hardwares */ |
| 13483 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13484 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13485 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13486 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13487 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13488 | |
| 13489 | /* Modes for retasking pin widgets */ |
| 13490 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13491 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13492 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13493 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13494 | |
| 13495 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13496 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13497 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13498 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13499 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13500 | |
| 13501 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13502 | * The ALC268 does not have an SPDIF input. |
| 13503 | */ |
| 13504 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13505 | |
| 13506 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13507 | * this output to turn on an external amplifier. |
| 13508 | */ |
| 13509 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13510 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13511 | |
| 13512 | { } /* end */ |
| 13513 | }; |
| 13514 | #endif |
| 13515 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13516 | /* create input playback/capture controls for the given pin */ |
| 13517 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13518 | const char *ctlname, int idx) |
| 13519 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13520 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13521 | int err; |
| 13522 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13523 | switch (nid) { |
| 13524 | case 0x14: |
| 13525 | case 0x16: |
| 13526 | dac = 0x02; |
| 13527 | break; |
| 13528 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13529 | case 0x1a: /* ALC259/269 only */ |
| 13530 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13531 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13532 | dac = 0x03; |
| 13533 | break; |
| 13534 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13535 | snd_printd(KERN_WARNING "hda_codec: " |
| 13536 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13537 | return 0; |
| 13538 | } |
| 13539 | if (spec->multiout.dac_nids[0] != dac && |
| 13540 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13541 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13542 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13543 | HDA_OUTPUT)); |
| 13544 | if (err < 0) |
| 13545 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13546 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13547 | } |
| 13548 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13549 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13550 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13551 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13552 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13553 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13554 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13555 | if (err < 0) |
| 13556 | return err; |
| 13557 | return 0; |
| 13558 | } |
| 13559 | |
| 13560 | /* add playback controls from the parsed DAC table */ |
| 13561 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13562 | const struct auto_pin_cfg *cfg) |
| 13563 | { |
| 13564 | hda_nid_t nid; |
| 13565 | int err; |
| 13566 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13567 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13568 | |
| 13569 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13570 | if (nid) { |
| 13571 | const char *name; |
| 13572 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13573 | name = "Speaker"; |
| 13574 | else |
| 13575 | name = "Front"; |
| 13576 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13577 | if (err < 0) |
| 13578 | return err; |
| 13579 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13580 | |
| 13581 | nid = cfg->speaker_pins[0]; |
| 13582 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13583 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13584 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13585 | if (err < 0) |
| 13586 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13587 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13588 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13589 | if (err < 0) |
| 13590 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13591 | } |
| 13592 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13593 | if (nid) { |
| 13594 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13595 | if (err < 0) |
| 13596 | return err; |
| 13597 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13598 | |
| 13599 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13600 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13601 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13602 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13603 | if (err < 0) |
| 13604 | return err; |
| 13605 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13606 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13607 | } |
| 13608 | |
| 13609 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13610 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13611 | const struct auto_pin_cfg *cfg) |
| 13612 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13613 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13614 | } |
| 13615 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13616 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13617 | hda_nid_t nid, int pin_type) |
| 13618 | { |
| 13619 | int idx; |
| 13620 | |
| 13621 | alc_set_pin_output(codec, nid, pin_type); |
| 13622 | if (nid == 0x14 || nid == 0x16) |
| 13623 | idx = 0; |
| 13624 | else |
| 13625 | idx = 1; |
| 13626 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13627 | } |
| 13628 | |
| 13629 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13630 | { |
| 13631 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13632 | int i; |
| 13633 | |
| 13634 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13635 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13636 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13637 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13638 | } |
| 13639 | } |
| 13640 | |
| 13641 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13642 | { |
| 13643 | struct alc_spec *spec = codec->spec; |
| 13644 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13645 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13646 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13647 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13648 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13649 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13650 | } |
| 13651 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13652 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13653 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13654 | } |
| 13655 | if (spec->autocfg.mono_out_pin) |
| 13656 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13657 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13658 | } |
| 13659 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13660 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13661 | { |
| 13662 | struct alc_spec *spec = codec->spec; |
| 13663 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13664 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13665 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13666 | unsigned int dac_vol1, dac_vol2; |
| 13667 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13668 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13669 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13670 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13671 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13672 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13673 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13674 | AMP_IN_UNMUTE(1)); |
| 13675 | snd_hda_codec_write(codec, 0x10, 0, |
| 13676 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13677 | AMP_IN_UNMUTE(1)); |
| 13678 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13679 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13680 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13681 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13682 | snd_hda_codec_write(codec, 0x10, 0, |
| 13683 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13684 | } |
| 13685 | |
| 13686 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13687 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13688 | dac_vol2 = AMP_OUT_ZERO; |
| 13689 | else if (line_nid == 0x15) |
| 13690 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13691 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13692 | dac_vol2 = AMP_OUT_ZERO; |
| 13693 | else if (hp_nid == 0x15) |
| 13694 | dac_vol1 = AMP_OUT_ZERO; |
| 13695 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13696 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13697 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13698 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13699 | |
| 13700 | snd_hda_codec_write(codec, 0x02, 0, |
| 13701 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13702 | snd_hda_codec_write(codec, 0x03, 0, |
| 13703 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13704 | } |
| 13705 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13706 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13707 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13708 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13709 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13710 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13711 | |
| 13712 | /* |
| 13713 | * BIOS auto configuration |
| 13714 | */ |
| 13715 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13716 | { |
| 13717 | struct alc_spec *spec = codec->spec; |
| 13718 | int err; |
| 13719 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13720 | |
| 13721 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13722 | alc268_ignore); |
| 13723 | if (err < 0) |
| 13724 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13725 | if (!spec->autocfg.line_outs) { |
| 13726 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13727 | spec->multiout.max_channels = 2; |
| 13728 | spec->no_analog = 1; |
| 13729 | goto dig_only; |
| 13730 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13731 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13732 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13733 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13734 | if (err < 0) |
| 13735 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13736 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13737 | if (err < 0) |
| 13738 | return err; |
| 13739 | |
| 13740 | spec->multiout.max_channels = 2; |
| 13741 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13742 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13744 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13745 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13746 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13747 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13748 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13749 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13750 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13751 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13752 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13753 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13754 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13755 | err = alc_auto_add_mic_boost(codec); |
| 13756 | if (err < 0) |
| 13757 | return err; |
| 13758 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13759 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13760 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13761 | return 1; |
| 13762 | } |
| 13763 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13764 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13765 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13766 | |
| 13767 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13768 | static void alc268_auto_init(struct hda_codec *codec) |
| 13769 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13770 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13771 | alc268_auto_init_multi_out(codec); |
| 13772 | alc268_auto_init_hp_out(codec); |
| 13773 | alc268_auto_init_mono_speaker_out(codec); |
| 13774 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13775 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13776 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13777 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13778 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13779 | } |
| 13780 | |
| 13781 | /* |
| 13782 | * configuration and preset |
| 13783 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13784 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13785 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13786 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13787 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13788 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13789 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13790 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13791 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13792 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13793 | #ifdef CONFIG_SND_DEBUG |
| 13794 | [ALC268_TEST] = "test", |
| 13795 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13796 | [ALC268_AUTO] = "auto", |
| 13797 | }; |
| 13798 | |
| 13799 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13800 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13801 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13802 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13803 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13804 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13805 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13806 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13807 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13808 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13809 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13810 | /* almost compatible with toshiba but with optional digital outs; |
| 13811 | * auto-probing seems working fine |
| 13812 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13813 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13814 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13815 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13816 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13817 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13818 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13819 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13820 | {} |
| 13821 | }; |
| 13822 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13823 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13824 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13825 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13826 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13827 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13828 | ALC268_TOSHIBA), |
| 13829 | {} |
| 13830 | }; |
| 13831 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13832 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13833 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13834 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13835 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13836 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13837 | alc267_quanta_il1_verbs }, |
| 13838 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13839 | .dac_nids = alc268_dac_nids, |
| 13840 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13841 | .adc_nids = alc268_adc_nids_alt, |
| 13842 | .hp_nid = 0x03, |
| 13843 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13844 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13845 | .unsol_event = alc_sku_unsol_event, |
| 13846 | .setup = alc267_quanta_il1_setup, |
| 13847 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13848 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13849 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13850 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13851 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13852 | .init_verbs = { alc268_base_init_verbs }, |
| 13853 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13854 | .dac_nids = alc268_dac_nids, |
| 13855 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13856 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13857 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13858 | .hp_nid = 0x03, |
| 13859 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13860 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13861 | .channel_mode = alc268_modes, |
| 13862 | .input_mux = &alc268_capture_source, |
| 13863 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13864 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13865 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13866 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13867 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13868 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13869 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13870 | .dac_nids = alc268_dac_nids, |
| 13871 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13872 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13873 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13874 | .hp_nid = 0x03, |
| 13875 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13876 | .channel_mode = alc268_modes, |
| 13877 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 13878 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13879 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 13880 | .init_hook = alc_inithook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13881 | }, |
| 13882 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13883 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13884 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13885 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13886 | alc268_acer_verbs }, |
| 13887 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13888 | .dac_nids = alc268_dac_nids, |
| 13889 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13890 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13891 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13892 | .hp_nid = 0x02, |
| 13893 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13894 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13895 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13896 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13897 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13898 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13899 | [ALC268_ACER_DMIC] = { |
| 13900 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13901 | alc268_beep_mixer }, |
| 13902 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13903 | alc268_acer_verbs }, |
| 13904 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13905 | .dac_nids = alc268_dac_nids, |
| 13906 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13907 | .adc_nids = alc268_adc_nids_alt, |
| 13908 | .capsrc_nids = alc268_capsrc_nids, |
| 13909 | .hp_nid = 0x02, |
| 13910 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13911 | .channel_mode = alc268_modes, |
| 13912 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13913 | .unsol_event = alc268_acer_unsol_event, |
| 13914 | .init_hook = alc268_acer_init_hook, |
| 13915 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13916 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13917 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13918 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13919 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13920 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13921 | alc268_acer_aspire_one_verbs }, |
| 13922 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13923 | .dac_nids = alc268_dac_nids, |
| 13924 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13925 | .adc_nids = alc268_adc_nids_alt, |
| 13926 | .capsrc_nids = alc268_capsrc_nids, |
| 13927 | .hp_nid = 0x03, |
| 13928 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13929 | .channel_mode = alc268_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13930 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13931 | .setup = alc268_acer_lc_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13932 | .init_hook = alc_inithook, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13933 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13934 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13935 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13936 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13937 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13938 | alc268_dell_verbs }, |
| 13939 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13940 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13941 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13942 | .adc_nids = alc268_adc_nids_alt, |
| 13943 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13944 | .hp_nid = 0x02, |
| 13945 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13946 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13947 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13948 | .setup = alc268_dell_setup, |
| 13949 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13950 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13951 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13952 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13953 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13954 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13955 | alc268_toshiba_verbs }, |
| 13956 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13957 | .dac_nids = alc268_dac_nids, |
| 13958 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13959 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13960 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13961 | .hp_nid = 0x03, |
| 13962 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13963 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13964 | .channel_mode = alc268_modes, |
| 13965 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 13966 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13967 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 13968 | .init_hook = alc_inithook, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13969 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13970 | #ifdef CONFIG_SND_DEBUG |
| 13971 | [ALC268_TEST] = { |
| 13972 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13973 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13974 | alc268_volume_init_verbs }, |
| 13975 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13976 | .dac_nids = alc268_dac_nids, |
| 13977 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13978 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13979 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13980 | .hp_nid = 0x03, |
| 13981 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13982 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13983 | .channel_mode = alc268_modes, |
| 13984 | .input_mux = &alc268_capture_source, |
| 13985 | }, |
| 13986 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13987 | }; |
| 13988 | |
| 13989 | static int patch_alc268(struct hda_codec *codec) |
| 13990 | { |
| 13991 | struct alc_spec *spec; |
| 13992 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13993 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13994 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13995 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13996 | if (spec == NULL) |
| 13997 | return -ENOMEM; |
| 13998 | |
| 13999 | codec->spec = spec; |
| 14000 | |
| 14001 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 14002 | alc268_models, |
| 14003 | alc268_cfg_tbl); |
| 14004 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14005 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14006 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14007 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14008 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14009 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14010 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14011 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14012 | board_config = ALC268_AUTO; |
| 14013 | } |
| 14014 | |
| 14015 | if (board_config == ALC268_AUTO) { |
| 14016 | /* automatic parse from the BIOS config */ |
| 14017 | err = alc268_parse_auto_config(codec); |
| 14018 | if (err < 0) { |
| 14019 | alc_free(codec); |
| 14020 | return err; |
| 14021 | } else if (!err) { |
| 14022 | printk(KERN_INFO |
| 14023 | "hda_codec: Cannot set up configuration " |
| 14024 | "from BIOS. Using base mode...\n"); |
| 14025 | board_config = ALC268_3ST; |
| 14026 | } |
| 14027 | } |
| 14028 | |
| 14029 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14030 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14031 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14032 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14033 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14034 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14035 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14036 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14037 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14038 | has_beep = 0; |
| 14039 | for (i = 0; i < spec->num_mixers; i++) { |
| 14040 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14041 | has_beep = 1; |
| 14042 | break; |
| 14043 | } |
| 14044 | } |
| 14045 | |
| 14046 | if (has_beep) { |
| 14047 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14048 | if (err < 0) { |
| 14049 | alc_free(codec); |
| 14050 | return err; |
| 14051 | } |
| 14052 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14053 | /* override the amp caps for beep generator */ |
| 14054 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14055 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14056 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14057 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14058 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14059 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14060 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14061 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14062 | /* check whether NID 0x07 is valid */ |
| 14063 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14064 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14065 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14066 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14067 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14068 | if (spec->auto_mic || |
| 14069 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14070 | spec->adc_nids = alc268_adc_nids_alt; |
| 14071 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14072 | if (spec->auto_mic) |
| 14073 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14074 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14075 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14076 | else |
| 14077 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14078 | } else { |
| 14079 | spec->adc_nids = alc268_adc_nids; |
| 14080 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14081 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14082 | } |
| 14083 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14084 | |
| 14085 | spec->vmaster_nid = 0x02; |
| 14086 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14087 | codec->patch_ops = alc_patch_ops; |
| 14088 | if (board_config == ALC268_AUTO) |
| 14089 | spec->init_hook = alc268_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 14090 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14091 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14092 | alc_init_jacks(codec); |
| 14093 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14094 | return 0; |
| 14095 | } |
| 14096 | |
| 14097 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14098 | * ALC269 channel source setting (2 channel) |
| 14099 | */ |
| 14100 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14101 | |
| 14102 | #define alc269_dac_nids alc260_dac_nids |
| 14103 | |
| 14104 | static hda_nid_t alc269_adc_nids[1] = { |
| 14105 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14106 | 0x08, |
| 14107 | }; |
| 14108 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14109 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 14110 | 0x23, |
| 14111 | }; |
| 14112 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14113 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 14114 | /* ADC1 */ |
| 14115 | 0x09, |
| 14116 | }; |
| 14117 | |
| 14118 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 14119 | 0x22, |
| 14120 | }; |
| 14121 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14122 | static hda_nid_t alc269_adc_candidates[] = { |
David Henningsson | 262ac22 | 2011-04-07 11:43:00 +0200 | [diff] [blame] | 14123 | 0x08, 0x09, 0x07, 0x11, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14124 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14125 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14126 | #define alc269_modes alc260_modes |
| 14127 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14128 | |
| 14129 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 14130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14131 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14132 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14133 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14135 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14136 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14137 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14138 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14139 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14141 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14142 | { } /* end */ |
| 14143 | }; |
| 14144 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14145 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 14146 | /* output mixer control */ |
| 14147 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14148 | { |
| 14149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14150 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14151 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14152 | .info = snd_hda_mixer_amp_switch_info, |
| 14153 | .get = snd_hda_mixer_amp_switch_get, |
| 14154 | .put = alc268_acer_master_sw_put, |
| 14155 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14156 | }, |
| 14157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14159 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14160 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14161 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14162 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14163 | { } |
| 14164 | }; |
| 14165 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14166 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 14167 | /* output mixer control */ |
| 14168 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14169 | { |
| 14170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14171 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14172 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14173 | .info = snd_hda_mixer_amp_switch_info, |
| 14174 | .get = snd_hda_mixer_amp_switch_get, |
| 14175 | .put = alc268_acer_master_sw_put, |
| 14176 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14177 | }, |
| 14178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14179 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14180 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14181 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14182 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14183 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14184 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14185 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14186 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14187 | { } |
| 14188 | }; |
| 14189 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14190 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14191 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14192 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14193 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14194 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14195 | { } /* end */ |
| 14196 | }; |
| 14197 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14198 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 14199 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14200 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14201 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14202 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14203 | { } /* end */ |
| 14204 | }; |
| 14205 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14206 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 14207 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14208 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14209 | { } /* end */ |
| 14210 | }; |
| 14211 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14212 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14213 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 14214 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14215 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14216 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14217 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14218 | { } /* end */ |
| 14219 | }; |
| 14220 | |
| 14221 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14222 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14223 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14224 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14225 | { } /* end */ |
| 14226 | }; |
| 14227 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14228 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 14229 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14230 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14231 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14232 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14233 | { } /* end */ |
| 14234 | }; |
| 14235 | |
| 14236 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 14237 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14238 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14239 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14240 | { } /* end */ |
| 14241 | }; |
| 14242 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14243 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14244 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14245 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14246 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 14247 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14248 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14249 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14250 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14251 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14252 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14253 | { } |
| 14254 | }; |
| 14255 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14256 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 14257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14258 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14259 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14261 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14262 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14263 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14264 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14265 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14266 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14267 | { } |
| 14268 | }; |
| 14269 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14270 | /* toggle speaker-output according to the hp-jack state */ |
| 14271 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14272 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14273 | alc_hp_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14274 | |
| 14275 | snd_hda_codec_write(codec, 0x20, 0, |
| 14276 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14277 | snd_hda_codec_write(codec, 0x20, 0, |
| 14278 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14279 | |
| 14280 | snd_hda_codec_write(codec, 0x20, 0, |
| 14281 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14282 | snd_hda_codec_write(codec, 0x20, 0, |
| 14283 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14284 | } |
| 14285 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14286 | #define alc269_lifebook_speaker_automute \ |
| 14287 | alc269_quanta_fl1_speaker_automute |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14288 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14289 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14290 | { |
| 14291 | unsigned int present_laptop; |
| 14292 | unsigned int present_dock; |
| 14293 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14294 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14295 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14296 | |
| 14297 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14298 | if (present_dock) |
| 14299 | snd_hda_codec_write(codec, 0x23, 0, |
| 14300 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14301 | if (present_laptop) |
| 14302 | snd_hda_codec_write(codec, 0x23, 0, |
| 14303 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14304 | if (!present_dock && !present_laptop) |
| 14305 | snd_hda_codec_write(codec, 0x23, 0, |
| 14306 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14307 | } |
| 14308 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14309 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14310 | unsigned int res) |
| 14311 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14312 | switch (res >> 26) { |
| 14313 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14314 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14315 | break; |
| 14316 | case ALC880_MIC_EVENT: |
| 14317 | alc_mic_automute(codec); |
| 14318 | break; |
| 14319 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14320 | } |
| 14321 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14322 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14323 | unsigned int res) |
| 14324 | { |
| 14325 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14326 | alc269_lifebook_speaker_automute(codec); |
| 14327 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14328 | alc269_lifebook_mic_autoswitch(codec); |
| 14329 | } |
| 14330 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14331 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14332 | { |
| 14333 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14334 | spec->autocfg.hp_pins[0] = 0x15; |
| 14335 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14336 | spec->automute_mixer_nid[0] = 0x0c; |
| 14337 | spec->automute = 1; |
| 14338 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14339 | spec->ext_mic.pin = 0x18; |
| 14340 | spec->ext_mic.mux_idx = 0; |
| 14341 | spec->int_mic.pin = 0x19; |
| 14342 | spec->int_mic.mux_idx = 1; |
| 14343 | spec->auto_mic = 1; |
| 14344 | } |
| 14345 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14346 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14347 | { |
| 14348 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14349 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14350 | } |
| 14351 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14352 | static void alc269_lifebook_setup(struct hda_codec *codec) |
| 14353 | { |
| 14354 | struct alc_spec *spec = codec->spec; |
| 14355 | spec->autocfg.hp_pins[0] = 0x15; |
| 14356 | spec->autocfg.hp_pins[1] = 0x1a; |
| 14357 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14358 | spec->automute_mixer_nid[0] = 0x0c; |
| 14359 | spec->automute = 1; |
| 14360 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 14361 | } |
| 14362 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14363 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14364 | { |
| 14365 | alc269_lifebook_speaker_automute(codec); |
| 14366 | alc269_lifebook_mic_autoswitch(codec); |
| 14367 | } |
| 14368 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14369 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14371 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14372 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14374 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14375 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14376 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14377 | {} |
| 14378 | }; |
| 14379 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14380 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14381 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14382 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14383 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14384 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14385 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14386 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14387 | {} |
| 14388 | }; |
| 14389 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14390 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14391 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14392 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14393 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14395 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14396 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14397 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14398 | {} |
| 14399 | }; |
| 14400 | |
| 14401 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14402 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14403 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14404 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14405 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14406 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14407 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14408 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14409 | {} |
| 14410 | }; |
| 14411 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14412 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14413 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14414 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14415 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14416 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14417 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14418 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14419 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14420 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14421 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14422 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14423 | { } |
| 14424 | }; |
| 14425 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14426 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14427 | { |
| 14428 | struct alc_spec *spec = codec->spec; |
| 14429 | spec->autocfg.hp_pins[0] = 0x15; |
| 14430 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14431 | spec->automute_mixer_nid[0] = 0x0c; |
| 14432 | spec->automute = 1; |
| 14433 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14434 | spec->ext_mic.pin = 0x18; |
| 14435 | spec->ext_mic.mux_idx = 0; |
| 14436 | spec->int_mic.pin = 0x19; |
| 14437 | spec->int_mic.mux_idx = 1; |
| 14438 | spec->auto_mic = 1; |
| 14439 | } |
| 14440 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14441 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14442 | { |
| 14443 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14444 | spec->autocfg.hp_pins[0] = 0x15; |
| 14445 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14446 | spec->automute_mixer_nid[0] = 0x0c; |
| 14447 | spec->automute = 1; |
| 14448 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14449 | spec->ext_mic.pin = 0x18; |
| 14450 | spec->ext_mic.mux_idx = 0; |
| 14451 | spec->int_mic.pin = 0x12; |
| 14452 | spec->int_mic.mux_idx = 5; |
| 14453 | spec->auto_mic = 1; |
| 14454 | } |
| 14455 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14456 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14457 | { |
| 14458 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14459 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14460 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14461 | spec->automute_mixer_nid[0] = 0x0c; |
| 14462 | spec->automute = 1; |
| 14463 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14464 | spec->ext_mic.pin = 0x18; |
| 14465 | spec->ext_mic.mux_idx = 0; |
| 14466 | spec->int_mic.pin = 0x19; |
| 14467 | spec->int_mic.mux_idx = 1; |
| 14468 | spec->auto_mic = 1; |
| 14469 | } |
| 14470 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14471 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14472 | { |
| 14473 | struct alc_spec *spec = codec->spec; |
| 14474 | spec->autocfg.hp_pins[0] = 0x21; |
| 14475 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14476 | spec->automute_mixer_nid[0] = 0x0c; |
| 14477 | spec->automute = 1; |
| 14478 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14479 | spec->ext_mic.pin = 0x18; |
| 14480 | spec->ext_mic.mux_idx = 0; |
| 14481 | spec->int_mic.pin = 0x12; |
| 14482 | spec->int_mic.mux_idx = 6; |
| 14483 | spec->auto_mic = 1; |
| 14484 | } |
| 14485 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14486 | /* |
| 14487 | * generic initialization of ADC, input mixers and output mixers |
| 14488 | */ |
| 14489 | static struct hda_verb alc269_init_verbs[] = { |
| 14490 | /* |
| 14491 | * Unmute ADC0 and set the default input to mic-in |
| 14492 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14493 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14494 | |
| 14495 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14496 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14497 | */ |
| 14498 | /* set vol=0 to output mixers */ |
| 14499 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14500 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14501 | |
| 14502 | /* set up input amps for analog loopback */ |
| 14503 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14506 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14507 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14508 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14509 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14510 | |
| 14511 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14512 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14513 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14514 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14515 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14516 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14517 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14518 | |
| 14519 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14521 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14522 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14523 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14524 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14525 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14526 | |
| 14527 | /* set EAPD */ |
| 14528 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14529 | { } |
| 14530 | }; |
| 14531 | |
| 14532 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14533 | /* |
| 14534 | * Unmute ADC0 and set the default input to mic-in |
| 14535 | */ |
| 14536 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14537 | |
| 14538 | /* |
| 14539 | * Set up output mixers (0x02 - 0x03) |
| 14540 | */ |
| 14541 | /* set vol=0 to output mixers */ |
| 14542 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14543 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14544 | |
| 14545 | /* set up input amps for analog loopback */ |
| 14546 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14547 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14549 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14550 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14551 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14552 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14553 | |
| 14554 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14555 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14556 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14557 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14558 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14559 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14560 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14561 | |
| 14562 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14563 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14564 | |
| 14565 | /* FIXME: use Mux-type input source selection */ |
| 14566 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14567 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14568 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14569 | |
| 14570 | /* set EAPD */ |
| 14571 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14572 | { } |
| 14573 | }; |
| 14574 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14575 | #define alc269_auto_create_multi_out_ctls \ |
| 14576 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14577 | #define alc269_auto_create_input_ctls \ |
| 14578 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14579 | |
| 14580 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14581 | #define alc269_loopbacks alc880_loopbacks |
| 14582 | #endif |
| 14583 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14584 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14585 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14586 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14587 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14588 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14589 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14590 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14591 | .substreams = 1, |
| 14592 | .channels_min = 2, |
| 14593 | .channels_max = 8, |
| 14594 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14595 | /* NID is set in alc_build_pcms */ |
| 14596 | .ops = { |
| 14597 | .open = alc880_playback_pcm_open, |
| 14598 | .prepare = alc880_playback_pcm_prepare, |
| 14599 | .cleanup = alc880_playback_pcm_cleanup |
| 14600 | }, |
| 14601 | }; |
| 14602 | |
| 14603 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14604 | .substreams = 1, |
| 14605 | .channels_min = 2, |
| 14606 | .channels_max = 2, |
| 14607 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14608 | /* NID is set in alc_build_pcms */ |
| 14609 | }; |
| 14610 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14611 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14612 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14613 | { |
| 14614 | switch (codec->subsystem_id) { |
| 14615 | case 0x103c1586: |
| 14616 | return 1; |
| 14617 | } |
| 14618 | return 0; |
| 14619 | } |
| 14620 | |
| 14621 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14622 | { |
| 14623 | /* update mute-LED according to the speaker mute state */ |
| 14624 | if (nid == 0x01 || nid == 0x14) { |
| 14625 | int pinval; |
| 14626 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14627 | HDA_AMP_MUTE) |
| 14628 | pinval = 0x24; |
| 14629 | else |
| 14630 | pinval = 0x20; |
| 14631 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14632 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14633 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14634 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14635 | } |
| 14636 | return alc_check_power_status(codec, nid); |
| 14637 | } |
| 14638 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14639 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14640 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14641 | { |
| 14642 | struct alc_spec *spec = codec->spec; |
| 14643 | |
| 14644 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14645 | return 0; |
| 14646 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14647 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14648 | if (spec->ext_mic.pin <= 0x12) { |
| 14649 | spec->private_adc_nids[0] = 0x08; |
| 14650 | spec->private_adc_nids[1] = 0x11; |
| 14651 | spec->private_capsrc_nids[0] = 0x23; |
| 14652 | spec->private_capsrc_nids[1] = 0x22; |
| 14653 | } else { |
| 14654 | spec->private_adc_nids[0] = 0x11; |
| 14655 | spec->private_adc_nids[1] = 0x08; |
| 14656 | spec->private_capsrc_nids[0] = 0x22; |
| 14657 | spec->private_capsrc_nids[1] = 0x23; |
| 14658 | } |
| 14659 | spec->adc_nids = spec->private_adc_nids; |
| 14660 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14661 | spec->num_adc_nids = 2; |
| 14662 | spec->dual_adc_switch = 1; |
| 14663 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14664 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14665 | return 1; |
| 14666 | } |
| 14667 | return 0; |
| 14668 | } |
| 14669 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14670 | /* different alc269-variants */ |
| 14671 | enum { |
| 14672 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14673 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14674 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14675 | ALC269_TYPE_ALC269VB, |
| 14676 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14677 | ALC269_TYPE_ALC271X, |
| 14678 | }; |
| 14679 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14680 | /* |
| 14681 | * BIOS auto configuration |
| 14682 | */ |
| 14683 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14684 | { |
| 14685 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14686 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14687 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14688 | |
| 14689 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14690 | alc269_ignore); |
| 14691 | if (err < 0) |
| 14692 | return err; |
| 14693 | |
| 14694 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14695 | if (err < 0) |
| 14696 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14697 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14698 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14699 | else |
| 14700 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14701 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14702 | if (err < 0) |
| 14703 | return err; |
| 14704 | |
| 14705 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14706 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14707 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14708 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14709 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14710 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14711 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14712 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14713 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14714 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14715 | } else { |
| 14716 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14717 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14718 | } |
| 14719 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14720 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14721 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14722 | |
| 14723 | if (!alc275_setup_dual_adc(codec)) |
| 14724 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14725 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14726 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14727 | err = alc_auto_add_mic_boost(codec); |
| 14728 | if (err < 0) |
| 14729 | return err; |
| 14730 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14731 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14732 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14733 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14734 | return 1; |
| 14735 | } |
| 14736 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14737 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14738 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14739 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14740 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14741 | |
| 14742 | |
| 14743 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14744 | static void alc269_auto_init(struct hda_codec *codec) |
| 14745 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14746 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14747 | alc269_auto_init_multi_out(codec); |
| 14748 | alc269_auto_init_hp_out(codec); |
| 14749 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14750 | if (!spec->dual_adc_switch) |
| 14751 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14752 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14753 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14754 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14755 | } |
| 14756 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14757 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14758 | { |
| 14759 | int val = alc_read_coef_idx(codec, 0x04); |
| 14760 | if (power_up) |
| 14761 | val |= 1 << 11; |
| 14762 | else |
| 14763 | val &= ~(1 << 11); |
| 14764 | alc_write_coef_idx(codec, 0x04, val); |
| 14765 | } |
| 14766 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14767 | static void alc269_shutup(struct hda_codec *codec) |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14768 | { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14769 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14770 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14771 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14772 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14773 | msleep(150); |
| 14774 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14775 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14776 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14777 | #ifdef SND_HDA_NEEDS_RESUME |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14778 | static int alc269_resume(struct hda_codec *codec) |
| 14779 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14780 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14781 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14782 | msleep(150); |
| 14783 | } |
| 14784 | |
| 14785 | codec->patch_ops.init(codec); |
| 14786 | |
| 14787 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14788 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14789 | msleep(200); |
| 14790 | } |
| 14791 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14792 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14793 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14794 | |
| 14795 | snd_hda_codec_resume_amp(codec); |
| 14796 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14797 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14798 | return 0; |
| 14799 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14800 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14801 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14802 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14803 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14804 | { |
| 14805 | int coef; |
| 14806 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14807 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14808 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14809 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14810 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14811 | } |
| 14812 | |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14813 | static void alc271_fixup_dmic(struct hda_codec *codec, |
| 14814 | const struct alc_fixup *fix, int action) |
| 14815 | { |
| 14816 | static struct hda_verb verbs[] = { |
| 14817 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14818 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14819 | {} |
| 14820 | }; |
| 14821 | unsigned int cfg; |
| 14822 | |
| 14823 | if (strcmp(codec->chip_name, "ALC271X")) |
| 14824 | return; |
| 14825 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 14826 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 14827 | snd_hda_sequence_write(codec, verbs); |
| 14828 | } |
| 14829 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14830 | enum { |
| 14831 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14832 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14833 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14834 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14835 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14836 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14837 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14838 | ALC271_FIXUP_DMIC, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14839 | }; |
| 14840 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14841 | static const struct alc_fixup alc269_fixups[] = { |
| 14842 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14843 | .type = ALC_FIXUP_VERBS, |
| 14844 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14845 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14846 | {} |
| 14847 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14848 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14849 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14850 | .type = ALC_FIXUP_VERBS, |
| 14851 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14852 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14853 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14854 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14855 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14856 | }, |
| 14857 | .chained = true, |
| 14858 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14859 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14860 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14861 | .type = ALC_FIXUP_VERBS, |
| 14862 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14863 | /* Enables internal speaker */ |
| 14864 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14865 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14866 | {} |
| 14867 | } |
| 14868 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14869 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14870 | .type = ALC_FIXUP_SKU, |
| 14871 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14872 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14873 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14874 | .type = ALC_FIXUP_PINS, |
| 14875 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14876 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14877 | { } |
| 14878 | } |
| 14879 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14880 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14881 | .type = ALC_FIXUP_VERBS, |
| 14882 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14883 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14884 | {} |
| 14885 | } |
| 14886 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14887 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14888 | .type = ALC_FIXUP_FUNC, |
| 14889 | .v.func = alc269_fixup_hweq, |
| 14890 | .chained = true, |
| 14891 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14892 | }, |
| 14893 | [ALC271_FIXUP_DMIC] = { |
| 14894 | .type = ALC_FIXUP_FUNC, |
| 14895 | .v.func = alc271_fixup_dmic, |
| 14896 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14897 | }; |
| 14898 | |
| 14899 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14900 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14901 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14902 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14903 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14904 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14905 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14906 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14907 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14908 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14909 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14910 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14911 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14912 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14913 | {} |
| 14914 | }; |
| 14915 | |
| 14916 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14917 | /* |
| 14918 | * configuration and preset |
| 14919 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14920 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14921 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14922 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14923 | [ALC269_AMIC] = "laptop-amic", |
| 14924 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14925 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14926 | [ALC269_LIFEBOOK] = "lifebook", |
| 14927 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14928 | }; |
| 14929 | |
| 14930 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14931 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14932 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14933 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14934 | ALC269_AMIC), |
| 14935 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14936 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14937 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14938 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14939 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14940 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14941 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14942 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14943 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 14944 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14945 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14946 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14947 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14948 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14949 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14950 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14951 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14952 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14953 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14954 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14955 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14956 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14957 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14958 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14959 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14960 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14961 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14962 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14963 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14964 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14965 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14966 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14967 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14968 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14969 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14970 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14971 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14972 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14973 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14974 | ALC269_DMIC), |
| 14975 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14976 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14977 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14978 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14979 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14980 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14981 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14982 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14983 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14984 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14985 | {} |
| 14986 | }; |
| 14987 | |
| 14988 | static struct alc_config_preset alc269_presets[] = { |
| 14989 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14990 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14991 | .init_verbs = { alc269_init_verbs }, |
| 14992 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14993 | .dac_nids = alc269_dac_nids, |
| 14994 | .hp_nid = 0x03, |
| 14995 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14996 | .channel_mode = alc269_modes, |
| 14997 | .input_mux = &alc269_capture_source, |
| 14998 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14999 | [ALC269_QUANTA_FL1] = { |
| 15000 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15001 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15002 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15003 | .dac_nids = alc269_dac_nids, |
| 15004 | .hp_nid = 0x03, |
| 15005 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15006 | .channel_mode = alc269_modes, |
| 15007 | .input_mux = &alc269_capture_source, |
| 15008 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15009 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15010 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15011 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15012 | [ALC269_AMIC] = { |
| 15013 | .mixers = { alc269_laptop_mixer }, |
| 15014 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15015 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15016 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15017 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15018 | .dac_nids = alc269_dac_nids, |
| 15019 | .hp_nid = 0x03, |
| 15020 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15021 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15022 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15023 | .setup = alc269_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15024 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15025 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15026 | [ALC269_DMIC] = { |
| 15027 | .mixers = { alc269_laptop_mixer }, |
| 15028 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15029 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15030 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15031 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15032 | .dac_nids = alc269_dac_nids, |
| 15033 | .hp_nid = 0x03, |
| 15034 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15035 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15036 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15037 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15038 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15039 | }, |
| 15040 | [ALC269VB_AMIC] = { |
| 15041 | .mixers = { alc269vb_laptop_mixer }, |
| 15042 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15043 | .init_verbs = { alc269vb_init_verbs, |
| 15044 | alc269vb_laptop_amic_init_verbs }, |
| 15045 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15046 | .dac_nids = alc269_dac_nids, |
| 15047 | .hp_nid = 0x03, |
| 15048 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15049 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15050 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15051 | .setup = alc269vb_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15052 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15053 | }, |
| 15054 | [ALC269VB_DMIC] = { |
| 15055 | .mixers = { alc269vb_laptop_mixer }, |
| 15056 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15057 | .init_verbs = { alc269vb_init_verbs, |
| 15058 | alc269vb_laptop_dmic_init_verbs }, |
| 15059 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15060 | .dac_nids = alc269_dac_nids, |
| 15061 | .hp_nid = 0x03, |
| 15062 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15063 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15064 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15065 | .setup = alc269vb_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15066 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15067 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15068 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15069 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15070 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15071 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15072 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15073 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15074 | .dac_nids = alc269_dac_nids, |
| 15075 | .hp_nid = 0x03, |
| 15076 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15077 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15078 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15079 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15080 | .init_hook = alc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15081 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15082 | [ALC269_LIFEBOOK] = { |
| 15083 | .mixers = { alc269_lifebook_mixer }, |
| 15084 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15085 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15086 | .dac_nids = alc269_dac_nids, |
| 15087 | .hp_nid = 0x03, |
| 15088 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15089 | .channel_mode = alc269_modes, |
| 15090 | .input_mux = &alc269_capture_source, |
| 15091 | .unsol_event = alc269_lifebook_unsol_event, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15092 | .setup = alc269_lifebook_setup, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15093 | .init_hook = alc269_lifebook_init_hook, |
| 15094 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15095 | [ALC271_ACER] = { |
| 15096 | .mixers = { alc269_asus_mixer }, |
| 15097 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15098 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15099 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15100 | .dac_nids = alc269_dac_nids, |
| 15101 | .adc_nids = alc262_dmic_adc_nids, |
| 15102 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15103 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15104 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15105 | .channel_mode = alc269_modes, |
| 15106 | .input_mux = &alc269_capture_source, |
| 15107 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15108 | .unsol_event = alc_sku_unsol_event, |
| 15109 | .setup = alc269vb_laptop_dmic_setup, |
| 15110 | .init_hook = alc_inithook, |
| 15111 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15112 | }; |
| 15113 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15114 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15115 | { |
| 15116 | int val; |
| 15117 | |
| 15118 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15119 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15120 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15121 | } |
| 15122 | |
| 15123 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15124 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15125 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15126 | } |
| 15127 | |
| 15128 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15129 | val = alc_read_coef_idx(codec, 0x04); |
| 15130 | /* Power up output pin */ |
| 15131 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15132 | } |
| 15133 | |
| 15134 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15135 | val = alc_read_coef_idx(codec, 0xd); |
| 15136 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15137 | /* Capless ramp up clock control */ |
| 15138 | alc_write_coef_idx(codec, 0xd, val | 1<<10); |
| 15139 | } |
| 15140 | val = alc_read_coef_idx(codec, 0x17); |
| 15141 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15142 | /* Class D power on reset */ |
| 15143 | alc_write_coef_idx(codec, 0x17, val | 1<<7); |
| 15144 | } |
| 15145 | } |
| 15146 | return 0; |
| 15147 | } |
| 15148 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15149 | static int patch_alc269(struct hda_codec *codec) |
| 15150 | { |
| 15151 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15152 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15153 | int err; |
| 15154 | |
| 15155 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15156 | if (spec == NULL) |
| 15157 | return -ENOMEM; |
| 15158 | |
| 15159 | codec->spec = spec; |
| 15160 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15161 | alc_auto_parse_customize_define(codec); |
| 15162 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15163 | if (codec->vendor_id == 0x10ec0269) { |
| 15164 | coef = alc_read_coef_idx(codec, 0); |
| 15165 | if ((coef & 0x00f0) == 0x0010) { |
| 15166 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15167 | spec->cdefine.platform_type == 1) { |
| 15168 | alc_codec_rename(codec, "ALC271X"); |
| 15169 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15170 | } else if ((coef & 0xf000) == 0x1000) { |
| 15171 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15172 | } else if ((coef & 0xf000) == 0x2000) { |
| 15173 | alc_codec_rename(codec, "ALC259"); |
| 15174 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15175 | } else if ((coef & 0xf000) == 0x3000) { |
| 15176 | alc_codec_rename(codec, "ALC258"); |
| 15177 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15178 | } else { |
| 15179 | alc_codec_rename(codec, "ALC269VB"); |
| 15180 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15181 | } |
| 15182 | } else |
| 15183 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15184 | alc269_fill_coef(codec); |
| 15185 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15186 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15187 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15188 | alc269_models, |
| 15189 | alc269_cfg_tbl); |
| 15190 | |
| 15191 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15192 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15193 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15194 | board_config = ALC269_AUTO; |
| 15195 | } |
| 15196 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15197 | if (board_config == ALC269_AUTO) { |
| 15198 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15199 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15200 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15201 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15202 | if (board_config == ALC269_AUTO) { |
| 15203 | /* automatic parse from the BIOS config */ |
| 15204 | err = alc269_parse_auto_config(codec); |
| 15205 | if (err < 0) { |
| 15206 | alc_free(codec); |
| 15207 | return err; |
| 15208 | } else if (!err) { |
| 15209 | printk(KERN_INFO |
| 15210 | "hda_codec: Cannot set up configuration " |
| 15211 | "from BIOS. Using base mode...\n"); |
| 15212 | board_config = ALC269_BASIC; |
| 15213 | } |
| 15214 | } |
| 15215 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15216 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15217 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15218 | if (err < 0) { |
| 15219 | alc_free(codec); |
| 15220 | return err; |
| 15221 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15222 | } |
| 15223 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15224 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15225 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15226 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15227 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15228 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15229 | * fix the sample rate of analog I/O to 44.1kHz |
| 15230 | */ |
| 15231 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15232 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15233 | } else if (spec->dual_adc_switch) { |
| 15234 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15235 | /* switch ADC dynamically */ |
| 15236 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15237 | } else { |
| 15238 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15239 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15240 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15241 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15242 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15243 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15244 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15245 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15246 | spec->adc_nids = alc269_adc_nids; |
| 15247 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15248 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15249 | } else { |
| 15250 | spec->adc_nids = alc269vb_adc_nids; |
| 15251 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15252 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15253 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15254 | } |
| 15255 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15256 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15257 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15258 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15259 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15260 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15261 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15262 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15263 | spec->vmaster_nid = 0x02; |
| 15264 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15265 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15266 | #ifdef SND_HDA_NEEDS_RESUME |
| 15267 | codec->patch_ops.resume = alc269_resume; |
| 15268 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15269 | if (board_config == ALC269_AUTO) |
| 15270 | spec->init_hook = alc269_auto_init; |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 15271 | spec->shutup = alc269_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15272 | |
| 15273 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15274 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15275 | if (!spec->loopback.amplist) |
| 15276 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15277 | if (alc269_mic2_for_mute_led(codec)) |
| 15278 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15279 | #endif |
| 15280 | |
| 15281 | return 0; |
| 15282 | } |
| 15283 | |
| 15284 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15285 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15286 | */ |
| 15287 | |
| 15288 | /* |
| 15289 | * set the path ways for 2 channel output |
| 15290 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15291 | */ |
| 15292 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 15293 | /* set pin widget 1Ah (line in) for input */ |
| 15294 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15295 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15296 | * the vref |
| 15297 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15298 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15299 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15300 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15301 | #if 0 |
| 15302 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15303 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15304 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15305 | { } /* end */ |
| 15306 | }; |
| 15307 | /* |
| 15308 | * 6ch mode |
| 15309 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15310 | */ |
| 15311 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 15312 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15313 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15314 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15315 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15316 | |
| 15317 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15318 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15319 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15320 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15321 | #if 0 |
| 15322 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15323 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15324 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15325 | { } /* end */ |
| 15326 | }; |
| 15327 | |
| 15328 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 15329 | { 2, alc861_threestack_ch2_init }, |
| 15330 | { 6, alc861_threestack_ch6_init }, |
| 15331 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15332 | /* Set mic1 as input and unmute the mixer */ |
| 15333 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 15334 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15335 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15336 | { } /* end */ |
| 15337 | }; |
| 15338 | /* Set mic1 as output and mute mixer */ |
| 15339 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 15340 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15341 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15342 | { } /* end */ |
| 15343 | }; |
| 15344 | |
| 15345 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 15346 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15347 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15348 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15349 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15350 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 15351 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 15352 | /* set pin widget 1Ah (line in) for input */ |
| 15353 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15354 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15355 | * the vref |
| 15356 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15357 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15358 | |
| 15359 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15360 | #if 0 |
| 15361 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15362 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15363 | #endif |
| 15364 | { } /* end */ |
| 15365 | }; |
| 15366 | /* Set mic1 nad line-in as output and mute mixer */ |
| 15367 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 15368 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15369 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15370 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15371 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15372 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15373 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15374 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15375 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15376 | |
| 15377 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15378 | #if 0 |
| 15379 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15380 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15381 | #endif |
| 15382 | { } /* end */ |
| 15383 | }; |
| 15384 | |
| 15385 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 15386 | { 2, alc861_asus_ch2_init }, |
| 15387 | { 6, alc861_asus_ch6_init }, |
| 15388 | }; |
| 15389 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15390 | /* patch-ALC861 */ |
| 15391 | |
| 15392 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 15393 | /* output mixer control */ |
| 15394 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15395 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15396 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15397 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15398 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15399 | |
| 15400 | /*Input mixer control */ |
| 15401 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15402 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15404 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15405 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15406 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15407 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15408 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15409 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15410 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15411 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15412 | { } /* end */ |
| 15413 | }; |
| 15414 | |
| 15415 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 15416 | /* output mixer control */ |
| 15417 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15418 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15419 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15420 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15421 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15422 | |
| 15423 | /* Input mixer control */ |
| 15424 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15425 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15427 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15428 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15429 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15432 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15433 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15434 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15435 | { |
| 15436 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15437 | .name = "Channel Mode", |
| 15438 | .info = alc_ch_mode_info, |
| 15439 | .get = alc_ch_mode_get, |
| 15440 | .put = alc_ch_mode_put, |
| 15441 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15442 | }, |
| 15443 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15444 | }; |
| 15445 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15446 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15447 | /* output mixer control */ |
| 15448 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15450 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15451 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15452 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15453 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15454 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15455 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15456 | /* output mixer control */ |
| 15457 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15458 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15459 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15460 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15461 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15462 | |
| 15463 | /* Input mixer control */ |
| 15464 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15465 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15467 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15468 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15469 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15471 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15472 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15473 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15474 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15475 | { |
| 15476 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15477 | .name = "Channel Mode", |
| 15478 | .info = alc_ch_mode_info, |
| 15479 | .get = alc_ch_mode_get, |
| 15480 | .put = alc_ch_mode_put, |
| 15481 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15482 | }, |
| 15483 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15484 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15485 | |
| 15486 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15487 | /* output mixer control */ |
| 15488 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15489 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15490 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15491 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15492 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15493 | |
| 15494 | /* Input mixer control */ |
| 15495 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15496 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15497 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15498 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15500 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15503 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15504 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15505 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15506 | { |
| 15507 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15508 | .name = "Channel Mode", |
| 15509 | .info = alc_ch_mode_info, |
| 15510 | .get = alc_ch_mode_get, |
| 15511 | .put = alc_ch_mode_put, |
| 15512 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15513 | }, |
| 15514 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15515 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15516 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15517 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15518 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15520 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15521 | { } |
| 15522 | }; |
| 15523 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15524 | /* |
| 15525 | * generic initialization of ADC, input mixers and output mixers |
| 15526 | */ |
| 15527 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15528 | /* |
| 15529 | * Unmute ADC0 and set the default input to mic-in |
| 15530 | */ |
| 15531 | /* port-A for surround (rear panel) */ |
| 15532 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15533 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15534 | /* port-B for mic-in (rear panel) with vref */ |
| 15535 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15536 | /* port-C for line-in (rear panel) */ |
| 15537 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15538 | /* port-D for Front */ |
| 15539 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15540 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15541 | /* port-E for HP out (front panel) */ |
| 15542 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15543 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15544 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15545 | /* port-F for mic-in (front panel) with vref */ |
| 15546 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15547 | /* port-G for CLFE (rear panel) */ |
| 15548 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15549 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15550 | /* port-H for side (rear panel) */ |
| 15551 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15552 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15553 | /* CD-in */ |
| 15554 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15555 | /* route front mic to ADC1*/ |
| 15556 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15557 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15558 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15559 | /* Unmute DAC0~3 & spdif out*/ |
| 15560 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15561 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15562 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15563 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15565 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15566 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15567 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15568 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15569 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15570 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15572 | /* Unmute Stereo Mixer 15 */ |
| 15573 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15575 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15577 | |
| 15578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15579 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15580 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15581 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15582 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15583 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15584 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15585 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15586 | /* hp used DAC 3 (Front) */ |
| 15587 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15588 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15589 | |
| 15590 | { } |
| 15591 | }; |
| 15592 | |
| 15593 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15594 | /* |
| 15595 | * Unmute ADC0 and set the default input to mic-in |
| 15596 | */ |
| 15597 | /* port-A for surround (rear panel) */ |
| 15598 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15599 | /* port-B for mic-in (rear panel) with vref */ |
| 15600 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15601 | /* port-C for line-in (rear panel) */ |
| 15602 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15603 | /* port-D for Front */ |
| 15604 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15605 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15606 | /* port-E for HP out (front panel) */ |
| 15607 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15608 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15609 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15610 | /* port-F for mic-in (front panel) with vref */ |
| 15611 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15612 | /* port-G for CLFE (rear panel) */ |
| 15613 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15614 | /* port-H for side (rear panel) */ |
| 15615 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15616 | /* CD-in */ |
| 15617 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15618 | /* route front mic to ADC1*/ |
| 15619 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15620 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15621 | /* Unmute DAC0~3 & spdif out*/ |
| 15622 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15623 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15624 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15625 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15626 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15627 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15628 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15629 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15630 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15631 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15632 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15634 | /* Unmute Stereo Mixer 15 */ |
| 15635 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15637 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15639 | |
| 15640 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15641 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15642 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15643 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15644 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15645 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15646 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15647 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15648 | /* hp used DAC 3 (Front) */ |
| 15649 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15650 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15651 | { } |
| 15652 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15653 | |
| 15654 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15655 | /* |
| 15656 | * Unmute ADC0 and set the default input to mic-in |
| 15657 | */ |
| 15658 | /* port-A for surround (rear panel) */ |
| 15659 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15660 | /* port-B for mic-in (rear panel) with vref */ |
| 15661 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15662 | /* port-C for line-in (rear panel) */ |
| 15663 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15664 | /* port-D for Front */ |
| 15665 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15666 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15667 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15668 | /* this has to be set to VREF80 */ |
| 15669 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15670 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15671 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15672 | /* port-F for mic-in (front panel) with vref */ |
| 15673 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15674 | /* port-G for CLFE (rear panel) */ |
| 15675 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15676 | /* port-H for side (rear panel) */ |
| 15677 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15678 | /* CD-in */ |
| 15679 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15680 | /* route front mic to ADC1*/ |
| 15681 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15682 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15683 | /* Unmute DAC0~3 & spdif out*/ |
| 15684 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15685 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15686 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15687 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15689 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15690 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15691 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15692 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15693 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15694 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15695 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15696 | /* Unmute Stereo Mixer 15 */ |
| 15697 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15698 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15699 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15700 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15701 | |
| 15702 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15703 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15704 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15705 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15706 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15707 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15708 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15709 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15710 | /* hp used DAC 3 (Front) */ |
| 15711 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15712 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15713 | { } |
| 15714 | }; |
| 15715 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15716 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15717 | /* |
| 15718 | * Unmute ADC0 and set the default input to mic-in |
| 15719 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15720 | /* port-A for surround (rear panel) |
| 15721 | * according to codec#0 this is the HP jack |
| 15722 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15723 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15724 | /* route front PCM to HP */ |
| 15725 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15726 | /* port-B for mic-in (rear panel) with vref */ |
| 15727 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15728 | /* port-C for line-in (rear panel) */ |
| 15729 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15730 | /* port-D for Front */ |
| 15731 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15732 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15733 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15734 | /* this has to be set to VREF80 */ |
| 15735 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15736 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15737 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15738 | /* port-F for mic-in (front panel) with vref */ |
| 15739 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15740 | /* port-G for CLFE (rear panel) */ |
| 15741 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15742 | /* port-H for side (rear panel) */ |
| 15743 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15744 | /* CD-in */ |
| 15745 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15746 | /* route front mic to ADC1*/ |
| 15747 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15749 | /* Unmute DAC0~3 & spdif out*/ |
| 15750 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15751 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15752 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15753 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15755 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15756 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15757 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15758 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15759 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15760 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15761 | /* Unmute Stereo Mixer 15 */ |
| 15762 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15763 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15764 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15765 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15766 | |
| 15767 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15768 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15769 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15770 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15771 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15772 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15773 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15774 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15775 | /* hp used DAC 3 (Front) */ |
| 15776 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15777 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15778 | { } |
| 15779 | }; |
| 15780 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15781 | /* additional init verbs for ASUS laptops */ |
| 15782 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15783 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15784 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15785 | { } |
| 15786 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15787 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15788 | /* |
| 15789 | * generic initialization of ADC, input mixers and output mixers |
| 15790 | */ |
| 15791 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15792 | /* |
| 15793 | * Unmute ADC0 and set the default input to mic-in |
| 15794 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15795 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15796 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15797 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15798 | /* Unmute DAC0~3 & spdif out*/ |
| 15799 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15800 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15801 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15802 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15803 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15804 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15805 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15806 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15807 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15808 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15809 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15810 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15811 | /* Unmute Stereo Mixer 15 */ |
| 15812 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15815 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15816 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15817 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15818 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15819 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15820 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15821 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15822 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15823 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15824 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15825 | |
| 15826 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15827 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15828 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15829 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15830 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15831 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15832 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15833 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15834 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15835 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15836 | |
| 15837 | { } |
| 15838 | }; |
| 15839 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15840 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15841 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15842 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15843 | { } |
| 15844 | }; |
| 15845 | |
| 15846 | /* toggle speaker-output according to the hp-jack state */ |
| 15847 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15848 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15849 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15850 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15851 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15852 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15853 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15854 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15855 | } |
| 15856 | |
| 15857 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15858 | unsigned int res) |
| 15859 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15860 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15861 | alc861_toshiba_automute(codec); |
| 15862 | } |
| 15863 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15864 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15865 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15866 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15867 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15868 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15869 | |
| 15870 | |
| 15871 | #define ALC861_DIGOUT_NID 0x07 |
| 15872 | |
| 15873 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15874 | { 8, NULL } |
| 15875 | }; |
| 15876 | |
| 15877 | static hda_nid_t alc861_dac_nids[4] = { |
| 15878 | /* front, surround, clfe, side */ |
| 15879 | 0x03, 0x06, 0x05, 0x04 |
| 15880 | }; |
| 15881 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15882 | static hda_nid_t alc660_dac_nids[3] = { |
| 15883 | /* front, clfe, surround */ |
| 15884 | 0x03, 0x05, 0x06 |
| 15885 | }; |
| 15886 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15887 | static hda_nid_t alc861_adc_nids[1] = { |
| 15888 | /* ADC0-2 */ |
| 15889 | 0x08, |
| 15890 | }; |
| 15891 | |
| 15892 | static struct hda_input_mux alc861_capture_source = { |
| 15893 | .num_items = 5, |
| 15894 | .items = { |
| 15895 | { "Mic", 0x0 }, |
| 15896 | { "Front Mic", 0x3 }, |
| 15897 | { "Line", 0x1 }, |
| 15898 | { "CD", 0x4 }, |
| 15899 | { "Mixer", 0x5 }, |
| 15900 | }, |
| 15901 | }; |
| 15902 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15903 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15904 | { |
| 15905 | struct alc_spec *spec = codec->spec; |
| 15906 | hda_nid_t mix, srcs[5]; |
| 15907 | int i, j, num; |
| 15908 | |
| 15909 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15910 | return 0; |
| 15911 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15912 | if (num < 0) |
| 15913 | return 0; |
| 15914 | for (i = 0; i < num; i++) { |
| 15915 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15916 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15917 | if (type != AC_WID_AUD_OUT) |
| 15918 | continue; |
| 15919 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15920 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15921 | break; |
| 15922 | if (j >= spec->multiout.num_dacs) |
| 15923 | return srcs[i]; |
| 15924 | } |
| 15925 | return 0; |
| 15926 | } |
| 15927 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15928 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15929 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15930 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15931 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15932 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15933 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15934 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15935 | |
| 15936 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15937 | for (i = 0; i < cfg->line_outs; i++) { |
| 15938 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15939 | dac = alc861_look_for_dac(codec, nid); |
| 15940 | if (!dac) |
| 15941 | continue; |
| 15942 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15943 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15944 | return 0; |
| 15945 | } |
| 15946 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15947 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15948 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15949 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15950 | 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] | 15951 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15952 | } |
| 15953 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15954 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15955 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15956 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15957 | /* add playback controls from the parsed DAC table */ |
| 15958 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15959 | const struct auto_pin_cfg *cfg) |
| 15960 | { |
| 15961 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 15962 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15963 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15964 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15965 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15966 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15967 | int i, err, noutputs; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15968 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15969 | noutputs = cfg->line_outs; |
| 15970 | if (spec->multi_ios > 0) |
| 15971 | noutputs += spec->multi_ios; |
| 15972 | |
| 15973 | for (i = 0; i < noutputs; i++) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15974 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15975 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15976 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15977 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15978 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15979 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15980 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15981 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15982 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15983 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15984 | return err; |
| 15985 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15986 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15987 | int index = i; |
| 15988 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15989 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15990 | index = 0; |
| 15991 | } |
| 15992 | err = __alc861_create_out_sw(codec, name, nid, index, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15993 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15994 | return err; |
| 15995 | } |
| 15996 | } |
| 15997 | return 0; |
| 15998 | } |
| 15999 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16000 | 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] | 16001 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16002 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16003 | int err; |
| 16004 | hda_nid_t nid; |
| 16005 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16006 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16007 | return 0; |
| 16008 | |
| 16009 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16010 | nid = alc861_look_for_dac(codec, pin); |
| 16011 | if (nid) { |
| 16012 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16013 | if (err < 0) |
| 16014 | return err; |
| 16015 | spec->multiout.hp_nid = nid; |
| 16016 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16017 | } |
| 16018 | return 0; |
| 16019 | } |
| 16020 | |
| 16021 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16022 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16023 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16024 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16025 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16026 | } |
| 16027 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16028 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16029 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16030 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16031 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16032 | hda_nid_t mix, srcs[5]; |
| 16033 | int i, num; |
| 16034 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16035 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16036 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16037 | 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] | 16038 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16039 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16040 | return; |
| 16041 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16042 | if (num < 0) |
| 16043 | return; |
| 16044 | for (i = 0; i < num; i++) { |
| 16045 | unsigned int mute; |
| 16046 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16047 | mute = AMP_IN_UNMUTE(i); |
| 16048 | else |
| 16049 | mute = AMP_IN_MUTE(i); |
| 16050 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16051 | mute); |
| 16052 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16053 | } |
| 16054 | |
| 16055 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16056 | { |
| 16057 | struct alc_spec *spec = codec->spec; |
| 16058 | int i; |
| 16059 | |
| 16060 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16061 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16062 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16063 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16064 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16065 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16066 | } |
| 16067 | } |
| 16068 | |
| 16069 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16070 | { |
| 16071 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16072 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16073 | if (spec->autocfg.hp_outs) |
| 16074 | alc861_auto_set_output_and_unmute(codec, |
| 16075 | spec->autocfg.hp_pins[0], |
| 16076 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16077 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16078 | if (spec->autocfg.speaker_outs) |
| 16079 | alc861_auto_set_output_and_unmute(codec, |
| 16080 | spec->autocfg.speaker_pins[0], |
| 16081 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16082 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16083 | } |
| 16084 | |
| 16085 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16086 | { |
| 16087 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16088 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16089 | int i; |
| 16090 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16091 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16092 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16093 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16094 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16095 | } |
| 16096 | } |
| 16097 | |
| 16098 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16099 | /* return 1 if successful, 0 if the proper config is not found, |
| 16100 | * or a negative error code |
| 16101 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16102 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16103 | { |
| 16104 | struct alc_spec *spec = codec->spec; |
| 16105 | int err; |
| 16106 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 16107 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16108 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16109 | alc861_ignore); |
| 16110 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16111 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16112 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16113 | return 0; /* can't find valid BIOS pin config */ |
| 16114 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16115 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16116 | if (err < 0) |
| 16117 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16118 | err = alc_auto_add_multi_channel_mode(codec); |
| 16119 | if (err < 0) |
| 16120 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16121 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16122 | if (err < 0) |
| 16123 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16124 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16125 | if (err < 0) |
| 16126 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16127 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16128 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16129 | return err; |
| 16130 | |
| 16131 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16132 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16133 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16134 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16135 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16136 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16137 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16138 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16139 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16140 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16141 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16142 | |
| 16143 | spec->adc_nids = alc861_adc_nids; |
| 16144 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16145 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16146 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16147 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16148 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16149 | return 1; |
| 16150 | } |
| 16151 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16152 | /* additional initialization for auto-configuration model */ |
| 16153 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16154 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16155 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16156 | alc861_auto_init_multi_out(codec); |
| 16157 | alc861_auto_init_hp_out(codec); |
| 16158 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16159 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16160 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16161 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16162 | } |
| 16163 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16164 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16165 | static struct hda_amp_list alc861_loopbacks[] = { |
| 16166 | { 0x15, HDA_INPUT, 0 }, |
| 16167 | { 0x15, HDA_INPUT, 1 }, |
| 16168 | { 0x15, HDA_INPUT, 2 }, |
| 16169 | { 0x15, HDA_INPUT, 3 }, |
| 16170 | { } /* end */ |
| 16171 | }; |
| 16172 | #endif |
| 16173 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16174 | |
| 16175 | /* |
| 16176 | * configuration and preset |
| 16177 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16178 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16179 | [ALC861_3ST] = "3stack", |
| 16180 | [ALC660_3ST] = "3stack-660", |
| 16181 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16182 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16183 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16184 | [ALC861_TOSHIBA] = "toshiba", |
| 16185 | [ALC861_ASUS] = "asus", |
| 16186 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16187 | [ALC861_AUTO] = "auto", |
| 16188 | }; |
| 16189 | |
| 16190 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16191 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16192 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16193 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16194 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16195 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16196 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16197 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16198 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16199 | * Any other models that need this preset? |
| 16200 | */ |
| 16201 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16202 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16203 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16204 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16205 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16206 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16207 | /* FIXME: the below seems conflict */ |
| 16208 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16209 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16210 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16211 | {} |
| 16212 | }; |
| 16213 | |
| 16214 | static struct alc_config_preset alc861_presets[] = { |
| 16215 | [ALC861_3ST] = { |
| 16216 | .mixers = { alc861_3ST_mixer }, |
| 16217 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16218 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16219 | .dac_nids = alc861_dac_nids, |
| 16220 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16221 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16222 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16223 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16224 | .adc_nids = alc861_adc_nids, |
| 16225 | .input_mux = &alc861_capture_source, |
| 16226 | }, |
| 16227 | [ALC861_3ST_DIG] = { |
| 16228 | .mixers = { alc861_base_mixer }, |
| 16229 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16230 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16231 | .dac_nids = alc861_dac_nids, |
| 16232 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16233 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16234 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16235 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16236 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16237 | .adc_nids = alc861_adc_nids, |
| 16238 | .input_mux = &alc861_capture_source, |
| 16239 | }, |
| 16240 | [ALC861_6ST_DIG] = { |
| 16241 | .mixers = { alc861_base_mixer }, |
| 16242 | .init_verbs = { alc861_base_init_verbs }, |
| 16243 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16244 | .dac_nids = alc861_dac_nids, |
| 16245 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16246 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16247 | .channel_mode = alc861_8ch_modes, |
| 16248 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16249 | .adc_nids = alc861_adc_nids, |
| 16250 | .input_mux = &alc861_capture_source, |
| 16251 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16252 | [ALC660_3ST] = { |
| 16253 | .mixers = { alc861_3ST_mixer }, |
| 16254 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16255 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16256 | .dac_nids = alc660_dac_nids, |
| 16257 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16258 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16259 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16260 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16261 | .adc_nids = alc861_adc_nids, |
| 16262 | .input_mux = &alc861_capture_source, |
| 16263 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16264 | [ALC861_UNIWILL_M31] = { |
| 16265 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16266 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16267 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16268 | .dac_nids = alc861_dac_nids, |
| 16269 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16270 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16271 | .channel_mode = alc861_uniwill_m31_modes, |
| 16272 | .need_dac_fix = 1, |
| 16273 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16274 | .adc_nids = alc861_adc_nids, |
| 16275 | .input_mux = &alc861_capture_source, |
| 16276 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16277 | [ALC861_TOSHIBA] = { |
| 16278 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16279 | .init_verbs = { alc861_base_init_verbs, |
| 16280 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16281 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16282 | .dac_nids = alc861_dac_nids, |
| 16283 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16284 | .channel_mode = alc883_3ST_2ch_modes, |
| 16285 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16286 | .adc_nids = alc861_adc_nids, |
| 16287 | .input_mux = &alc861_capture_source, |
| 16288 | .unsol_event = alc861_toshiba_unsol_event, |
| 16289 | .init_hook = alc861_toshiba_automute, |
| 16290 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16291 | [ALC861_ASUS] = { |
| 16292 | .mixers = { alc861_asus_mixer }, |
| 16293 | .init_verbs = { alc861_asus_init_verbs }, |
| 16294 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16295 | .dac_nids = alc861_dac_nids, |
| 16296 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16297 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16298 | .channel_mode = alc861_asus_modes, |
| 16299 | .need_dac_fix = 1, |
| 16300 | .hp_nid = 0x06, |
| 16301 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16302 | .adc_nids = alc861_adc_nids, |
| 16303 | .input_mux = &alc861_capture_source, |
| 16304 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16305 | [ALC861_ASUS_LAPTOP] = { |
| 16306 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16307 | .init_verbs = { alc861_asus_init_verbs, |
| 16308 | alc861_asus_laptop_init_verbs }, |
| 16309 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16310 | .dac_nids = alc861_dac_nids, |
| 16311 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16312 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16313 | .channel_mode = alc883_3ST_2ch_modes, |
| 16314 | .need_dac_fix = 1, |
| 16315 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16316 | .adc_nids = alc861_adc_nids, |
| 16317 | .input_mux = &alc861_capture_source, |
| 16318 | }, |
| 16319 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16320 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16321 | /* Pin config fixes */ |
| 16322 | enum { |
| 16323 | PINFIX_FSC_AMILO_PI1505, |
| 16324 | }; |
| 16325 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16326 | static const struct alc_fixup alc861_fixups[] = { |
| 16327 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16328 | .type = ALC_FIXUP_PINS, |
| 16329 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16330 | { 0x0b, 0x0221101f }, /* HP */ |
| 16331 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16332 | { } |
| 16333 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16334 | }, |
| 16335 | }; |
| 16336 | |
| 16337 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 16338 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16339 | {} |
| 16340 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16341 | |
| 16342 | static int patch_alc861(struct hda_codec *codec) |
| 16343 | { |
| 16344 | struct alc_spec *spec; |
| 16345 | int board_config; |
| 16346 | int err; |
| 16347 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16348 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16349 | if (spec == NULL) |
| 16350 | return -ENOMEM; |
| 16351 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16352 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16353 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16354 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16355 | alc861_models, |
| 16356 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16357 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16358 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16359 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16360 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16361 | board_config = ALC861_AUTO; |
| 16362 | } |
| 16363 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16364 | if (board_config == ALC861_AUTO) { |
| 16365 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16366 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16367 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16368 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16369 | if (board_config == ALC861_AUTO) { |
| 16370 | /* automatic parse from the BIOS config */ |
| 16371 | err = alc861_parse_auto_config(codec); |
| 16372 | if (err < 0) { |
| 16373 | alc_free(codec); |
| 16374 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16375 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16376 | printk(KERN_INFO |
| 16377 | "hda_codec: Cannot set up configuration " |
| 16378 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16379 | board_config = ALC861_3ST_DIG; |
| 16380 | } |
| 16381 | } |
| 16382 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16383 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16384 | if (err < 0) { |
| 16385 | alc_free(codec); |
| 16386 | return err; |
| 16387 | } |
| 16388 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16389 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16390 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16391 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16392 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16393 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16394 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16395 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16396 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16397 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16398 | if (!spec->cap_mixer) |
| 16399 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16400 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16401 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16402 | spec->vmaster_nid = 0x03; |
| 16403 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16404 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16405 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16406 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16407 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16408 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16409 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16410 | spec->power_hook = alc_power_eapd; |
| 16411 | #endif |
| 16412 | } |
| 16413 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16414 | if (!spec->loopback.amplist) |
| 16415 | spec->loopback.amplist = alc861_loopbacks; |
| 16416 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16417 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16418 | return 0; |
| 16419 | } |
| 16420 | |
| 16421 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16422 | * ALC861-VD support |
| 16423 | * |
| 16424 | * Based on ALC882 |
| 16425 | * |
| 16426 | * In addition, an independent DAC |
| 16427 | */ |
| 16428 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16429 | |
| 16430 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 16431 | /* front, surr, clfe, side surr */ |
| 16432 | 0x02, 0x03, 0x04, 0x05 |
| 16433 | }; |
| 16434 | |
| 16435 | /* dac_nids for ALC660vd are in a different order - according to |
| 16436 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16437 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16438 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16439 | * - and it is the same as in 861vd. |
| 16440 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16441 | */ |
| 16442 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 16443 | /* front, rear, clfe, rear_surr */ |
| 16444 | 0x02, 0x04, 0x03 |
| 16445 | }; |
| 16446 | |
| 16447 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 16448 | /* ADC0 */ |
| 16449 | 0x09, |
| 16450 | }; |
| 16451 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16452 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 16453 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16454 | /* input MUX */ |
| 16455 | /* FIXME: should be a matrix-type input source selection */ |
| 16456 | static struct hda_input_mux alc861vd_capture_source = { |
| 16457 | .num_items = 4, |
| 16458 | .items = { |
| 16459 | { "Mic", 0x0 }, |
| 16460 | { "Front Mic", 0x1 }, |
| 16461 | { "Line", 0x2 }, |
| 16462 | { "CD", 0x4 }, |
| 16463 | }, |
| 16464 | }; |
| 16465 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16466 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16467 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16468 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16469 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16470 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16471 | }, |
| 16472 | }; |
| 16473 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16474 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16475 | .num_items = 2, |
| 16476 | .items = { |
| 16477 | { "Front Mic", 0x0 }, |
| 16478 | { "ATAPI Mic", 0x1 }, |
| 16479 | }, |
| 16480 | }; |
| 16481 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16482 | /* |
| 16483 | * 2ch mode |
| 16484 | */ |
| 16485 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16486 | { 2, NULL } |
| 16487 | }; |
| 16488 | |
| 16489 | /* |
| 16490 | * 6ch mode |
| 16491 | */ |
| 16492 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16493 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16494 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16495 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16496 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16497 | { } /* end */ |
| 16498 | }; |
| 16499 | |
| 16500 | /* |
| 16501 | * 8ch mode |
| 16502 | */ |
| 16503 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16504 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16505 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16506 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16507 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16508 | { } /* end */ |
| 16509 | }; |
| 16510 | |
| 16511 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16512 | { 6, alc861vd_6stack_ch6_init }, |
| 16513 | { 8, alc861vd_6stack_ch8_init }, |
| 16514 | }; |
| 16515 | |
| 16516 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16517 | { |
| 16518 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16519 | .name = "Channel Mode", |
| 16520 | .info = alc_ch_mode_info, |
| 16521 | .get = alc_ch_mode_get, |
| 16522 | .put = alc_ch_mode_put, |
| 16523 | }, |
| 16524 | { } /* end */ |
| 16525 | }; |
| 16526 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16527 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16528 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16529 | */ |
| 16530 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16531 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16532 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16533 | |
| 16534 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16535 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16536 | |
| 16537 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16538 | HDA_OUTPUT), |
| 16539 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16540 | HDA_OUTPUT), |
| 16541 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16542 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16543 | |
| 16544 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16545 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16546 | |
| 16547 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16548 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16549 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16552 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16553 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16554 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16555 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16556 | |
| 16557 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16558 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16559 | |
| 16560 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16561 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16562 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16563 | { } /* end */ |
| 16564 | }; |
| 16565 | |
| 16566 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16568 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16569 | |
| 16570 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16571 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16572 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16573 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16574 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16575 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16576 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16577 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16578 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16579 | |
| 16580 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16581 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16582 | |
| 16583 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16584 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16585 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16586 | { } /* end */ |
| 16587 | }; |
| 16588 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16589 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16590 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16591 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16592 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16593 | |
| 16594 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16595 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16596 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16597 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16598 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16599 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16600 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16601 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16602 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16603 | |
| 16604 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16605 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16606 | |
| 16607 | { } /* end */ |
| 16608 | }; |
| 16609 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16610 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16611 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16612 | */ |
| 16613 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16614 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16615 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16616 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16617 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16618 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16621 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16622 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16623 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16624 | { } /* end */ |
| 16625 | }; |
| 16626 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16627 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16628 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16629 | */ |
| 16630 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16632 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16633 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16634 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16635 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16636 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16637 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16638 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16639 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16640 | { } /* end */ |
| 16641 | }; |
| 16642 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16643 | /* |
| 16644 | * generic initialization of ADC, input mixers and output mixers |
| 16645 | */ |
| 16646 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16647 | /* |
| 16648 | * Unmute ADC0 and set the default input to mic-in |
| 16649 | */ |
| 16650 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16651 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16652 | |
| 16653 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16654 | * the analog-loopback mixer widget |
| 16655 | */ |
| 16656 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16659 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16662 | |
| 16663 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16664 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16665 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16668 | |
| 16669 | /* |
| 16670 | * Set up output mixers (0x02 - 0x05) |
| 16671 | */ |
| 16672 | /* set vol=0 to output mixers */ |
| 16673 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16674 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16675 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16676 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16677 | |
| 16678 | /* set up input amps for analog loopback */ |
| 16679 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16681 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16682 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16683 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16685 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16686 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16687 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16688 | |
| 16689 | { } |
| 16690 | }; |
| 16691 | |
| 16692 | /* |
| 16693 | * 3-stack pin configuration: |
| 16694 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16695 | */ |
| 16696 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16697 | /* |
| 16698 | * Set pin mode and muting |
| 16699 | */ |
| 16700 | /* set front pin widgets 0x14 for output */ |
| 16701 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16702 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16703 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16704 | |
| 16705 | /* Mic (rear) pin: input vref at 80% */ |
| 16706 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16707 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16708 | /* Front Mic pin: input vref at 80% */ |
| 16709 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16710 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16711 | /* Line In pin: input */ |
| 16712 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16713 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16714 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16715 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16716 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16717 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16718 | /* CD pin widget for input */ |
| 16719 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16720 | |
| 16721 | { } |
| 16722 | }; |
| 16723 | |
| 16724 | /* |
| 16725 | * 6-stack pin configuration: |
| 16726 | */ |
| 16727 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16728 | /* |
| 16729 | * Set pin mode and muting |
| 16730 | */ |
| 16731 | /* set front pin widgets 0x14 for output */ |
| 16732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16734 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16735 | |
| 16736 | /* Rear Pin: output 1 (0x0d) */ |
| 16737 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16739 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16740 | /* CLFE Pin: output 2 (0x0e) */ |
| 16741 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16742 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16743 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16744 | /* Side Pin: output 3 (0x0f) */ |
| 16745 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16746 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16747 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16748 | |
| 16749 | /* Mic (rear) pin: input vref at 80% */ |
| 16750 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16752 | /* Front Mic pin: input vref at 80% */ |
| 16753 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16754 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16755 | /* Line In pin: input */ |
| 16756 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16757 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16758 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16759 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16760 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16761 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16762 | /* CD pin widget for input */ |
| 16763 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16764 | |
| 16765 | { } |
| 16766 | }; |
| 16767 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16768 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16769 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16770 | { } |
| 16771 | }; |
| 16772 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16773 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16774 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16775 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16776 | { } |
| 16777 | }; |
| 16778 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16779 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16782 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16783 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16784 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16785 | {} |
| 16786 | }; |
| 16787 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16788 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16789 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16790 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16791 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16792 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16793 | spec->automute = 1; |
| 16794 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16795 | } |
| 16796 | |
| 16797 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16798 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16799 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16800 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16801 | } |
| 16802 | |
| 16803 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16804 | unsigned int res) |
| 16805 | { |
| 16806 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16807 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16808 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16809 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16810 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16811 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16812 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16813 | } |
| 16814 | } |
| 16815 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16816 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16817 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16818 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16819 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16820 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16821 | |
| 16822 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16823 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16824 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16825 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16826 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16827 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16828 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16829 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16830 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16831 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16832 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16834 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16835 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16836 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16837 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16838 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16839 | |
| 16840 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16841 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16842 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16843 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16844 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16845 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16846 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16847 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16848 | |
| 16849 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16850 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16851 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16852 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16853 | |
| 16854 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16855 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16856 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16857 | |
| 16858 | { } /* end */ |
| 16859 | }; |
| 16860 | |
| 16861 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16862 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16863 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16864 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16865 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16866 | spec->autocfg.hp_pins[0] = 0x15; |
| 16867 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16868 | spec->automute = 1; |
| 16869 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16870 | } |
| 16871 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16872 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16873 | #define alc861vd_loopbacks alc880_loopbacks |
| 16874 | #endif |
| 16875 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16876 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16877 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16878 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16879 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16880 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16881 | |
| 16882 | /* |
| 16883 | * configuration and preset |
| 16884 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16885 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16886 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16887 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16888 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16889 | [ALC861VD_3ST] = "3stack", |
| 16890 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16891 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16892 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16893 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16894 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16895 | [ALC861VD_AUTO] = "auto", |
| 16896 | }; |
| 16897 | |
| 16898 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16899 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16900 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16901 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16902 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16903 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16904 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16905 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16906 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16907 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16908 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16909 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16910 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16911 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16912 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16913 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16914 | {} |
| 16915 | }; |
| 16916 | |
| 16917 | static struct alc_config_preset alc861vd_presets[] = { |
| 16918 | [ALC660VD_3ST] = { |
| 16919 | .mixers = { alc861vd_3st_mixer }, |
| 16920 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16921 | alc861vd_3stack_init_verbs }, |
| 16922 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16923 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16924 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16925 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16926 | .input_mux = &alc861vd_capture_source, |
| 16927 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16928 | [ALC660VD_3ST_DIG] = { |
| 16929 | .mixers = { alc861vd_3st_mixer }, |
| 16930 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16931 | alc861vd_3stack_init_verbs }, |
| 16932 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16933 | .dac_nids = alc660vd_dac_nids, |
| 16934 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16935 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16936 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16937 | .input_mux = &alc861vd_capture_source, |
| 16938 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16939 | [ALC861VD_3ST] = { |
| 16940 | .mixers = { alc861vd_3st_mixer }, |
| 16941 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16942 | alc861vd_3stack_init_verbs }, |
| 16943 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16944 | .dac_nids = alc861vd_dac_nids, |
| 16945 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16946 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16947 | .input_mux = &alc861vd_capture_source, |
| 16948 | }, |
| 16949 | [ALC861VD_3ST_DIG] = { |
| 16950 | .mixers = { alc861vd_3st_mixer }, |
| 16951 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16952 | alc861vd_3stack_init_verbs }, |
| 16953 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16954 | .dac_nids = alc861vd_dac_nids, |
| 16955 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16956 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16957 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16958 | .input_mux = &alc861vd_capture_source, |
| 16959 | }, |
| 16960 | [ALC861VD_6ST_DIG] = { |
| 16961 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16962 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16963 | alc861vd_6stack_init_verbs }, |
| 16964 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16965 | .dac_nids = alc861vd_dac_nids, |
| 16966 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16967 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16968 | .channel_mode = alc861vd_6stack_modes, |
| 16969 | .input_mux = &alc861vd_capture_source, |
| 16970 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16971 | [ALC861VD_LENOVO] = { |
| 16972 | .mixers = { alc861vd_lenovo_mixer }, |
| 16973 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16974 | alc861vd_3stack_init_verbs, |
| 16975 | alc861vd_eapd_verbs, |
| 16976 | alc861vd_lenovo_unsol_verbs }, |
| 16977 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16978 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16979 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16980 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16981 | .input_mux = &alc861vd_capture_source, |
| 16982 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16983 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16984 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16985 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16986 | [ALC861VD_DALLAS] = { |
| 16987 | .mixers = { alc861vd_dallas_mixer }, |
| 16988 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16989 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16990 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16991 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16992 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16993 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16994 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16995 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16996 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16997 | }, |
| 16998 | [ALC861VD_HP] = { |
| 16999 | .mixers = { alc861vd_hp_mixer }, |
| 17000 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17001 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17002 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17003 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17004 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17005 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17006 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17007 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17008 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17009 | .init_hook = alc_hp_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17010 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17011 | [ALC660VD_ASUS_V1S] = { |
| 17012 | .mixers = { alc861vd_lenovo_mixer }, |
| 17013 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17014 | alc861vd_3stack_init_verbs, |
| 17015 | alc861vd_eapd_verbs, |
| 17016 | alc861vd_lenovo_unsol_verbs }, |
| 17017 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17018 | .dac_nids = alc660vd_dac_nids, |
| 17019 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17020 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17021 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17022 | .input_mux = &alc861vd_capture_source, |
| 17023 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17024 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17025 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17026 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17027 | }; |
| 17028 | |
| 17029 | /* |
| 17030 | * BIOS auto configuration |
| 17031 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17032 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17033 | const struct auto_pin_cfg *cfg) |
| 17034 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17035 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17036 | } |
| 17037 | |
| 17038 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17039 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17040 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17041 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17042 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17043 | } |
| 17044 | |
| 17045 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17046 | { |
| 17047 | struct alc_spec *spec = codec->spec; |
| 17048 | int i; |
| 17049 | |
| 17050 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17051 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17052 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17053 | if (nid) |
| 17054 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17055 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17056 | } |
| 17057 | } |
| 17058 | |
| 17059 | |
| 17060 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17061 | { |
| 17062 | struct alc_spec *spec = codec->spec; |
| 17063 | hda_nid_t pin; |
| 17064 | |
| 17065 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17066 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17067 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17068 | pin = spec->autocfg.speaker_pins[0]; |
| 17069 | if (pin) |
| 17070 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17071 | } |
| 17072 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17073 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17074 | |
| 17075 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17076 | { |
| 17077 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17078 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17079 | int i; |
| 17080 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17081 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17082 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17083 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17084 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17085 | if (nid != ALC861VD_PIN_CD_NID && |
| 17086 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17087 | snd_hda_codec_write(codec, nid, 0, |
| 17088 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17089 | AMP_OUT_MUTE); |
| 17090 | } |
| 17091 | } |
| 17092 | } |
| 17093 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17094 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17095 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17096 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17097 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17098 | |
| 17099 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17100 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17101 | * different NIDs for mute/unmute switch and volume control */ |
| 17102 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17103 | const struct auto_pin_cfg *cfg) |
| 17104 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17105 | static const char * const chname[4] = { |
| 17106 | "Front", "Surround", "CLFE", "Side" |
| 17107 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17108 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17109 | hda_nid_t nid_v, nid_s; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17110 | int i, err, noutputs; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17111 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17112 | noutputs = cfg->line_outs; |
| 17113 | if (spec->multi_ios > 0) |
| 17114 | noutputs += spec->multi_ios; |
| 17115 | |
| 17116 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17117 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17118 | continue; |
| 17119 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17120 | alc880_dac_to_idx( |
| 17121 | spec->multiout.dac_nids[i])); |
| 17122 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17123 | alc880_dac_to_idx( |
| 17124 | spec->multiout.dac_nids[i])); |
| 17125 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17126 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17127 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17128 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17129 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17130 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17131 | HDA_OUTPUT)); |
| 17132 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17133 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17134 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17135 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17136 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17137 | HDA_OUTPUT)); |
| 17138 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17139 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17140 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17141 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17142 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17143 | HDA_INPUT)); |
| 17144 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17145 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17146 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17147 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17148 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17149 | HDA_INPUT)); |
| 17150 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17151 | return err; |
| 17152 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17153 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17154 | int index = i; |
| 17155 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17156 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17157 | index = 0; |
| 17158 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17159 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17160 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17161 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17162 | HDA_OUTPUT)); |
| 17163 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17164 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17165 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17166 | name, index, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17167 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17168 | HDA_INPUT)); |
| 17169 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17170 | return err; |
| 17171 | } |
| 17172 | } |
| 17173 | return 0; |
| 17174 | } |
| 17175 | |
| 17176 | /* add playback controls for speaker and HP outputs */ |
| 17177 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17178 | * different NIDs for mute/unmute switch and volume control */ |
| 17179 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17180 | hda_nid_t pin, const char *pfx) |
| 17181 | { |
| 17182 | hda_nid_t nid_v, nid_s; |
| 17183 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17184 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17185 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17186 | return 0; |
| 17187 | |
| 17188 | if (alc880_is_fixed_pin(pin)) { |
| 17189 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17190 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17191 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17192 | spec->multiout.hp_nid = nid_v; |
| 17193 | else |
| 17194 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17195 | /* control HP volume/switch on the output mixer amp */ |
| 17196 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17197 | alc880_fixed_pin_idx(pin)); |
| 17198 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17199 | alc880_fixed_pin_idx(pin)); |
| 17200 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17201 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17202 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17203 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17204 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17205 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17206 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17207 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17208 | return err; |
| 17209 | } else if (alc880_is_multi_pin(pin)) { |
| 17210 | /* set manual connection */ |
| 17211 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17212 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17213 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17214 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17215 | return err; |
| 17216 | } |
| 17217 | return 0; |
| 17218 | } |
| 17219 | |
| 17220 | /* parse the BIOS configuration and set up the alc_spec |
| 17221 | * return 1 if successful, 0 if the proper config is not found, |
| 17222 | * or a negative error code |
| 17223 | * Based on ALC880 version - had to change it to override |
| 17224 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17225 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17226 | { |
| 17227 | struct alc_spec *spec = codec->spec; |
| 17228 | int err; |
| 17229 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 17230 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17231 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17232 | alc861vd_ignore); |
| 17233 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17234 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17235 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17236 | return 0; /* can't find valid BIOS pin config */ |
| 17237 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17238 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17239 | if (err < 0) |
| 17240 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17241 | err = alc_auto_add_multi_channel_mode(codec); |
| 17242 | if (err < 0) |
| 17243 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17244 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17245 | if (err < 0) |
| 17246 | return err; |
| 17247 | err = alc861vd_auto_create_extra_out(spec, |
| 17248 | spec->autocfg.speaker_pins[0], |
| 17249 | "Speaker"); |
| 17250 | if (err < 0) |
| 17251 | return err; |
| 17252 | err = alc861vd_auto_create_extra_out(spec, |
| 17253 | spec->autocfg.hp_pins[0], |
| 17254 | "Headphone"); |
| 17255 | if (err < 0) |
| 17256 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17257 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17258 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17259 | return err; |
| 17260 | |
| 17261 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17262 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17263 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17264 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17265 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17266 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17267 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17268 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17269 | |
| 17270 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17271 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17272 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17273 | err = alc_auto_add_mic_boost(codec); |
| 17274 | if (err < 0) |
| 17275 | return err; |
| 17276 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17277 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17278 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17279 | return 1; |
| 17280 | } |
| 17281 | |
| 17282 | /* additional initialization for auto-configuration model */ |
| 17283 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17284 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17285 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17286 | alc861vd_auto_init_multi_out(codec); |
| 17287 | alc861vd_auto_init_hp_out(codec); |
| 17288 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17289 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17290 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17291 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17292 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17293 | } |
| 17294 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17295 | enum { |
| 17296 | ALC660VD_FIX_ASUS_GPIO1 |
| 17297 | }; |
| 17298 | |
| 17299 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17300 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17301 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17302 | .type = ALC_FIXUP_VERBS, |
| 17303 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17304 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17305 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17306 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17307 | { } |
| 17308 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17309 | }, |
| 17310 | }; |
| 17311 | |
| 17312 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 17313 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17314 | {} |
| 17315 | }; |
| 17316 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17317 | static int patch_alc861vd(struct hda_codec *codec) |
| 17318 | { |
| 17319 | struct alc_spec *spec; |
| 17320 | int err, board_config; |
| 17321 | |
| 17322 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17323 | if (spec == NULL) |
| 17324 | return -ENOMEM; |
| 17325 | |
| 17326 | codec->spec = spec; |
| 17327 | |
| 17328 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17329 | alc861vd_models, |
| 17330 | alc861vd_cfg_tbl); |
| 17331 | |
| 17332 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17333 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17334 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17335 | board_config = ALC861VD_AUTO; |
| 17336 | } |
| 17337 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17338 | if (board_config == ALC861VD_AUTO) { |
| 17339 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17340 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17341 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17342 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17343 | if (board_config == ALC861VD_AUTO) { |
| 17344 | /* automatic parse from the BIOS config */ |
| 17345 | err = alc861vd_parse_auto_config(codec); |
| 17346 | if (err < 0) { |
| 17347 | alc_free(codec); |
| 17348 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17349 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17350 | printk(KERN_INFO |
| 17351 | "hda_codec: Cannot set up configuration " |
| 17352 | "from BIOS. Using base mode...\n"); |
| 17353 | board_config = ALC861VD_3ST; |
| 17354 | } |
| 17355 | } |
| 17356 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17357 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17358 | if (err < 0) { |
| 17359 | alc_free(codec); |
| 17360 | return err; |
| 17361 | } |
| 17362 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17363 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17364 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17365 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17366 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17367 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17368 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17369 | } |
| 17370 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17371 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17372 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17373 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17374 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17375 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17376 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17377 | if (!spec->adc_nids) { |
| 17378 | spec->adc_nids = alc861vd_adc_nids; |
| 17379 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17380 | } |
| 17381 | if (!spec->capsrc_nids) |
| 17382 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17383 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17384 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17385 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17386 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17387 | spec->vmaster_nid = 0x02; |
| 17388 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17389 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17390 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17391 | codec->patch_ops = alc_patch_ops; |
| 17392 | |
| 17393 | if (board_config == ALC861VD_AUTO) |
| 17394 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 17395 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17396 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17397 | if (!spec->loopback.amplist) |
| 17398 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17399 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17400 | |
| 17401 | return 0; |
| 17402 | } |
| 17403 | |
| 17404 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17405 | * ALC662 support |
| 17406 | * |
| 17407 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17408 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17409 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17410 | * 6-channel independent captures. |
| 17411 | * |
| 17412 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17413 | * driver yet). |
| 17414 | */ |
| 17415 | #define ALC662_DIGOUT_NID 0x06 |
| 17416 | #define ALC662_DIGIN_NID 0x0a |
| 17417 | |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 17418 | static hda_nid_t alc662_dac_nids[3] = { |
| 17419 | /* front, rear, clfe */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17420 | 0x02, 0x03, 0x04 |
| 17421 | }; |
| 17422 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17423 | static hda_nid_t alc272_dac_nids[2] = { |
| 17424 | 0x02, 0x03 |
| 17425 | }; |
| 17426 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17427 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17428 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17429 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17430 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17431 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17432 | static hda_nid_t alc272_adc_nids[1] = { |
| 17433 | /* ADC1-2 */ |
| 17434 | 0x08, |
| 17435 | }; |
| 17436 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17437 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17438 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 17439 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17440 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17441 | /* input MUX */ |
| 17442 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17443 | static struct hda_input_mux alc662_capture_source = { |
| 17444 | .num_items = 4, |
| 17445 | .items = { |
| 17446 | { "Mic", 0x0 }, |
| 17447 | { "Front Mic", 0x1 }, |
| 17448 | { "Line", 0x2 }, |
| 17449 | { "CD", 0x4 }, |
| 17450 | }, |
| 17451 | }; |
| 17452 | |
| 17453 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 17454 | .num_items = 2, |
| 17455 | .items = { |
| 17456 | { "Mic", 0x1 }, |
| 17457 | { "Line", 0x2 }, |
| 17458 | }, |
| 17459 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17460 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17461 | static struct hda_input_mux alc663_capture_source = { |
| 17462 | .num_items = 3, |
| 17463 | .items = { |
| 17464 | { "Mic", 0x0 }, |
| 17465 | { "Front Mic", 0x1 }, |
| 17466 | { "Line", 0x2 }, |
| 17467 | }, |
| 17468 | }; |
| 17469 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17470 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17471 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17472 | .num_items = 16, |
| 17473 | .items = { |
| 17474 | { "Autoselect Mic", 0x0 }, |
| 17475 | { "Internal Mic", 0x1 }, |
| 17476 | { "In-0x02", 0x2 }, |
| 17477 | { "In-0x03", 0x3 }, |
| 17478 | { "In-0x04", 0x4 }, |
| 17479 | { "In-0x05", 0x5 }, |
| 17480 | { "In-0x06", 0x6 }, |
| 17481 | { "In-0x07", 0x7 }, |
| 17482 | { "In-0x08", 0x8 }, |
| 17483 | { "In-0x09", 0x9 }, |
| 17484 | { "In-0x0a", 0x0a }, |
| 17485 | { "In-0x0b", 0x0b }, |
| 17486 | { "In-0x0c", 0x0c }, |
| 17487 | { "In-0x0d", 0x0d }, |
| 17488 | { "In-0x0e", 0x0e }, |
| 17489 | { "In-0x0f", 0x0f }, |
| 17490 | }, |
| 17491 | }; |
| 17492 | #endif |
| 17493 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17494 | /* |
| 17495 | * 2ch mode |
| 17496 | */ |
| 17497 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17498 | { 2, NULL } |
| 17499 | }; |
| 17500 | |
| 17501 | /* |
| 17502 | * 2ch mode |
| 17503 | */ |
| 17504 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17505 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17506 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17507 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17508 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17509 | { } /* end */ |
| 17510 | }; |
| 17511 | |
| 17512 | /* |
| 17513 | * 6ch mode |
| 17514 | */ |
| 17515 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17516 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17517 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17518 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17519 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17520 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17521 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17522 | { } /* end */ |
| 17523 | }; |
| 17524 | |
| 17525 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17526 | { 2, alc662_3ST_ch2_init }, |
| 17527 | { 6, alc662_3ST_ch6_init }, |
| 17528 | }; |
| 17529 | |
| 17530 | /* |
| 17531 | * 2ch mode |
| 17532 | */ |
| 17533 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17534 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17535 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17536 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17537 | { } /* end */ |
| 17538 | }; |
| 17539 | |
| 17540 | /* |
| 17541 | * 6ch mode |
| 17542 | */ |
| 17543 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17544 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17545 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17546 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17547 | { } /* end */ |
| 17548 | }; |
| 17549 | |
| 17550 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17551 | { 2, alc662_sixstack_ch6_init }, |
| 17552 | { 6, alc662_sixstack_ch8_init }, |
| 17553 | }; |
| 17554 | |
| 17555 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17556 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17557 | */ |
| 17558 | |
| 17559 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17560 | /* output mixer control */ |
| 17561 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17562 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17563 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17564 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17565 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17566 | 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] | 17567 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17568 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17570 | |
| 17571 | /*Input mixer control */ |
| 17572 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17573 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17574 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17575 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17577 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17578 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17579 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17580 | { } /* end */ |
| 17581 | }; |
| 17582 | |
| 17583 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17585 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17586 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17587 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17588 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17589 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17590 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17591 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17593 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17594 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17595 | { } /* end */ |
| 17596 | }; |
| 17597 | |
| 17598 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17599 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17600 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17601 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17602 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17603 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17604 | 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] | 17605 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17606 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17607 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17608 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17609 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17610 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17611 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17614 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17615 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17616 | { } /* end */ |
| 17617 | }; |
| 17618 | |
| 17619 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17620 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17621 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17622 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17623 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17624 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17625 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17626 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17627 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17628 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17629 | { } /* end */ |
| 17630 | }; |
| 17631 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17632 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17633 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17634 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17635 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17636 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17638 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17639 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17640 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17641 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17642 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17643 | { } /* end */ |
| 17644 | }; |
| 17645 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17646 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17647 | ALC262_HIPPO_MASTER_SWITCH, |
| 17648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17649 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17650 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17651 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17652 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17653 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17654 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17655 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17656 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17657 | { } /* end */ |
| 17658 | }; |
| 17659 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17660 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17661 | .ops = &snd_hda_bind_vol, |
| 17662 | .values = { |
| 17663 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17664 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17665 | 0 |
| 17666 | }, |
| 17667 | }; |
| 17668 | |
| 17669 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17670 | .ops = &snd_hda_bind_sw, |
| 17671 | .values = { |
| 17672 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17673 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17674 | 0 |
| 17675 | }, |
| 17676 | }; |
| 17677 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17678 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17679 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17680 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17683 | { } /* end */ |
| 17684 | }; |
| 17685 | |
| 17686 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17687 | .ops = &snd_hda_bind_sw, |
| 17688 | .values = { |
| 17689 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17690 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17691 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17692 | 0 |
| 17693 | }, |
| 17694 | }; |
| 17695 | |
| 17696 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17697 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17698 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17701 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17702 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17703 | |
| 17704 | { } /* end */ |
| 17705 | }; |
| 17706 | |
| 17707 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17708 | .ops = &snd_hda_bind_sw, |
| 17709 | .values = { |
| 17710 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17711 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17712 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17713 | 0 |
| 17714 | }, |
| 17715 | }; |
| 17716 | |
| 17717 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17718 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17719 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17720 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17721 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17722 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17723 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17724 | { } /* end */ |
| 17725 | }; |
| 17726 | |
| 17727 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17728 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17729 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17730 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17733 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17734 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17735 | { } /* end */ |
| 17736 | }; |
| 17737 | |
| 17738 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17739 | .ops = &snd_hda_bind_vol, |
| 17740 | .values = { |
| 17741 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17742 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17743 | 0 |
| 17744 | }, |
| 17745 | }; |
| 17746 | |
| 17747 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17748 | .ops = &snd_hda_bind_sw, |
| 17749 | .values = { |
| 17750 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17751 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17752 | 0 |
| 17753 | }, |
| 17754 | }; |
| 17755 | |
| 17756 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17757 | HDA_BIND_VOL("Master Playback Volume", |
| 17758 | &alc663_asus_two_bind_master_vol), |
| 17759 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17760 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17761 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17763 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17764 | { } /* end */ |
| 17765 | }; |
| 17766 | |
| 17767 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17768 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17769 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17770 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17774 | { } /* end */ |
| 17775 | }; |
| 17776 | |
| 17777 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17778 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17779 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17780 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17781 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17782 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17783 | |
| 17784 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17786 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17787 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17788 | { } /* end */ |
| 17789 | }; |
| 17790 | |
| 17791 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17792 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17793 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17794 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17795 | |
| 17796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17798 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17799 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17800 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17801 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17802 | { } /* end */ |
| 17803 | }; |
| 17804 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17805 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17806 | .ops = &snd_hda_bind_sw, |
| 17807 | .values = { |
| 17808 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17809 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17810 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17811 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17812 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17813 | 0 |
| 17814 | }, |
| 17815 | }; |
| 17816 | |
| 17817 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17818 | .ops = &snd_hda_bind_sw, |
| 17819 | .values = { |
| 17820 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17821 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17822 | 0 |
| 17823 | }, |
| 17824 | }; |
| 17825 | |
| 17826 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17827 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17828 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17829 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17830 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17831 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17832 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17833 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17836 | { } /* end */ |
| 17837 | }; |
| 17838 | |
| 17839 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17840 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17841 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17842 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17843 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17844 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17847 | { } /* end */ |
| 17848 | }; |
| 17849 | |
| 17850 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17851 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17852 | { |
| 17853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17854 | .name = "Channel Mode", |
| 17855 | .info = alc_ch_mode_info, |
| 17856 | .get = alc_ch_mode_get, |
| 17857 | .put = alc_ch_mode_put, |
| 17858 | }, |
| 17859 | { } /* end */ |
| 17860 | }; |
| 17861 | |
| 17862 | static struct hda_verb alc662_init_verbs[] = { |
| 17863 | /* ADC: mute amp left and right */ |
| 17864 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17865 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17866 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17867 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17868 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17869 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17870 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17871 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17872 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17873 | |
| 17874 | /* Front Pin: output 0 (0x0c) */ |
| 17875 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17876 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17877 | |
| 17878 | /* Rear Pin: output 1 (0x0d) */ |
| 17879 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17880 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17881 | |
| 17882 | /* CLFE Pin: output 2 (0x0e) */ |
| 17883 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17884 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17885 | |
| 17886 | /* Mic (rear) pin: input vref at 80% */ |
| 17887 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17888 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17889 | /* Front Mic pin: input vref at 80% */ |
| 17890 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17891 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17892 | /* Line In pin: input */ |
| 17893 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17894 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17895 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17896 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17897 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17898 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17899 | /* CD pin widget for input */ |
| 17900 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17901 | |
| 17902 | /* FIXME: use matrix-type input source selection */ |
| 17903 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17904 | /* Input mixer */ |
| 17905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17906 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17907 | |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 17908 | { } |
| 17909 | }; |
| 17910 | |
| 17911 | static struct hda_verb alc662_eapd_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17912 | /* always trun on EAPD */ |
| 17913 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17914 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17915 | { } |
| 17916 | }; |
| 17917 | |
| 17918 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17919 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17920 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17921 | {} |
| 17922 | }; |
| 17923 | |
| 17924 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17925 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17926 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17927 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17928 | }; |
| 17929 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17930 | /* Set Unsolicited Event*/ |
| 17931 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17932 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17933 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17934 | {} |
| 17935 | }; |
| 17936 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17937 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17938 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17939 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17940 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17941 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17942 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17943 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17944 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17945 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17946 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17947 | {} |
| 17948 | }; |
| 17949 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17950 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17951 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17952 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17953 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17956 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17957 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17958 | {} |
| 17959 | }; |
| 17960 | |
| 17961 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17962 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17963 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17964 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17965 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17968 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17969 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17970 | {} |
| 17971 | }; |
| 17972 | |
| 17973 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17975 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17976 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17979 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17980 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17981 | {} |
| 17982 | }; |
| 17983 | |
| 17984 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17985 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17986 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17987 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17988 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17990 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17991 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17992 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17993 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17994 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17995 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17996 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17997 | {} |
| 17998 | }; |
| 17999 | |
| 18000 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 18001 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18002 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18003 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18004 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18005 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18006 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18007 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18010 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18011 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18012 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18013 | {} |
| 18014 | }; |
| 18015 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18016 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 18017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18018 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18019 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18020 | |
| 18021 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18022 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18023 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18024 | |
| 18025 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18026 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18027 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18028 | {} |
| 18029 | }; |
| 18030 | |
| 18031 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 18032 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18033 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18034 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18035 | |
| 18036 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18037 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18038 | {} |
| 18039 | }; |
| 18040 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18041 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 18042 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18044 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18045 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18046 | {} |
| 18047 | }; |
| 18048 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18049 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 18050 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18051 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18052 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18054 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18055 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18056 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18060 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18061 | {} |
| 18062 | }; |
| 18063 | |
| 18064 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 18065 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18066 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18067 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18069 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18070 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18071 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18072 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18073 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18074 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18075 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18076 | {} |
| 18077 | }; |
| 18078 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18079 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 18080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18081 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18082 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18083 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18084 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18085 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18086 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18087 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18088 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18089 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18092 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18093 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18094 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18095 | {} |
| 18096 | }; |
| 18097 | |
| 18098 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 18099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18100 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18101 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18102 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18103 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18104 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18105 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18106 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18107 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18108 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18109 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18112 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18113 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18114 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18115 | {} |
| 18116 | }; |
| 18117 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18118 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 18119 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18120 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18121 | { } /* end */ |
| 18122 | }; |
| 18123 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18124 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 18125 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18126 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18127 | { } /* end */ |
| 18128 | }; |
| 18129 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18130 | static void alc662_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18131 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18132 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18133 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18134 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18135 | spec->autocfg.line_out_pins[0] = 0x14; |
| 18136 | spec->autocfg.speaker_pins[0] = 0x15; |
| 18137 | spec->automute = 1; |
| 18138 | spec->detect_line = 1; |
| 18139 | spec->automute_lines = 1; |
| 18140 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18141 | } |
| 18142 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18143 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18144 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18145 | struct alc_spec *spec = codec->spec; |
| 18146 | |
| 18147 | alc262_hippo1_setup(codec); |
| 18148 | spec->ext_mic.pin = 0x18; |
| 18149 | spec->ext_mic.mux_idx = 0; |
| 18150 | spec->int_mic.pin = 0x19; |
| 18151 | spec->int_mic.mux_idx = 1; |
| 18152 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18153 | } |
| 18154 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18155 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18156 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18157 | struct alc_spec *spec = codec->spec; |
| 18158 | |
| 18159 | spec->autocfg.hp_pins[0] = 0x14; |
| 18160 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 18161 | spec->automute = 1; |
| 18162 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18163 | } |
| 18164 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18165 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18166 | { |
| 18167 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18168 | spec->autocfg.hp_pins[0] = 0x21; |
| 18169 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18170 | spec->automute_mixer_nid[0] = 0x0c; |
| 18171 | spec->automute = 1; |
| 18172 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18173 | spec->ext_mic.pin = 0x18; |
| 18174 | spec->ext_mic.mux_idx = 0; |
| 18175 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18176 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18177 | spec->auto_mic = 1; |
| 18178 | } |
| 18179 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18180 | /* ***************** Mode1 ******************************/ |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18181 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18182 | { |
| 18183 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18184 | spec->autocfg.hp_pins[0] = 0x21; |
| 18185 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18186 | spec->automute_mixer_nid[0] = 0x0c; |
| 18187 | spec->automute = 1; |
| 18188 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18189 | spec->ext_mic.pin = 0x18; |
| 18190 | spec->ext_mic.mux_idx = 0; |
| 18191 | spec->int_mic.pin = 0x19; |
| 18192 | spec->int_mic.mux_idx = 1; |
| 18193 | spec->auto_mic = 1; |
| 18194 | } |
| 18195 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18196 | /* ***************** Mode2 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18197 | static void alc662_mode2_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18198 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18199 | struct alc_spec *spec = codec->spec; |
| 18200 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18201 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18202 | spec->automute = 1; |
| 18203 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18204 | spec->ext_mic.pin = 0x18; |
| 18205 | spec->ext_mic.mux_idx = 0; |
| 18206 | spec->int_mic.pin = 0x19; |
| 18207 | spec->int_mic.mux_idx = 1; |
| 18208 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18209 | } |
| 18210 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18211 | /* ***************** Mode3 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18212 | static void alc663_mode3_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18213 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18214 | struct alc_spec *spec = codec->spec; |
| 18215 | spec->autocfg.hp_pins[0] = 0x21; |
| 18216 | spec->autocfg.hp_pins[0] = 0x15; |
| 18217 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18218 | spec->automute = 1; |
| 18219 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18220 | spec->ext_mic.pin = 0x18; |
| 18221 | spec->ext_mic.mux_idx = 0; |
| 18222 | spec->int_mic.pin = 0x19; |
| 18223 | spec->int_mic.mux_idx = 1; |
| 18224 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18225 | } |
| 18226 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18227 | /* ***************** Mode4 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18228 | static void alc663_mode4_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18229 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18230 | struct alc_spec *spec = codec->spec; |
| 18231 | spec->autocfg.hp_pins[0] = 0x21; |
| 18232 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18233 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18234 | spec->automute_mixer_nid[0] = 0x0c; |
| 18235 | spec->automute_mixer_nid[1] = 0x0e; |
| 18236 | spec->automute = 1; |
| 18237 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18238 | spec->ext_mic.pin = 0x18; |
| 18239 | spec->ext_mic.mux_idx = 0; |
| 18240 | spec->int_mic.pin = 0x19; |
| 18241 | spec->int_mic.mux_idx = 1; |
| 18242 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18243 | } |
| 18244 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18245 | /* ***************** Mode5 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18246 | static void alc663_mode5_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18247 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18248 | struct alc_spec *spec = codec->spec; |
| 18249 | spec->autocfg.hp_pins[0] = 0x15; |
| 18250 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18251 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18252 | spec->automute_mixer_nid[0] = 0x0c; |
| 18253 | spec->automute_mixer_nid[1] = 0x0e; |
| 18254 | spec->automute = 1; |
| 18255 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18256 | spec->ext_mic.pin = 0x18; |
| 18257 | spec->ext_mic.mux_idx = 0; |
| 18258 | spec->int_mic.pin = 0x19; |
| 18259 | spec->int_mic.mux_idx = 1; |
| 18260 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18261 | } |
| 18262 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18263 | /* ***************** Mode6 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18264 | static void alc663_mode6_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18265 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18266 | struct alc_spec *spec = codec->spec; |
| 18267 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18268 | spec->autocfg.hp_pins[0] = 0x15; |
| 18269 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18270 | spec->automute_mixer_nid[0] = 0x0c; |
| 18271 | spec->automute = 1; |
| 18272 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18273 | spec->ext_mic.pin = 0x18; |
| 18274 | spec->ext_mic.mux_idx = 0; |
| 18275 | spec->int_mic.pin = 0x19; |
| 18276 | spec->int_mic.mux_idx = 1; |
| 18277 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18278 | } |
| 18279 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18280 | /* ***************** Mode7 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18281 | static void alc663_mode7_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18282 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18283 | struct alc_spec *spec = codec->spec; |
| 18284 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18285 | spec->autocfg.hp_pins[0] = 0x21; |
| 18286 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18287 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18288 | spec->automute = 1; |
| 18289 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18290 | spec->ext_mic.pin = 0x18; |
| 18291 | spec->ext_mic.mux_idx = 0; |
| 18292 | spec->int_mic.pin = 0x19; |
| 18293 | spec->int_mic.mux_idx = 1; |
| 18294 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18295 | } |
| 18296 | |
| 18297 | /* ***************** Mode8 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18298 | static void alc663_mode8_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18299 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18300 | struct alc_spec *spec = codec->spec; |
| 18301 | spec->autocfg.hp_pins[0] = 0x21; |
| 18302 | spec->autocfg.hp_pins[1] = 0x15; |
| 18303 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18304 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18305 | spec->automute = 1; |
| 18306 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18307 | spec->ext_mic.pin = 0x18; |
| 18308 | spec->ext_mic.mux_idx = 0; |
| 18309 | spec->int_mic.pin = 0x12; |
| 18310 | spec->int_mic.mux_idx = 9; |
| 18311 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18312 | } |
| 18313 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18314 | static void alc663_g71v_setup(struct hda_codec *codec) |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18315 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18316 | struct alc_spec *spec = codec->spec; |
| 18317 | spec->autocfg.hp_pins[0] = 0x21; |
| 18318 | spec->autocfg.line_out_pins[0] = 0x15; |
| 18319 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18320 | spec->automute = 1; |
| 18321 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
| 18322 | spec->detect_line = 1; |
| 18323 | spec->automute_lines = 1; |
| 18324 | spec->ext_mic.pin = 0x18; |
| 18325 | spec->ext_mic.mux_idx = 0; |
| 18326 | spec->int_mic.pin = 0x12; |
| 18327 | spec->int_mic.mux_idx = 9; |
| 18328 | spec->auto_mic = 1; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18329 | } |
| 18330 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18331 | #define alc663_g50v_setup alc663_m51va_setup |
| 18332 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18333 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18334 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18335 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18336 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18337 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18338 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18339 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18340 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18341 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18342 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18343 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18344 | { } /* end */ |
| 18345 | }; |
| 18346 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18347 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18348 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18349 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18350 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18351 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18353 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18354 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18355 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18356 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18357 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18358 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18359 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18360 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18361 | { } /* end */ |
| 18362 | }; |
| 18363 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18364 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18365 | #define alc662_loopbacks alc880_loopbacks |
| 18366 | #endif |
| 18367 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18368 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18369 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18370 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18371 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18372 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18373 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18374 | |
| 18375 | /* |
| 18376 | * configuration and preset |
| 18377 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18378 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18379 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18380 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18381 | [ALC662_3ST_6ch] = "3stack-6ch", |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 18382 | [ALC662_5ST_DIG] = "5stack-dig", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18383 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18384 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18385 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18386 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18387 | [ALC663_ASUS_M51VA] = "m51va", |
| 18388 | [ALC663_ASUS_G71V] = "g71v", |
| 18389 | [ALC663_ASUS_H13] = "h13", |
| 18390 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18391 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18392 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18393 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18394 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18395 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18396 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18397 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18398 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18399 | [ALC272_DELL] = "dell", |
| 18400 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18401 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18402 | [ALC662_AUTO] = "auto", |
| 18403 | }; |
| 18404 | |
| 18405 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18406 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18407 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18408 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18409 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18410 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18411 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18412 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18413 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18414 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18415 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18416 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18417 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18418 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18419 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18420 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18421 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18422 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18423 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18424 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18425 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18426 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18427 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18428 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18429 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18430 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18431 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18432 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18433 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18434 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18435 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18436 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18437 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18438 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18439 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18440 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18441 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18442 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18443 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18444 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18445 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18446 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18447 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18448 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18449 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18450 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18451 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18452 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18453 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18454 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18455 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18456 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18457 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18458 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18459 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18460 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18461 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18462 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18463 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18464 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18465 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18466 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18467 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18468 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18469 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18470 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18471 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18472 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18473 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18474 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18475 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18476 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18477 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18478 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18479 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18480 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18481 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18482 | {} |
| 18483 | }; |
| 18484 | |
| 18485 | static struct alc_config_preset alc662_presets[] = { |
| 18486 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18487 | .mixers = { alc662_3ST_2ch_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18488 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18489 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18490 | .dac_nids = alc662_dac_nids, |
| 18491 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18492 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18493 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18494 | .channel_mode = alc662_3ST_2ch_modes, |
| 18495 | .input_mux = &alc662_capture_source, |
| 18496 | }, |
| 18497 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18498 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18499 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18500 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18501 | .dac_nids = alc662_dac_nids, |
| 18502 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18503 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18504 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18505 | .channel_mode = alc662_3ST_6ch_modes, |
| 18506 | .need_dac_fix = 1, |
| 18507 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18508 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18509 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18510 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18511 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18512 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18513 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18514 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18515 | .channel_mode = alc662_3ST_6ch_modes, |
| 18516 | .need_dac_fix = 1, |
| 18517 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18518 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18519 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18520 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18521 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18522 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18523 | .dac_nids = alc662_dac_nids, |
| 18524 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18525 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18526 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18527 | .channel_mode = alc662_5stack_modes, |
| 18528 | .input_mux = &alc662_capture_source, |
| 18529 | }, |
| 18530 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18531 | .mixers = { alc662_lenovo_101e_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18532 | .init_verbs = { alc662_init_verbs, |
| 18533 | alc662_eapd_init_verbs, |
| 18534 | alc662_sue_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18535 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18536 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18537 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18538 | .channel_mode = alc662_3ST_2ch_modes, |
| 18539 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18540 | .unsol_event = alc_sku_unsol_event, |
| 18541 | .setup = alc662_lenovo_101e_setup, |
| 18542 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18543 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18544 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18545 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18546 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18547 | alc662_eapd_init_verbs, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18548 | alc662_eeepc_sue_init_verbs }, |
| 18549 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18550 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18551 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18552 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 18553 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18554 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 18555 | .init_hook = alc_inithook, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18556 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18557 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18558 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18559 | alc662_chmode_mixer }, |
| 18560 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18561 | alc662_eapd_init_verbs, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18562 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18563 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18564 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18565 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18566 | .channel_mode = alc662_3ST_6ch_modes, |
| 18567 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 18568 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18569 | .setup = alc662_eeepc_ep20_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 18570 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18571 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18572 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18573 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18574 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18575 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18576 | alc662_ecs_init_verbs }, |
| 18577 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18578 | .dac_nids = alc662_dac_nids, |
| 18579 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18580 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 18581 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18582 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame^] | 18583 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18584 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18585 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18586 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18587 | .init_verbs = { alc662_init_verbs, |
| 18588 | alc662_eapd_init_verbs, |
| 18589 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18590 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18591 | .dac_nids = alc662_dac_nids, |
| 18592 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18593 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18594 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18595 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18596 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18597 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18598 | }, |
| 18599 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18600 | .mixers = { alc663_g71v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18601 | .init_verbs = { alc662_init_verbs, |
| 18602 | alc662_eapd_init_verbs, |
| 18603 | alc663_g71v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18604 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18605 | .dac_nids = alc662_dac_nids, |
| 18606 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18607 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18608 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18609 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18610 | .setup = alc663_g71v_setup, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18611 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18612 | }, |
| 18613 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18614 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18615 | .init_verbs = { alc662_init_verbs, |
| 18616 | alc662_eapd_init_verbs, |
| 18617 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18618 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18619 | .dac_nids = alc662_dac_nids, |
| 18620 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18621 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18622 | .setup = alc663_m51va_setup, |
| 18623 | .unsol_event = alc_sku_unsol_event, |
| 18624 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18625 | }, |
| 18626 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18627 | .mixers = { alc663_g50v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18628 | .init_verbs = { alc662_init_verbs, |
| 18629 | alc662_eapd_init_verbs, |
| 18630 | alc663_g50v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18631 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18632 | .dac_nids = alc662_dac_nids, |
| 18633 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18634 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18635 | .channel_mode = alc662_3ST_6ch_modes, |
| 18636 | .input_mux = &alc663_capture_source, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18637 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18638 | .setup = alc663_g50v_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18639 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18640 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18641 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18642 | .mixers = { alc663_m51va_mixer }, |
| 18643 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18644 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18645 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18646 | alc663_21jd_amic_init_verbs }, |
| 18647 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18648 | .hp_nid = 0x03, |
| 18649 | .dac_nids = alc662_dac_nids, |
| 18650 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18651 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18652 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18653 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18654 | .setup = alc663_mode1_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18655 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18656 | }, |
| 18657 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18658 | .mixers = { alc662_1bjd_mixer }, |
| 18659 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18660 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18661 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18662 | alc662_1bjd_amic_init_verbs }, |
| 18663 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18664 | .dac_nids = alc662_dac_nids, |
| 18665 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18666 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18667 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18668 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18669 | .setup = alc662_mode2_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18670 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18671 | }, |
| 18672 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18673 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18674 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18675 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18676 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18677 | alc663_two_hp_amic_m1_init_verbs }, |
| 18678 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18679 | .hp_nid = 0x03, |
| 18680 | .dac_nids = alc662_dac_nids, |
| 18681 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18682 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18683 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18684 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18685 | .setup = alc663_mode3_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18686 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18687 | }, |
| 18688 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18689 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18690 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18691 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18692 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18693 | alc663_21jd_amic_init_verbs}, |
| 18694 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18695 | .hp_nid = 0x03, |
| 18696 | .dac_nids = alc662_dac_nids, |
| 18697 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18698 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18699 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18700 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18701 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18702 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18703 | }, |
| 18704 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18705 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18706 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18707 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18708 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18709 | alc663_15jd_amic_init_verbs }, |
| 18710 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18711 | .hp_nid = 0x03, |
| 18712 | .dac_nids = alc662_dac_nids, |
| 18713 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18714 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18715 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18716 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18717 | .setup = alc663_mode5_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18718 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18719 | }, |
| 18720 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18721 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18722 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18723 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18724 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18725 | alc663_two_hp_amic_m2_init_verbs }, |
| 18726 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18727 | .hp_nid = 0x03, |
| 18728 | .dac_nids = alc662_dac_nids, |
| 18729 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18730 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18731 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18732 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18733 | .setup = alc663_mode6_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18734 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18735 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18736 | [ALC663_ASUS_MODE7] = { |
| 18737 | .mixers = { alc663_mode7_mixer }, |
| 18738 | .cap_mixer = alc662_auto_capture_mixer, |
| 18739 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18740 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18741 | alc663_mode7_init_verbs }, |
| 18742 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18743 | .hp_nid = 0x03, |
| 18744 | .dac_nids = alc662_dac_nids, |
| 18745 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18746 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18747 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18748 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18749 | .setup = alc663_mode7_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18750 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18751 | }, |
| 18752 | [ALC663_ASUS_MODE8] = { |
| 18753 | .mixers = { alc663_mode8_mixer }, |
| 18754 | .cap_mixer = alc662_auto_capture_mixer, |
| 18755 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18756 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18757 | alc663_mode8_init_verbs }, |
| 18758 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18759 | .hp_nid = 0x03, |
| 18760 | .dac_nids = alc662_dac_nids, |
| 18761 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18762 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18763 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18764 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18765 | .setup = alc663_mode8_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18766 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18767 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18768 | [ALC272_DELL] = { |
| 18769 | .mixers = { alc663_m51va_mixer }, |
| 18770 | .cap_mixer = alc272_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18771 | .init_verbs = { alc662_init_verbs, |
| 18772 | alc662_eapd_init_verbs, |
| 18773 | alc272_dell_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18774 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18775 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18776 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18777 | .adc_nids = alc272_adc_nids, |
| 18778 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18779 | .capsrc_nids = alc272_capsrc_nids, |
| 18780 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18781 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18782 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18783 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18784 | }, |
| 18785 | [ALC272_DELL_ZM1] = { |
| 18786 | .mixers = { alc663_m51va_mixer }, |
| 18787 | .cap_mixer = alc662_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18788 | .init_verbs = { alc662_init_verbs, |
| 18789 | alc662_eapd_init_verbs, |
| 18790 | alc272_dell_zm1_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18791 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18792 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18793 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18794 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18795 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18796 | .capsrc_nids = alc662_capsrc_nids, |
| 18797 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18798 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18799 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18800 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18801 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18802 | [ALC272_SAMSUNG_NC10] = { |
| 18803 | .mixers = { alc272_nc10_mixer }, |
| 18804 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18805 | alc662_eapd_init_verbs, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18806 | alc663_21jd_amic_init_verbs }, |
| 18807 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18808 | .dac_nids = alc272_dac_nids, |
| 18809 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18810 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18811 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18812 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18813 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18814 | .init_hook = alc_inithook, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18815 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18816 | }; |
| 18817 | |
| 18818 | |
| 18819 | /* |
| 18820 | * BIOS auto configuration |
| 18821 | */ |
| 18822 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18823 | /* convert from MIX nid to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18824 | 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] | 18825 | { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18826 | hda_nid_t list[5]; |
Takashi Iwai | 1304ac8 | 2011-04-06 15:16:21 +0200 | [diff] [blame] | 18827 | int i, num; |
| 18828 | |
| 18829 | num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list)); |
| 18830 | for (i = 0; i < num; i++) { |
| 18831 | if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT) |
| 18832 | return list[i]; |
| 18833 | } |
| 18834 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18835 | } |
| 18836 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18837 | /* go down to the selector widget before the mixer */ |
| 18838 | static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin) |
| 18839 | { |
| 18840 | hda_nid_t srcs[5]; |
| 18841 | int num = snd_hda_get_connections(codec, pin, srcs, |
| 18842 | ARRAY_SIZE(srcs)); |
| 18843 | if (num != 1 || |
| 18844 | get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL) |
| 18845 | return pin; |
| 18846 | return srcs[0]; |
| 18847 | } |
| 18848 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18849 | /* get MIX nid connected to the given pin targeted to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18850 | 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] | 18851 | hda_nid_t dac) |
| 18852 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 18853 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18854 | int i, num; |
| 18855 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18856 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18857 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18858 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18859 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18860 | return mix[i]; |
| 18861 | } |
| 18862 | return 0; |
| 18863 | } |
| 18864 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18865 | /* select the connection from pin to DAC if needed */ |
| 18866 | static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin, |
| 18867 | hda_nid_t dac) |
| 18868 | { |
| 18869 | hda_nid_t mix[5]; |
| 18870 | int i, num; |
| 18871 | |
| 18872 | pin = alc_go_down_to_selector(codec, pin); |
| 18873 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18874 | if (num < 2) |
| 18875 | return 0; |
| 18876 | for (i = 0; i < num; i++) { |
| 18877 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) { |
| 18878 | snd_hda_codec_update_cache(codec, pin, 0, |
| 18879 | AC_VERB_SET_CONNECT_SEL, i); |
| 18880 | return 0; |
| 18881 | } |
| 18882 | } |
| 18883 | return 0; |
| 18884 | } |
| 18885 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18886 | /* look for an empty DAC slot */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18887 | 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] | 18888 | { |
| 18889 | struct alc_spec *spec = codec->spec; |
| 18890 | hda_nid_t srcs[5]; |
| 18891 | int i, j, num; |
| 18892 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18893 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18894 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18895 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18896 | hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18897 | if (!nid) |
| 18898 | continue; |
| 18899 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18900 | if (spec->multiout.dac_nids[j] == nid) |
| 18901 | break; |
| 18902 | if (j >= spec->multiout.num_dacs) |
| 18903 | return nid; |
| 18904 | } |
| 18905 | return 0; |
| 18906 | } |
| 18907 | |
| 18908 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18909 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18910 | const struct auto_pin_cfg *cfg) |
| 18911 | { |
| 18912 | struct alc_spec *spec = codec->spec; |
| 18913 | int i; |
| 18914 | hda_nid_t dac; |
| 18915 | |
| 18916 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18917 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18918 | dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18919 | if (!dac) |
| 18920 | continue; |
| 18921 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18922 | } |
| 18923 | return 0; |
| 18924 | } |
| 18925 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18926 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 18927 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18928 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18929 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18930 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18931 | } |
| 18932 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18933 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 18934 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18935 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18936 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18937 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18938 | } |
| 18939 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18940 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 18941 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 18942 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 18943 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18944 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18945 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18946 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18947 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18948 | |
| 18949 | /* add playback controls from the parsed DAC table */ |
| 18950 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18951 | const struct auto_pin_cfg *cfg) |
| 18952 | { |
| 18953 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18954 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18955 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18956 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18957 | const char *pfx = alc_get_line_out_pfx(spec, true); |
| 18958 | hda_nid_t nid, mix, pin; |
| 18959 | int i, err, noutputs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18960 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18961 | noutputs = cfg->line_outs; |
| 18962 | if (spec->multi_ios > 0) |
| 18963 | noutputs += spec->multi_ios; |
| 18964 | |
| 18965 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18966 | nid = spec->multiout.dac_nids[i]; |
| 18967 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18968 | continue; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18969 | if (i >= cfg->line_outs) |
| 18970 | pin = spec->multi_io[i - 1].pin; |
| 18971 | else |
| 18972 | pin = cfg->line_out_pins[i]; |
| 18973 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18974 | if (!mix) |
| 18975 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18976 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18977 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18978 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18979 | if (err < 0) |
| 18980 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18981 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18982 | if (err < 0) |
| 18983 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18984 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18985 | if (err < 0) |
| 18986 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18987 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18988 | if (err < 0) |
| 18989 | return err; |
| 18990 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18991 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18992 | int index = i; |
| 18993 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18994 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18995 | index = 0; |
| 18996 | } |
| 18997 | err = __alc662_add_vol_ctl(spec, name, nid, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18998 | if (err < 0) |
| 18999 | return err; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 19000 | err = __alc662_add_sw_ctl(spec, name, mix, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19001 | if (err < 0) |
| 19002 | return err; |
| 19003 | } |
| 19004 | } |
| 19005 | return 0; |
| 19006 | } |
| 19007 | |
| 19008 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19009 | /* return DAC nid if any new DAC is assigned */ |
| 19010 | 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] | 19011 | const char *pfx) |
| 19012 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19013 | struct alc_spec *spec = codec->spec; |
| 19014 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19015 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19016 | |
| 19017 | if (!pin) |
| 19018 | return 0; |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19019 | nid = alc_auto_look_for_dac(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19020 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19021 | /* the corresponding DAC is already occupied */ |
| 19022 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19023 | return 0; /* no way */ |
| 19024 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19025 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19026 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19027 | } |
| 19028 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19029 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19030 | if (!mix) |
| 19031 | return 0; |
| 19032 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19033 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19034 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19035 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19036 | if (err < 0) |
| 19037 | return err; |
| 19038 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19039 | } |
| 19040 | |
| 19041 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19042 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19043 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19044 | |
| 19045 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19046 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19047 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19048 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19049 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19050 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19051 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19052 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19053 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19054 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19055 | if (alc_auto_mix_to_dac(codec, srcs[i]) != dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19056 | continue; |
Takashi Iwai | 0e53f34 | 2011-04-07 12:27:32 +0200 | [diff] [blame] | 19057 | /* need the manual connection? */ |
| 19058 | if (num > 1) |
| 19059 | snd_hda_codec_write(codec, nid, 0, |
| 19060 | AC_VERB_SET_CONNECT_SEL, i); |
| 19061 | /* unmute mixer widget inputs */ |
| 19062 | snd_hda_codec_write(codec, srcs[i], 0, |
| 19063 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19064 | AMP_IN_UNMUTE(0)); |
| 19065 | snd_hda_codec_write(codec, srcs[i], 0, |
| 19066 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19067 | AMP_IN_UNMUTE(1)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19068 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19069 | } |
| 19070 | } |
| 19071 | |
| 19072 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19073 | { |
| 19074 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19075 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19076 | int i; |
| 19077 | |
| 19078 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19079 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19080 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19081 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19082 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19083 | } |
| 19084 | } |
| 19085 | |
| 19086 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19087 | { |
| 19088 | struct alc_spec *spec = codec->spec; |
| 19089 | hda_nid_t pin; |
| 19090 | |
| 19091 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19092 | if (pin) |
| 19093 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19094 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19095 | pin = spec->autocfg.speaker_pins[0]; |
| 19096 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19097 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19098 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19099 | } |
| 19100 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19101 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19102 | |
| 19103 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19104 | { |
| 19105 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19106 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19107 | int i; |
| 19108 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19109 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19110 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19111 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19112 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19113 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19114 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19115 | snd_hda_codec_write(codec, nid, 0, |
| 19116 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19117 | AMP_OUT_MUTE); |
| 19118 | } |
| 19119 | } |
| 19120 | } |
| 19121 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19122 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19123 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19124 | /* |
| 19125 | * multi-io helper |
| 19126 | */ |
| 19127 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
| 19128 | unsigned int location) |
| 19129 | { |
| 19130 | struct alc_spec *spec = codec->spec; |
| 19131 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19132 | int type, i, num_pins = 0; |
| 19133 | |
| 19134 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
| 19135 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19136 | hda_nid_t nid = cfg->inputs[i].pin; |
| 19137 | hda_nid_t dac; |
| 19138 | unsigned int defcfg, caps; |
| 19139 | if (cfg->inputs[i].type != type) |
| 19140 | continue; |
| 19141 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 19142 | if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX) |
| 19143 | continue; |
| 19144 | if (location && get_defcfg_location(defcfg) != location) |
| 19145 | continue; |
| 19146 | caps = snd_hda_query_pin_caps(codec, nid); |
| 19147 | if (!(caps & AC_PINCAP_OUT)) |
| 19148 | continue; |
| 19149 | dac = alc_auto_look_for_dac(codec, nid); |
| 19150 | if (!dac) |
| 19151 | continue; |
| 19152 | spec->multi_io[num_pins].pin = nid; |
| 19153 | spec->multi_io[num_pins].dac = dac; |
| 19154 | num_pins++; |
| 19155 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19156 | } |
| 19157 | } |
| 19158 | spec->multiout.num_dacs = 1; |
| 19159 | if (num_pins < 2) |
| 19160 | return 0; |
| 19161 | return num_pins; |
| 19162 | } |
| 19163 | |
| 19164 | static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 19165 | struct snd_ctl_elem_info *uinfo) |
| 19166 | { |
| 19167 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19168 | struct alc_spec *spec = codec->spec; |
| 19169 | |
| 19170 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 19171 | uinfo->count = 1; |
| 19172 | uinfo->value.enumerated.items = spec->multi_ios + 1; |
| 19173 | if (uinfo->value.enumerated.item > spec->multi_ios) |
| 19174 | uinfo->value.enumerated.item = spec->multi_ios; |
| 19175 | sprintf(uinfo->value.enumerated.name, "%dch", |
| 19176 | (uinfo->value.enumerated.item + 1) * 2); |
| 19177 | return 0; |
| 19178 | } |
| 19179 | |
| 19180 | static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 19181 | struct snd_ctl_elem_value *ucontrol) |
| 19182 | { |
| 19183 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19184 | struct alc_spec *spec = codec->spec; |
| 19185 | ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2; |
| 19186 | return 0; |
| 19187 | } |
| 19188 | |
| 19189 | static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output) |
| 19190 | { |
| 19191 | struct alc_spec *spec = codec->spec; |
| 19192 | hda_nid_t nid = spec->multi_io[idx].pin; |
| 19193 | |
| 19194 | if (!spec->multi_io[idx].ctl_in) |
| 19195 | spec->multi_io[idx].ctl_in = |
| 19196 | snd_hda_codec_read(codec, nid, 0, |
| 19197 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 19198 | if (output) { |
| 19199 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19200 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19201 | PIN_OUT); |
| 19202 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19203 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19204 | HDA_AMP_MUTE, 0); |
| 19205 | alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac); |
| 19206 | } else { |
| 19207 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19208 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19209 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 19210 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19211 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19212 | spec->multi_io[idx].ctl_in); |
| 19213 | } |
| 19214 | return 0; |
| 19215 | } |
| 19216 | |
| 19217 | static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 19218 | struct snd_ctl_elem_value *ucontrol) |
| 19219 | { |
| 19220 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19221 | struct alc_spec *spec = codec->spec; |
| 19222 | int i, ch; |
| 19223 | |
| 19224 | ch = ucontrol->value.enumerated.item[0]; |
| 19225 | if (ch < 0 || ch > spec->multi_ios) |
| 19226 | return -EINVAL; |
| 19227 | if (ch == (spec->ext_channel_count - 1) / 2) |
| 19228 | return 0; |
| 19229 | spec->ext_channel_count = (ch + 1) * 2; |
| 19230 | for (i = 0; i < spec->multi_ios; i++) |
| 19231 | alc_set_multi_io(codec, i, i < ch); |
| 19232 | spec->multiout.max_channels = spec->ext_channel_count; |
| 19233 | return 1; |
| 19234 | } |
| 19235 | |
| 19236 | static struct snd_kcontrol_new alc_auto_channel_mode_enum = { |
| 19237 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 19238 | .name = "Channel Mode", |
| 19239 | .info = alc_auto_ch_mode_info, |
| 19240 | .get = alc_auto_ch_mode_get, |
| 19241 | .put = alc_auto_ch_mode_put, |
| 19242 | }; |
| 19243 | |
| 19244 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec) |
| 19245 | { |
| 19246 | struct alc_spec *spec = codec->spec; |
| 19247 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19248 | unsigned int location, defcfg; |
| 19249 | int num_pins; |
| 19250 | |
| 19251 | if (cfg->line_outs != 1 || |
| 19252 | cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 19253 | return 0; |
| 19254 | |
| 19255 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
| 19256 | location = get_defcfg_location(defcfg); |
| 19257 | |
| 19258 | num_pins = alc_auto_fill_multi_ios(codec, location); |
| 19259 | if (num_pins > 0) { |
| 19260 | struct snd_kcontrol_new *knew; |
| 19261 | |
| 19262 | knew = alc_kcontrol_new(spec); |
| 19263 | if (!knew) |
| 19264 | return -ENOMEM; |
| 19265 | *knew = alc_auto_channel_mode_enum; |
| 19266 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); |
| 19267 | if (!knew->name) |
| 19268 | return -ENOMEM; |
| 19269 | |
| 19270 | spec->multi_ios = num_pins; |
| 19271 | spec->ext_channel_count = 2; |
| 19272 | spec->multiout.num_dacs = num_pins + 1; |
| 19273 | } |
| 19274 | return 0; |
| 19275 | } |
| 19276 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19277 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19278 | { |
| 19279 | struct alc_spec *spec = codec->spec; |
| 19280 | int err; |
| 19281 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 19282 | |
| 19283 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19284 | alc662_ignore); |
| 19285 | if (err < 0) |
| 19286 | return err; |
| 19287 | if (!spec->autocfg.line_outs) |
| 19288 | return 0; /* can't find valid BIOS pin config */ |
| 19289 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19290 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19291 | if (err < 0) |
| 19292 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19293 | err = alc_auto_add_multi_channel_mode(codec); |
| 19294 | if (err < 0) |
| 19295 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19296 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19297 | if (err < 0) |
| 19298 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19299 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19300 | spec->autocfg.speaker_pins[0], |
| 19301 | "Speaker"); |
| 19302 | if (err < 0) |
| 19303 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19304 | if (err) |
| 19305 | spec->multiout.extra_out_nid[0] = err; |
| 19306 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19307 | "Headphone"); |
| 19308 | if (err < 0) |
| 19309 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19310 | if (err) |
| 19311 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19312 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19313 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19314 | return err; |
| 19315 | |
| 19316 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19317 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19318 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19319 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19320 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19321 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19322 | |
| 19323 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19324 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19325 | |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19326 | err = alc_auto_add_mic_boost(codec); |
| 19327 | if (err < 0) |
| 19328 | return err; |
| 19329 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19330 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19331 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19332 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19333 | else |
| 19334 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19335 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19336 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19337 | } |
| 19338 | |
| 19339 | /* additional initialization for auto-configuration model */ |
| 19340 | static void alc662_auto_init(struct hda_codec *codec) |
| 19341 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19342 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19343 | alc662_auto_init_multi_out(codec); |
| 19344 | alc662_auto_init_hp_out(codec); |
| 19345 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19346 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19347 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19348 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19349 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19350 | } |
| 19351 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19352 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19353 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19354 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19355 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19356 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19357 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19358 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19359 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19360 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19361 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19362 | printk(KERN_WARNING |
| 19363 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19364 | } |
| 19365 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19366 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19367 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19368 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19369 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19370 | ALC662_FIXUP_CZC_P10T, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19371 | ALC662_FIXUP_GIGABYTE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19372 | }; |
| 19373 | |
| 19374 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19375 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19376 | .type = ALC_FIXUP_PINS, |
| 19377 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19378 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19379 | { } |
| 19380 | } |
| 19381 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19382 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19383 | .type = ALC_FIXUP_PINS, |
| 19384 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19385 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19386 | { } |
| 19387 | } |
| 19388 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19389 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19390 | .type = ALC_FIXUP_FUNC, |
| 19391 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19392 | }, |
| 19393 | [ALC662_FIXUP_CZC_P10T] = { |
| 19394 | .type = ALC_FIXUP_VERBS, |
| 19395 | .v.verbs = (const struct hda_verb[]) { |
| 19396 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19397 | {} |
| 19398 | } |
| 19399 | }, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19400 | [ALC662_FIXUP_GIGABYTE] = { |
| 19401 | .type = ALC_FIXUP_PINS, |
| 19402 | .v.pins = (const struct alc_pincfg[]) { |
| 19403 | { 0x14, 0x1114410 }, /* set as speaker */ |
| 19404 | { } |
| 19405 | } |
| 19406 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19407 | }; |
| 19408 | |
| 19409 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19410 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19411 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19412 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19413 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19414 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19415 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19416 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19417 | {} |
| 19418 | }; |
| 19419 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19420 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19421 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19422 | {} |
| 19423 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19424 | |
| 19425 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19426 | static int patch_alc662(struct hda_codec *codec) |
| 19427 | { |
| 19428 | struct alc_spec *spec; |
| 19429 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19430 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19431 | |
| 19432 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19433 | if (!spec) |
| 19434 | return -ENOMEM; |
| 19435 | |
| 19436 | codec->spec = spec; |
| 19437 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19438 | alc_auto_parse_customize_define(codec); |
| 19439 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19440 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19441 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19442 | coef = alc_read_coef_idx(codec, 0); |
| 19443 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19444 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19445 | else if (coef & (1 << 14) && |
| 19446 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19447 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19448 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19449 | else if (coef == 0x4011) |
| 19450 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19451 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19452 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19453 | alc662_models, |
| 19454 | alc662_cfg_tbl); |
| 19455 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19456 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19457 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19458 | board_config = ALC662_AUTO; |
| 19459 | } |
| 19460 | |
| 19461 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19462 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19463 | alc662_fixup_tbl, alc662_fixups); |
| 19464 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19465 | /* automatic parse from the BIOS config */ |
| 19466 | err = alc662_parse_auto_config(codec); |
| 19467 | if (err < 0) { |
| 19468 | alc_free(codec); |
| 19469 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19470 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19471 | printk(KERN_INFO |
| 19472 | "hda_codec: Cannot set up configuration " |
| 19473 | "from BIOS. Using base mode...\n"); |
| 19474 | board_config = ALC662_3ST_2ch_DIG; |
| 19475 | } |
| 19476 | } |
| 19477 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19478 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19479 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19480 | if (err < 0) { |
| 19481 | alc_free(codec); |
| 19482 | return err; |
| 19483 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19484 | } |
| 19485 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19486 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19487 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19488 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19489 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19490 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19491 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19492 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19493 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19494 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19495 | if (!spec->adc_nids) { |
| 19496 | spec->adc_nids = alc662_adc_nids; |
| 19497 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19498 | } |
| 19499 | if (!spec->capsrc_nids) |
| 19500 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19501 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19502 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19503 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19504 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19505 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19506 | switch (codec->vendor_id) { |
| 19507 | case 0x10ec0662: |
| 19508 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19509 | break; |
| 19510 | case 0x10ec0272: |
| 19511 | case 0x10ec0663: |
| 19512 | case 0x10ec0665: |
| 19513 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19514 | break; |
| 19515 | case 0x10ec0273: |
| 19516 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19517 | break; |
| 19518 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19519 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19520 | spec->vmaster_nid = 0x02; |
| 19521 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19522 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19523 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19524 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19525 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19526 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 19527 | spec->shutup = alc_eapd_shutup; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19528 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19529 | alc_init_jacks(codec); |
| 19530 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19531 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19532 | if (!spec->loopback.amplist) |
| 19533 | spec->loopback.amplist = alc662_loopbacks; |
| 19534 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19535 | |
| 19536 | return 0; |
| 19537 | } |
| 19538 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19539 | static int patch_alc888(struct hda_codec *codec) |
| 19540 | { |
| 19541 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19542 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19543 | if (codec->vendor_id == 0x10ec0887) |
| 19544 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19545 | else |
| 19546 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19547 | if (!codec->chip_name) { |
| 19548 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19549 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19550 | } |
| 19551 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19552 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19553 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19554 | } |
| 19555 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19556 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19557 | * ALC680 support |
| 19558 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19559 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19560 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19561 | #define alc680_modes alc260_modes |
| 19562 | |
| 19563 | static hda_nid_t alc680_dac_nids[3] = { |
| 19564 | /* Lout1, Lout2, hp */ |
| 19565 | 0x02, 0x03, 0x04 |
| 19566 | }; |
| 19567 | |
| 19568 | static hda_nid_t alc680_adc_nids[3] = { |
| 19569 | /* ADC0-2 */ |
| 19570 | /* DMIC, MIC, Line-in*/ |
| 19571 | 0x07, 0x08, 0x09 |
| 19572 | }; |
| 19573 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19574 | /* |
| 19575 | * Analog capture ADC cgange |
| 19576 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19577 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19578 | { |
| 19579 | struct alc_spec *spec = codec->spec; |
| 19580 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19581 | int pin_found = 0; |
| 19582 | int type_found = AUTO_PIN_LAST; |
| 19583 | hda_nid_t nid; |
| 19584 | int i; |
| 19585 | |
| 19586 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19587 | nid = cfg->inputs[i].pin; |
| 19588 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19589 | AC_PINCAP_PRES_DETECT)) |
| 19590 | continue; |
| 19591 | if (snd_hda_jack_detect(codec, nid)) { |
| 19592 | if (cfg->inputs[i].type < type_found) { |
| 19593 | type_found = cfg->inputs[i].type; |
| 19594 | pin_found = nid; |
| 19595 | } |
| 19596 | } |
| 19597 | } |
| 19598 | |
| 19599 | nid = 0x07; |
| 19600 | if (pin_found) |
| 19601 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19602 | |
| 19603 | if (nid != spec->cur_adc) |
| 19604 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19605 | spec->cur_adc = nid; |
| 19606 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19607 | spec->cur_adc_format); |
| 19608 | } |
| 19609 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19610 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19611 | struct hda_codec *codec, |
| 19612 | unsigned int stream_tag, |
| 19613 | unsigned int format, |
| 19614 | struct snd_pcm_substream *substream) |
| 19615 | { |
| 19616 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19617 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19618 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19619 | spec->cur_adc_stream_tag = stream_tag; |
| 19620 | spec->cur_adc_format = format; |
| 19621 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19622 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19623 | return 0; |
| 19624 | } |
| 19625 | |
| 19626 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19627 | struct hda_codec *codec, |
| 19628 | struct snd_pcm_substream *substream) |
| 19629 | { |
| 19630 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19631 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19632 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19633 | return 0; |
| 19634 | } |
| 19635 | |
| 19636 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19637 | .substreams = 1, /* can be overridden */ |
| 19638 | .channels_min = 2, |
| 19639 | .channels_max = 2, |
| 19640 | /* NID is set in alc_build_pcms */ |
| 19641 | .ops = { |
| 19642 | .prepare = alc680_capture_pcm_prepare, |
| 19643 | .cleanup = alc680_capture_pcm_cleanup |
| 19644 | }, |
| 19645 | }; |
| 19646 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19647 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19648 | /* output mixer control */ |
| 19649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19650 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19651 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19652 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19653 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19654 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19655 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19656 | { } |
| 19657 | }; |
| 19658 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19659 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19660 | .ops = &snd_hda_bind_vol, |
| 19661 | .values = { |
| 19662 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19663 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19664 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19665 | 0 |
| 19666 | }, |
| 19667 | }; |
| 19668 | |
| 19669 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19670 | .ops = &snd_hda_bind_sw, |
| 19671 | .values = { |
| 19672 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19673 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19674 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19675 | 0 |
| 19676 | }, |
| 19677 | }; |
| 19678 | |
| 19679 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19680 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19681 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19682 | { } /* end */ |
| 19683 | }; |
| 19684 | |
| 19685 | /* |
| 19686 | * generic initialization of ADC, input mixers and output mixers |
| 19687 | */ |
| 19688 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19689 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19690 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19691 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19692 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19693 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19694 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19695 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19696 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19697 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19698 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19699 | |
| 19700 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19701 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19702 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19703 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19704 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19705 | |
| 19706 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19707 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19708 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19709 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19710 | { } |
| 19711 | }; |
| 19712 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19713 | /* toggle speaker-output according to the hp-jack state */ |
| 19714 | static void alc680_base_setup(struct hda_codec *codec) |
| 19715 | { |
| 19716 | struct alc_spec *spec = codec->spec; |
| 19717 | |
| 19718 | spec->autocfg.hp_pins[0] = 0x16; |
| 19719 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19720 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19721 | spec->autocfg.num_inputs = 2; |
| 19722 | spec->autocfg.inputs[0].pin = 0x18; |
| 19723 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19724 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19725 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19726 | spec->automute = 1; |
| 19727 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19728 | } |
| 19729 | |
| 19730 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19731 | unsigned int res) |
| 19732 | { |
| 19733 | if ((res >> 26) == ALC880_HP_EVENT) |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19734 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19735 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19736 | alc680_rec_autoswitch(codec); |
| 19737 | } |
| 19738 | |
| 19739 | static void alc680_inithook(struct hda_codec *codec) |
| 19740 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19741 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19742 | alc680_rec_autoswitch(codec); |
| 19743 | } |
| 19744 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19745 | /* create input playback/capture controls for the given pin */ |
| 19746 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19747 | const char *ctlname, int idx) |
| 19748 | { |
| 19749 | hda_nid_t dac; |
| 19750 | int err; |
| 19751 | |
| 19752 | switch (nid) { |
| 19753 | case 0x14: |
| 19754 | dac = 0x02; |
| 19755 | break; |
| 19756 | case 0x15: |
| 19757 | dac = 0x03; |
| 19758 | break; |
| 19759 | case 0x16: |
| 19760 | dac = 0x04; |
| 19761 | break; |
| 19762 | default: |
| 19763 | return 0; |
| 19764 | } |
| 19765 | if (spec->multiout.dac_nids[0] != dac && |
| 19766 | spec->multiout.dac_nids[1] != dac) { |
| 19767 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19768 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19769 | HDA_OUTPUT)); |
| 19770 | if (err < 0) |
| 19771 | return err; |
| 19772 | |
| 19773 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19774 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19775 | |
| 19776 | if (err < 0) |
| 19777 | return err; |
| 19778 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19779 | } |
| 19780 | |
| 19781 | return 0; |
| 19782 | } |
| 19783 | |
| 19784 | /* add playback controls from the parsed DAC table */ |
| 19785 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19786 | const struct auto_pin_cfg *cfg) |
| 19787 | { |
| 19788 | hda_nid_t nid; |
| 19789 | int err; |
| 19790 | |
| 19791 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19792 | |
| 19793 | nid = cfg->line_out_pins[0]; |
| 19794 | if (nid) { |
| 19795 | const char *name; |
| 19796 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19797 | name = "Speaker"; |
| 19798 | else |
| 19799 | name = "Front"; |
| 19800 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19801 | if (err < 0) |
| 19802 | return err; |
| 19803 | } |
| 19804 | |
| 19805 | nid = cfg->speaker_pins[0]; |
| 19806 | if (nid) { |
| 19807 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19808 | if (err < 0) |
| 19809 | return err; |
| 19810 | } |
| 19811 | nid = cfg->hp_pins[0]; |
| 19812 | if (nid) { |
| 19813 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19814 | if (err < 0) |
| 19815 | return err; |
| 19816 | } |
| 19817 | |
| 19818 | return 0; |
| 19819 | } |
| 19820 | |
| 19821 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19822 | hda_nid_t nid, int pin_type) |
| 19823 | { |
| 19824 | alc_set_pin_output(codec, nid, pin_type); |
| 19825 | } |
| 19826 | |
| 19827 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19828 | { |
| 19829 | struct alc_spec *spec = codec->spec; |
| 19830 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19831 | if (nid) { |
| 19832 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19833 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19834 | } |
| 19835 | } |
| 19836 | |
| 19837 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19838 | { |
| 19839 | struct alc_spec *spec = codec->spec; |
| 19840 | hda_nid_t pin; |
| 19841 | |
| 19842 | pin = spec->autocfg.hp_pins[0]; |
| 19843 | if (pin) |
| 19844 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19845 | pin = spec->autocfg.speaker_pins[0]; |
| 19846 | if (pin) |
| 19847 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19848 | } |
| 19849 | |
| 19850 | /* pcm configuration: identical with ALC880 */ |
| 19851 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19852 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19853 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19854 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19855 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19856 | |
| 19857 | /* |
| 19858 | * BIOS auto configuration |
| 19859 | */ |
| 19860 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19861 | { |
| 19862 | struct alc_spec *spec = codec->spec; |
| 19863 | int err; |
| 19864 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19865 | |
| 19866 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19867 | alc680_ignore); |
| 19868 | if (err < 0) |
| 19869 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19870 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19871 | if (!spec->autocfg.line_outs) { |
| 19872 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19873 | spec->multiout.max_channels = 2; |
| 19874 | spec->no_analog = 1; |
| 19875 | goto dig_only; |
| 19876 | } |
| 19877 | return 0; /* can't find valid BIOS pin config */ |
| 19878 | } |
| 19879 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19880 | if (err < 0) |
| 19881 | return err; |
| 19882 | |
| 19883 | spec->multiout.max_channels = 2; |
| 19884 | |
| 19885 | dig_only: |
| 19886 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19887 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19888 | if (spec->kctls.list) |
| 19889 | add_mixer(spec, spec->kctls.list); |
| 19890 | |
| 19891 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19892 | |
| 19893 | err = alc_auto_add_mic_boost(codec); |
| 19894 | if (err < 0) |
| 19895 | return err; |
| 19896 | |
| 19897 | return 1; |
| 19898 | } |
| 19899 | |
| 19900 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19901 | |
| 19902 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19903 | static void alc680_auto_init(struct hda_codec *codec) |
| 19904 | { |
| 19905 | struct alc_spec *spec = codec->spec; |
| 19906 | alc680_auto_init_multi_out(codec); |
| 19907 | alc680_auto_init_hp_out(codec); |
| 19908 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19909 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19910 | if (spec->unsol_event) |
| 19911 | alc_inithook(codec); |
| 19912 | } |
| 19913 | |
| 19914 | /* |
| 19915 | * configuration and preset |
| 19916 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19917 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19918 | [ALC680_BASE] = "base", |
| 19919 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19920 | }; |
| 19921 | |
| 19922 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19923 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19924 | {} |
| 19925 | }; |
| 19926 | |
| 19927 | static struct alc_config_preset alc680_presets[] = { |
| 19928 | [ALC680_BASE] = { |
| 19929 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19930 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19931 | .init_verbs = { alc680_init_verbs }, |
| 19932 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19933 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19934 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19935 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19936 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19937 | .unsol_event = alc680_unsol_event, |
| 19938 | .setup = alc680_base_setup, |
| 19939 | .init_hook = alc680_inithook, |
| 19940 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19941 | }, |
| 19942 | }; |
| 19943 | |
| 19944 | static int patch_alc680(struct hda_codec *codec) |
| 19945 | { |
| 19946 | struct alc_spec *spec; |
| 19947 | int board_config; |
| 19948 | int err; |
| 19949 | |
| 19950 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19951 | if (spec == NULL) |
| 19952 | return -ENOMEM; |
| 19953 | |
| 19954 | codec->spec = spec; |
| 19955 | |
| 19956 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19957 | alc680_models, |
| 19958 | alc680_cfg_tbl); |
| 19959 | |
| 19960 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19961 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19962 | codec->chip_name); |
| 19963 | board_config = ALC680_AUTO; |
| 19964 | } |
| 19965 | |
| 19966 | if (board_config == ALC680_AUTO) { |
| 19967 | /* automatic parse from the BIOS config */ |
| 19968 | err = alc680_parse_auto_config(codec); |
| 19969 | if (err < 0) { |
| 19970 | alc_free(codec); |
| 19971 | return err; |
| 19972 | } else if (!err) { |
| 19973 | printk(KERN_INFO |
| 19974 | "hda_codec: Cannot set up configuration " |
| 19975 | "from BIOS. Using base mode...\n"); |
| 19976 | board_config = ALC680_BASE; |
| 19977 | } |
| 19978 | } |
| 19979 | |
| 19980 | if (board_config != ALC680_AUTO) |
| 19981 | setup_preset(codec, &alc680_presets[board_config]); |
| 19982 | |
| 19983 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19984 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19985 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19986 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19987 | |
| 19988 | if (!spec->adc_nids) { |
| 19989 | spec->adc_nids = alc680_adc_nids; |
| 19990 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19991 | } |
| 19992 | |
| 19993 | if (!spec->cap_mixer) |
| 19994 | set_capture_mixer(codec); |
| 19995 | |
| 19996 | spec->vmaster_nid = 0x02; |
| 19997 | |
| 19998 | codec->patch_ops = alc_patch_ops; |
| 19999 | if (board_config == ALC680_AUTO) |
| 20000 | spec->init_hook = alc680_auto_init; |
| 20001 | |
| 20002 | return 0; |
| 20003 | } |
| 20004 | |
| 20005 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20006 | * patch entries |
| 20007 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20008 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20009 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20010 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20011 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20012 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20013 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20014 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20015 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20016 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20017 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20018 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20019 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20020 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20021 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20022 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20023 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20024 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20025 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20026 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20027 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20028 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20029 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20030 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20031 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20032 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20033 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20034 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20035 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20036 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20037 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20038 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20039 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20040 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20041 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20042 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20043 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20044 | {} /* terminator */ |
| 20045 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20046 | |
| 20047 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20048 | |
| 20049 | MODULE_LICENSE("GPL"); |
| 20050 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20051 | |
| 20052 | static struct hda_codec_preset_list realtek_list = { |
| 20053 | .preset = snd_hda_preset_realtek, |
| 20054 | .owner = THIS_MODULE, |
| 20055 | }; |
| 20056 | |
| 20057 | static int __init patch_realtek_init(void) |
| 20058 | { |
| 20059 | return snd_hda_add_codec_preset(&realtek_list); |
| 20060 | } |
| 20061 | |
| 20062 | static void __exit patch_realtek_exit(void) |
| 20063 | { |
| 20064 | snd_hda_delete_codec_preset(&realtek_list); |
| 20065 | } |
| 20066 | |
| 20067 | module_init(patch_realtek_init) |
| 20068 | module_exit(patch_realtek_exit) |